comparison libgomp/testsuite/lib/libgomp.exp @ 0:a06113de4d67

first commit
author kent <kent@cr.ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2009 14:47:48 +0900
parents
children 77e2b8dfacca
comparison
equal deleted inserted replaced
-1:000000000000 0:a06113de4d67
1 # Damn dejagnu for not having proper library search paths for load_lib.
2 # We have to explicitly load everything that gcc-dg.exp wants to load.
3
4 proc load_gcc_lib { filename } {
5 global srcdir loaded_libs
6
7 load_file $srcdir/../../gcc/testsuite/lib/$filename
8 set loaded_libs($filename) ""
9 }
10
11 load_lib dg.exp
12 load_gcc_lib file-format.exp
13 load_gcc_lib target-supports.exp
14 load_gcc_lib target-supports-dg.exp
15 load_gcc_lib scanasm.exp
16 load_gcc_lib scandump.exp
17 load_gcc_lib scanrtl.exp
18 load_gcc_lib scantree.exp
19 load_gcc_lib scanipa.exp
20 load_gcc_lib prune.exp
21 load_gcc_lib target-libpath.exp
22 load_gcc_lib wrapper.exp
23 load_gcc_lib gcc-defs.exp
24 load_gcc_lib torture-options.exp
25 load_gcc_lib timeout.exp
26 load_gcc_lib timeout-dg.exp
27 load_gcc_lib gcc-dg.exp
28 load_gcc_lib gfortran-dg.exp
29
30 set dg-do-what-default run
31
32 #
33 # GCC_UNDER_TEST is the compiler under test.
34 #
35
36 set libgomp_compile_options ""
37
38 #
39 # libgomp_init
40 #
41
42 if [info exists TOOL_OPTIONS] {
43 set multilibs [get_multilibs $TOOL_OPTIONS]
44 } else {
45 set multilibs [get_multilibs]
46 }
47
48 proc libgomp_init { args } {
49 global srcdir blddir objdir tool_root_dir
50 global libgomp_initialized
51 global tmpdir
52 global blddir
53 global gluefile wrap_flags
54 global ALWAYS_CFLAGS
55 global CFLAGS
56 global TOOL_EXECUTABLE TOOL_OPTIONS
57 global GCC_UNDER_TEST
58 global TESTING_IN_BUILD_TREE
59 global target_triplet
60 global always_ld_library_path
61
62 set blddir [lookfor_file [get_multilibs] libgomp]
63
64 # We set LC_ALL and LANG to C so that we get the same error
65 # messages as expected.
66 setenv LC_ALL C
67 setenv LANG C
68
69 if ![info exists GCC_UNDER_TEST] then {
70 if [info exists TOOL_EXECUTABLE] {
71 set GCC_UNDER_TEST $TOOL_EXECUTABLE
72 } else {
73 set GCC_UNDER_TEST "[find_gcc]"
74 }
75 }
76
77 if ![info exists tmpdir] {
78 set tmpdir "/tmp"
79 }
80
81 if [info exists gluefile] {
82 unset gluefile
83 }
84
85 if {![info exists CFLAGS]} {
86 set CFLAGS ""
87 }
88
89 # Locate libgcc.a so we don't need to account for different values of
90 # SHLIB_EXT on different platforms
91 set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
92 if {$gccdir != ""} {
93 set gccdir [file dirname $gccdir]
94 }
95
96 # Compute what needs to be put into LD_LIBRARY_PATH
97 set always_ld_library_path ".:${blddir}/.libs"
98
99 # Compute what needs to be added to the existing LD_LIBRARY_PATH.
100 if {$gccdir != ""} {
101 # Add AIX pthread directory first.
102 if { [llength [glob -nocomplain ${gccdir}/pthread/libgcc_s*.a]] >= 1 } {
103 append always_ld_library_path ":${gccdir}/pthread"
104 }
105 append always_ld_library_path ":${gccdir}"
106 set compiler [lindex $GCC_UNDER_TEST 0]
107
108 if { [is_remote host] == 0 && [which $compiler] != 0 } {
109 foreach i "[exec $compiler --print-multi-lib]" {
110 set mldir ""
111 regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
112 set mldir [string trimright $mldir "\;@"]
113 if { "$mldir" == "." } {
114 continue
115 }
116 if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
117 append always_ld_library_path ":${gccdir}/${mldir}"
118 }
119 }
120 }
121 }
122
123 set ALWAYS_CFLAGS ""
124 if { $blddir != "" } {
125 lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
126 lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
127 lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
128 }
129 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
130 lappend ALWAYS_CFLAGS "ldflags=-lgomp"
131
132 # We use atomic operations in the testcases to validate results.
133 if { ([istarget i?86-*-*] || [istarget x86_64-*-*])
134 && [check_effective_target_ilp32] } {
135 lappend ALWAYS_CFLAGS "additional_flags=-march=i486"
136 }
137
138 if [istarget *-*-darwin*] {
139 lappend ALWAYS_CFLAGS "additional_flags=-shared-libgcc"
140 }
141
142 if [istarget sparc*-*-*] {
143 lappend ALWAYS_CFLAGS "additional_flags=-mcpu=v9"
144 }
145
146 if [info exists TOOL_OPTIONS] {
147 lappend ALWAYS_CFLAGS "additional_flags=$TOOL_OPTIONS"
148 }
149
150 # Make sure that lines are not wrapped. That can confuse the
151 # error-message parsing machinery.
152 lappend ALWAYS_CFLAGS "additional_flags=-fmessage-length=0"
153
154 # And, gee, turn on OpenMP.
155 lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
156 }
157
158 #
159 # libgomp_target_compile -- compile a source file
160 #
161
162 proc libgomp_target_compile { source dest type options } {
163 global blddir
164 global libgomp_compile_options
165 global gluefile wrap_flags
166 global ALWAYS_CFLAGS
167 global GCC_UNDER_TEST
168 global lang_test_file
169 global lang_library_path
170 global lang_link_flags
171
172 if { [info exists lang_test_file] } {
173 if { $blddir != "" } {
174 # Some targets use libgfortran.a%s in their specs, so they need
175 # a -B option for uninstalled testing.
176 lappend options "additional_flags=-B${blddir}/${lang_library_path}"
177 lappend options "ldflags=-L${blddir}/${lang_library_path}"
178 }
179 lappend options "ldflags=${lang_link_flags}"
180 }
181
182 if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
183 lappend options "libs=${gluefile}"
184 lappend options "ldflags=${wrap_flags}"
185 }
186
187 lappend options "additional_flags=[libio_include_flags]"
188 lappend options "timeout=[timeout_value]"
189 lappend options "compiler=$GCC_UNDER_TEST"
190
191 set options [concat $libgomp_compile_options $options]
192
193 if [info exists ALWAYS_CFLAGS] {
194 set options [concat "$ALWAYS_CFLAGS" $options]
195 }
196
197 set options [dg-additional-files-options $options $source]
198
199 set result [target_compile $source $dest $type $options]
200
201 return $result
202 }
203
204 proc libgomp_option_help { } {
205 send_user " --additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n"
206 }
207
208 proc libgomp_option_proc { option } {
209 if [regexp "^--additional_options," $option] {
210 global libgomp_compile_options
211 regsub "--additional_options," $option "" option
212 foreach x [split $option ","] {
213 lappend libgomp_compile_options "additional_flags=$x"
214 }
215 return 1
216 } else {
217 return 0
218 }
219 }