2015-11-30 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / libgomp / testsuite / libgomp.c++ / c++.exp
blob0454f95588ec50825ac1bb1ac9ffcffc4d6c05f9
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 set blddir [lookfor_file [get_multilibs] libgomp]
28 if { $blddir != "" } {
29 # Look for a static libstdc++ first.
30 if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] {
31 set lang_test_file "${lang_library_path}/libstdc++.a"
32 set lang_test_file_found 1
33 # We may have a shared only build, so look for a shared libstdc++.
34 } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
35 set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}"
36 set lang_test_file_found 1
37 } else {
38 puts "No libstdc++ library found, will not execute c++ tests"
40 } elseif { [info exists GXX_UNDER_TEST] } {
41 set lang_test_file_found 1
42 # Needs to exist for libgomp.exp.
43 set lang_test_file ""
44 } else {
45 puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
48 if { $lang_test_file_found } {
49 # Gather a list of all tests.
50 set tests [lsort [find $srcdir/$subdir *.C]]
52 if { $blddir != "" } {
53 set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
54 } else {
55 set ld_library_path "$always_ld_library_path"
57 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
58 set_ld_library_path_env_vars
60 set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
61 if { [file exists $flags_file] } {
62 set libstdcxx_includes [exec sh $flags_file --build-includes]
63 } else {
64 set libstdcxx_includes ""
67 # Main loop.
68 dg-runtest $tests "" "$libstdcxx_includes $DEFAULT_CFLAGS"
71 # All done.
72 dg-finish