PR ipa/83619
[official-gcc.git] / libgomp / testsuite / libgomp.c++ / c++.exp
blobf4884e2ffa7a85932fc769cd90357da4040d522f
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"
10 if [info exists lang_include_flags] then {
11 unset lang_include_flags
14 # If a testcase doesn't have special options, use these.
15 if ![info exists DEFAULT_CFLAGS] then {
16 set DEFAULT_CFLAGS "-O2"
19 # Initialize dg.
20 dg-init
22 # Turn on OpenMP.
23 lappend ALWAYS_CFLAGS "additional_flags=-fopenmp"
25 # Switch into C++ mode. Otherwise, the libgomp.c-c++-common/*.c
26 # files would be compiled as C files.
27 set SAVE_GCC_UNDER_TEST "$GCC_UNDER_TEST"
28 set GCC_UNDER_TEST "$GCC_UNDER_TEST -x c++"
30 set blddir [lookfor_file [get_multilibs] libgomp]
33 if { $blddir != "" } {
34 # Look for a static libstdc++ first.
35 if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] {
36 set lang_test_file "${lang_library_path}/libstdc++.a"
37 set lang_test_file_found 1
38 # We may have a shared only build, so look for a shared libstdc++.
39 } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
40 set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}"
41 set lang_test_file_found 1
42 } else {
43 puts "No libstdc++ library found, will not execute c++ tests"
45 } elseif { [info exists GXX_UNDER_TEST] } {
46 set lang_test_file_found 1
47 # Needs to exist for libgomp.exp.
48 set lang_test_file ""
49 } else {
50 puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
53 if { $lang_test_file_found } {
54 # Gather a list of all tests.
55 set tests [lsort [concat \
56 [find $srcdir/$subdir *.C] \
57 [find $srcdir/$subdir/../libgomp.c-c++-common *.c]]]
59 if { $blddir != "" } {
60 set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
61 } else {
62 set ld_library_path "$always_ld_library_path"
64 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
65 set_ld_library_path_env_vars
67 set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
68 if { [file exists $flags_file] } {
69 set libstdcxx_includes [exec sh $flags_file --build-includes]
70 } else {
71 set libstdcxx_includes ""
74 # Main loop.
75 dg-runtest $tests "" "$libstdcxx_includes $DEFAULT_CFLAGS"
78 # See above.
79 set GCC_UNDER_TEST "$SAVE_GCC_UNDER_TEST"
81 # All done.
82 dg-finish