]> git.ipfire.org Git - thirdparty/gcc.git/blob - libitm/testsuite/libitm.c++/c++.exp
Update copyright in libitm.
[thirdparty/gcc.git] / libitm / testsuite / libitm.c++ / c++.exp
1 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16
17 load_lib libitm-dg.exp
18
19 global shlib_ext
20
21 set shlib_ext [get_shlib_extension]
22 # The C++ tests should be linked with g++, which defaults to -shared-libgcc.
23 # Doing that is currently too intrusive, so hardcode here.
24 set lang_link_flags "-shared-libgcc -lstdc++"
25 set lang_test_file_found 0
26 set lang_library_path "../libstdc++-v3/src/.libs"
27
28 # Initialize dg.
29 dg-init
30
31 set blddir [lookfor_file [get_multilibs] libitm]
32
33
34 if { $blddir != "" } {
35 # Look for a static libstdc++ first.
36 if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] {
37 set lang_test_file "${lang_library_path}/libstdc++.a"
38 set lang_test_file_found 1
39 # We may have a shared only build, so look for a shared libstdc++.
40 } elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] {
41 set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}"
42 set lang_test_file_found 1
43 } else {
44 puts "No libstdc++ library found, will not execute c++ tests"
45 }
46 } elseif { [info exists GXX_UNDER_TEST] } {
47 set lang_test_file_found 1
48 # Needs to exist for libitm.exp.
49 set lang_test_file ""
50 } else {
51 puts "GXX_UNDER_TEST not defined, will not execute c++ tests"
52 }
53
54 if { $lang_test_file_found } {
55 # Gather a list of all tests.
56 set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
57
58 if { $blddir != "" } {
59 set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
60 } else {
61 set ld_library_path "$always_ld_library_path"
62 }
63 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
64 set_ld_library_path_env_vars
65
66 set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
67 if { [file exists $flags_file] } {
68 set libstdcxx_includes [exec sh $flags_file --build-includes]
69 } else {
70 set libstdcxx_includes ""
71 }
72
73 # Main loop.
74 dg-runtest $tests "" $libstdcxx_includes
75 }
76
77 # All done.
78 dg-finish