ld testsuite output files

Alan Modra amodra@gmail.com
Thu Aug 29 11:40:11 GMT 2024


In many cases the output of one run_cc_link_tests test is used as
input for another test.  I hit a case where some system change caused
errors when compiling object files, but the old .so output from a
previous test run was still there, and then was used in following
tests.

	* testsuite/lib/ld-lib.exp (run_ld_link_tests): Delete output
	file before building.
	(run_ld_link_exec_tests, run_cc_link_tests): Likewise.

diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 5d5905dc260..c540940670d 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -488,6 +488,11 @@ proc run_ld_link_tests { ldtests args } {
 	set maybe_failed 0
 	set ld_output ""
 
+	# Don't leave previous output around
+	if { $binfile ne "tmpdir/" } {
+	    remote_file host delete $binfile
+	}
+
 	# Add -fno-lto.  LTO should be tested explicitly by $cflags.
 	if {[check_lto_available]} {
 	    set cflags "-fno-lto $cflags"
@@ -706,6 +711,11 @@ proc run_ld_link_exec_tests { ldtests args } {
 	set objfiles {}
 	set failed 0
 
+	# Don't leave previous output around
+	if { $binfile ne "tmpdir/" } {
+	    remote_file host delete $binfile
+	}
+
 	if { ![check_compiler_available] } {
 	    unsupported $testname
 	    continue
@@ -875,6 +885,11 @@ proc run_cc_link_tests { ldtests } {
 	set check_ld(terminal) 0
 	set check_ld(source) ""
 
+	# Don't leave previous output around
+	if { $binfile ne "tmpdir/" } {
+	    remote_file host delete $binfile
+	}
+
 	if { ![check_compiler_available] } {
 	    unsupported $testname
 	    continue

-- 
Alan Modra


More information about the Binutils mailing list