1 # This program is free software; you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation; either version 2 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program; if not, write to the Free Software
13 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 load_lib libitm-dg.exp
19 set shlib_ext [get_shlib_extension]
20 set lang_link_flags "-lstdc++"
21 set lang_test_file_found 0
22 set lang_library_path "../libstdc++-v3/src/.libs"
27 set blddir [lookfor_file [get_multilibs] libgomp]
30 if { $blddir != "" } {
31 # Look for a static libstdc++ first.
32 if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] {
33 set lang_test_file "${lang_library_path}/libstdc++.a"
34 set lang_test_file_found 1
35 # We may have a shared only build, so look for a shared libstdc++.
36 } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
37 set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}"
38 set lang_test_file_found 1
40 puts "No libstdc++ library found, will not execute c++ tests"
42 } elseif { [info exists GXX_UNDER_TEST] } {
43 set lang_test_file_found 1
44 # Needs to exist for libgomp.exp.
47 puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
50 if { $lang_test_file_found } {
51 # Gather a list of all tests.
52 set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
54 if { $blddir != "" } {
55 set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
57 set ld_library_path "$always_ld_library_path"
59 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
60 set_ld_library_path_env_vars
62 set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
63 if { [file exists $flags_file] } {
64 set libstdcxx_includes [exec sh $flags_file --build-includes]
66 set libstdcxx_includes ""
70 dg-runtest $tests "" $libstdcxx_includes