libgomp: Prepare for testcases without -fopenmp.
[official-gcc.git] / libgomp / testsuite / libgomp.c++ / c++.exp
blob88e017e4e29cf568d3289af3d6eed5f2a7eee972
1 load_lib libgomp-dg.exp
2 load_gcc_lib gcc-dg.exp
4 global shlib_ext
6 set shlib_ext [get_shlib_extension]
7 set lang_link_flags "-lstdc++"
8 set lang_test_file_found 0
9 set lang_library_path "../libstdc++-v3/src/.libs"
11 # Initialize dg.
12 dg-init
14 # Turn on OpenMP.
15 lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
17 set blddir [lookfor_file [get_multilibs] libgomp]
20 if { $blddir != "" } {
21 # Look for a static libstdc++ first.
22 if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] {
23 set lang_test_file "${lang_library_path}/libstdc++.a"
24 set lang_test_file_found 1
25 # We may have a shared only build, so look for a shared libstdc++.
26 } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
27 set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}"
28 set lang_test_file_found 1
29 } else {
30 puts "No libstdc++ library found, will not execute c++ tests"
32 } elseif { [info exists GXX_UNDER_TEST] } {
33 set lang_test_file_found 1
34 # Needs to exist for libgomp.exp.
35 set lang_test_file ""
36 } else {
37 puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
40 if { $lang_test_file_found } {
41 # Gather a list of all tests.
42 set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
44 if { $blddir != "" } {
45 set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
46 } else {
47 set ld_library_path "$always_ld_library_path"
49 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
50 set_ld_library_path_env_vars
52 set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
53 if { [file exists $flags_file] } {
54 set libstdcxx_includes [exec sh $flags_file --build-includes]
55 } else {
56 set libstdcxx_includes ""
59 # Main loop.
60 dg-runtest $tests "" $libstdcxx_includes
63 # All done.
64 dg-finish