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>
global ALWAYS_CFLAGS
global CFLAGS
global TOOL_EXECUTABLE TOOL_OPTIONS
- global GCC_UNDER_TEST
+ global GCC_UNDER_TEST GXX_UNDER_TEST
global TESTING_IN_BUILD_TREE
global target_triplet
global always_ld_library_path
} else {
set GCC_UNDER_TEST "[find_gcc]"
}
+ # Only if we're guessing 'GCC_UNDER_TEST', we're also going to guess
+ # 'GXX_UNDER_TEST'
+ if ![info exists GXX_UNDER_TEST] then {
+ if [info exists TOOL_EXECUTABLE] {
+ set GXX_UNDER_TEST $TOOL_EXECUTABLE
+ } else {
+ set GXX_UNDER_TEST "[find_g++]"
+ }
+ } else {
+ error "GXX_UNDER_TEST set but not GCC_UNDER_TEST"
+ }
}
if ![info exists tmpdir] {
}
# Compute what needs to be put into LD_LIBRARY_PATH
- set always_ld_library_path ".:${blddir}/.libs"
+ set always_ld_library_path "."
# Compute what needs to be added to the existing LD_LIBRARY_PATH.
if {$gccdir != ""} {
lappend ALWAYS_CFLAGS "additional_flags=-B${blddir}/"
lappend ALWAYS_CFLAGS "additional_flags=-I${blddir}"
lappend ALWAYS_CFLAGS "ldflags=-L${blddir}/.libs"
+
+ append always_ld_library_path ":${blddir}/.libs"
}
lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}/.."
# Turn on transactional memory support.
lappend ALWAYS_CFLAGS "additional_flags=-fgnu-tm"
- lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
+ # Disable caret, color, URL diagnostics
+ lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-plain-output"
}
#
lappend options "additional_flags=[libio_include_flags]"
lappend options "timeout=[timeout_value]"
- lappend options "compiler=$GCC_UNDER_TEST"
set options [concat $libitm_compile_options $options]
load_lib libitm-dg.exp
load_gcc_lib gcc-dg.exp
-global shlib_ext
-
-set shlib_ext [get_shlib_extension]
-# The C++ tests should be linked with g++, which defaults to -shared-libgcc.
-# Doing that is currently too intrusive, so hardcode here.
-set lang_link_flags "-shared-libgcc -lstdc++"
-set lang_test_file_found 0
-set lang_library_path "../libstdc++-v3/src/.libs"
-
-# Initialize dg.
-dg-init
-
-set blddir [lookfor_file [get_multilibs] libitm]
-
-
if { $blddir != "" } {
- if { ![file exists "${blddir}/${lang_library_path}/libstdc++.a"]
- && ![file exists "${blddir}/${lang_library_path}/libstdc++.${shlib_ext}"] } {
+ 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 lang_library_path
+ unset libstdc++_library_path
+ unset shlib_ext
return
}
- lappend lang_library_paths ${lang_library_path}
+ 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 ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
+ 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
-set flags_file "${blddir}/../libstdc++-v3/scripts/testsuite_flags"
-if { [file exists $flags_file] } {
- set lang_include_flags [exec sh $flags_file --build-includes]
-}
-
# Main loop.
dg-runtest $tests "" ""
if { $blddir != "" } {
unset lang_include_flags
- unset lang_library_path
+ unset libstdc++_library_path
unset lang_library_paths
+ unset shlib_ext
}
# All done.
# 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, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
-if [info exists lang_library_path] then {
- unset lang_library_path
- unset lang_link_flags
+if [info exists lang_library_paths] then {
+ unset lang_library_paths
}
-if [info exists lang_test_file] then {
- unset lang_test_file
+if [info exists lang_include_flags] then {
+ unset lang_include_flags
}
load_lib libitm-dg.exp
load_gcc_lib gcc-dg.exp
+lappend ALWAYS_CFLAGS "compiler=$GCC_UNDER_TEST"
+
# If a testcase doesn't have special options, use these.
if ![info exists DEFAULT_CFLAGS] then {
set DEFAULT_CFLAGS "-O2"