Files
Pietro MonteiroandJakub Jelinek 66ce317036 libitm: Fix recent libitm testsuite regression [PR69018]
The commit r16-7202-gb129ff0880c6d1 broke running libitm’s testsuite
using combinations of options because it didn’t clean up all the
global variables set in c++.exp.  Fix the regression by using g++ for
the C++ tests and cleaning up the variables shared between C and C++
tests.

libitm/ChangeLog:
	PR libitm/69018
	* testsuite/lib/libitm.exp (libitm_init): Check
	GXX_UNDER_TEST.  Add "${blddir}/.libs" to
	always_ld_library_path if blddir is not empty.  Use
	"-fdiagnostics-plain-output".  Don't set compiler to GCC_UNDER_TEST.
	* testsuite/libitm.c++/c++.exp: If $blddir is not empty set
	libstdc++_library_path, shlib_ext, lang_include_flags, add
	"${blddir}/${lang_library_paths}" to ld_library_path.
	Unset libstdc++_library_path and shlib_ext if we skip C++
	tests and at the end of the test run.
	* testsuite/libitm.c/c.exp: Update the FSF address to the
	website in the license text. Unset lang_library_paths and
	lang_include_flags.  Set the compiler to $GCC_UNDER_TEST.

Co-authored-by: Jakub Jelinek  <jakub@redhat.com>
Signed-off-by: Pietro Monteiro <pietro@sociotechnical.xyz>
2026-02-12 11:34:57 -05:00

65 lines
2.0 KiB
Plaintext

# Copyright (C) 2011-2026 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
load_lib libitm-dg.exp
load_gcc_lib gcc-dg.exp
if { $blddir != "" } {
set libstdc++_library_path "../libstdc++-v3/src/.libs"
set shlib_ext [get_shlib_extension]
if { ![file exists "${blddir}/${libstdc++_library_path}/libstdc++.a"]
&& ![file exists "${blddir}/${libstdc++_library_path}/libstdc++.${shlib_ext}"] } {
verbose -log "No libstdc++ library found, will not execute c++ tests"
unset libstdc++_library_path
unset shlib_ext
return
}
lappend lang_library_paths ${libstdc++_library_path}
} elseif { ![info exists GXX_UNDER_TEST] } {
verbose -log "GXX_UNDER_TEST not defined, will not execute c++ tests"
return
}
lappend ALWAYS_CFLAGS "compiler=$GXX_UNDER_TEST"
# Initialize dg.
dg-init
# Gather a list of all tests.
set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
if { $blddir != "" } {
set lang_include_flags [exec sh ${blddir}/../libstdc++-v3/scripts/testsuite_flags --build-includes]
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_paths}"
} else {
set ld_library_path "$always_ld_library_path"
}
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
set_ld_library_path_env_vars
# Main loop.
dg-runtest $tests "" ""
if { $blddir != "" } {
unset lang_include_flags
unset libstdc++_library_path
unset lang_library_paths
unset shlib_ext
}
# All done.
dg-finish