| 1 |
# Copyright (C) 2011-2025 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 |
load_gcc_lib gcc-dg.exp |
| 19 |
|
| 20 |
global shlib_ext |
| 21 |
|
| 22 |
set shlib_ext [get_shlib_extension] |
| 23 |
# The C++ tests should be linked with g++, which defaults to -shared-libgcc. |
| 24 |
# Doing that is currently too intrusive, so hardcode here. |
| 25 |
set lang_link_flags "-shared-libgcc -lstdc++" |
| 26 |
set lang_test_file_found 0 |
| 27 |
set lang_library_path "../libstdc++-v3/src/.libs" |
| 28 |
|
| 29 |
# Initialize dg. |
| 30 |
dg-init |
| 31 |
|
| 32 |
set blddir [lookfor_file [get_multilibs] libitm] |
| 33 |
|
| 34 |
|
| 35 |
if { $blddir != "" } { |
| 36 |
# Look for a static libstdc++ first. |
| 37 |
if [file exists "${blddir}/${lang_library_path}/libstdc++.a"] { |
| 38 |
set lang_test_file "${lang_library_path}/libstdc++.a" |
| 39 |
set lang_test_file_found 1 |
| 40 |
# We may have a shared only build, so look for a shared libstdc++. |
| 41 |
} elseif [file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] { |
| 42 |
set lang_test_file "${lang_library_path}/libstdc++.${shlib_ext}" |
| 43 |
set lang_test_file_found 1 |
| 44 |
} else { |
| 45 |
puts "No libstdc++ library found, will not execute c++ tests" |
| 46 |
} |
| 47 |
} elseif { [info exists GXX_UNDER_TEST] } { |
| 48 |
set lang_test_file_found 1 |
| 49 |
# Needs to exist for libitm.exp. |
| 50 |
set lang_test_file "" |
| 51 |
} else { |
| 52 |
puts "GXX_UNDER_TEST not defined, will not execute c++ tests" |
| 53 |
} |
| 54 |
|
| 55 |
if { $lang_test_file_found } { |
| 56 |
# Gather a list of all tests. |
| 57 |
set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]] |
| 58 |
|
| 59 |
set stdcxxadder "" |
| 60 |
if { $blddir != "" } { |
| 61 |
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}" |
| 62 |
set stdcxxadder "-B ${blddir}/${lang_library_path}" |
| 63 |
} else { |
| 64 |
set ld_library_path "$always_ld_library_path" |
| 65 |
} |
| 66 |
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST] |
| 67 |
set_ld_library_path_env_vars |
| 68 |
|
| 69 |
set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags" |
| 70 |
if { [file exists $flags_file] } { |
| 71 |
set libstdcxx_includes [exec sh $flags_file --build-includes] |
| 72 |
} else { |
| 73 |
set libstdcxx_includes "" |
| 74 |
} |
| 75 |
|
| 76 |
# Main loop. |
| 77 |
dg-runtest $tests $stdcxxadder $libstdcxx_includes |
| 78 |
} |
| 79 |
|
| 80 |
# All done. |
| 81 |
dg-finish |