* doc/invoke.texi: Minor formatting fixes in option lists.
[official-gcc.git] / libgomp / testsuite / lib / libgomp-dg.exp
blobf8c6a427d18adc9b5cf8cc86831a7bd434075c23
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.
4 proc load_gcc_lib { filename } {
5 global srcdir loaded_libs
7 load_file $srcdir/../../gcc/testsuite/lib/$filename
8 set loaded_libs($filename) ""
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 gcc-dg.exp
25 load_gcc_lib gfortran-dg.exp
27 set dg-do-what-default run
30 # GCC_UNDER_TEST is the compiler under test.
33 set libgomp_compile_options ""
36 # libgomp_init -- This gets run more than it should be....
39 if [info exists TOOL_OPTIONS] {
40 set multilibs [get_multilibs $TOOL_OPTIONS]
41 } else {
42 set multilibs [get_multilibs]
45 proc libgomp_init { args } {
46 global srcdir blddir objdir tool_root_dir
47 global libgomp_initialized
48 global tmpdir
49 global gluefile wrap_flags
50 global ALWAYS_CFLAGS
51 global CFLAGS
52 global TOOL_EXECUTABLE TOOL_OPTIONS
53 global GCC_UNDER_TEST
54 global TESTING_IN_BUILD_TREE
55 global target_triplet
56 global ld_library_path
57 global lang_test_file
58 global lang_library_path
59 global lang_link_flags
61 set blddir [lookfor_file [get_multilibs] libgomp]
63 # We set LC_ALL and LANG to C so that we get the same error
64 # messages as expected.
65 setenv LC_ALL C
66 setenv LANG C
68 if ![info exists GCC_UNDER_TEST] then {
69 if [info exists TOOL_EXECUTABLE] {
70 set GCC_UNDER_TEST $TOOL_EXECUTABLE
71 } else {
72 set GCC_UNDER_TEST "[find_gcc]"
76 if ![info exists tmpdir] {
77 set tmpdir "/tmp"
80 if [info exists gluefile] {
81 unset gluefile
84 if {![info exists CFLAGS]} {
85 set CFLAGS ""
88 # Locate libgcc.a so we don't need to account for different values of
89 # SHLIB_EXT on different platforms
90 set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
91 if {$gccdir != ""} {
92 set gccdir [file dirname $gccdir]
95 # Compute what needs to be put into LD_LIBRARY_PATH
96 set ld_library_path ".:${blddir}/.libs"
98 if { [info exists lang_test_file] && [file exists "${blddir}/"] } {
99 append ld_library_path ":${blddir}/${lang_library_path}"
102 # Compute what needs to be added to the existing LD_LIBRARY_PATH.
103 if {$gccdir != ""} {
104 append ld_library_path ":${gccdir}"
105 set compiler [lindex $GCC_UNDER_TEST 0]
107 if { [is_remote host] == 0 && [which $compiler] != 0 } {
108 foreach i "[exec $compiler --print-multi-lib]" {
109 set mldir ""
110 regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir
111 set mldir [string trimright $mldir "\;@"]
112 if { "$mldir" == "." } {
113 continue
115 if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } {
116 append ld_library_path ":${gccdir}/${mldir}"
121 set_ld_library_path_env_vars
123 set ALWAYS_CFLAGS ""
124 lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
125 lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
126 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
127 lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs -lgomp"
128 if { [info exists lang_test_file] && [file exists "${blddir}/"] } {
129 lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/${lang_library_path} ${lang_link_flags}"
132 # We use atomic operations in the testcases to validate results.
133 if [istarget i?86-*-*] {
134 lappend ALWAYS_CFLAGS "additional_flags=-march=i486"
136 if [istarget sparc*-*-*] {
137 lappend ALWAYS_CFLAGS "additional_flags=-mcpu=v9"
140 if [info exists TOOL_OPTIONS] {
141 lappend ALWAYS_CFLAGS "additional_flags=$TOOL_OPTIONS"
144 # Make sure that lines are not wrapped. That can confuse the
145 # error-message parsing machinery.
146 lappend ALWAYS_CFLAGS "additional_flags=-fmessage-length=0"
148 # And, gee, turn on OpenMP.
149 lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
153 # libgomp_target_compile -- compile a source file
156 proc libgomp_target_compile { source dest type options } {
157 global tmpdir
158 global libgomp_compile_options
159 global gluefile wrap_flags
160 global ALWAYS_CFLAGS
161 global GCC_UNDER_TEST
163 libgomp_init
165 if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } {
166 lappend options "libs=${gluefile}"
167 lappend options "ldflags=${wrap_flags}"
170 lappend options "additional_flags=[libio_include_flags]"
171 lappend options "compiler=$GCC_UNDER_TEST"
173 set options [concat $libgomp_compile_options $options]
175 set options [concat "$ALWAYS_CFLAGS" $options]
177 set options [dg-additional-files-options $options $source]
179 set result [target_compile $source $dest $type $options]
181 return $result
184 # ??? The same as in standard.exp. Why doesn't anyone else have to
185 # define this?
187 proc libgomp_load { program args } {
188 if { [llength $args] > 0 } {
189 set program_args [lindex $args 0]
190 } else {
191 set program_args ""
194 if { [llength $args] > 1 } {
195 set input_file [lindex $args 1]
196 } else {
197 set input_file ""
199 return [remote_load target $program $program_args $input_file]
202 proc libgomp_option_help { } {
203 send_user " --additional_options,OPTIONS\t\tUse OPTIONS to compile the testcase files. OPTIONS should be comma-separated.\n"
206 proc libgomp_option_proc { option } {
207 if [regexp "^--additional_options," $option] {
208 global libgomp_compile_options
209 regsub "--additional_options," $option "" option
210 foreach x [split $option ","] {
211 lappend libgomp_compile_options "additional_flags=$x"
213 return 1
214 } else {
215 return 0
219 proc libgomp-dg-test { prog do_what extra_tool_flags } {
220 return [gcc-dg-test-1 libgomp_target_compile $prog $do_what $extra_tool_flags]
223 proc libgomp-dg-prune { system text } {
224 return [gcc-dg-prune $system $text]