[binutils-gdb] binutils/testsuite: move objdump test output into tmpdir

Clement Chigot helflym@sourceware.org
Tue Apr 1 08:21:23 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c27e4f5273cd4d4e8714f9968ddc5cb900f0f528

commit c27e4f5273cd4d4e8714f9968ddc5cb900f0f528
Author: Clément Chigot <chigot@adacore.com>
Date:   Mon Mar 31 10:40:37 2025 +0200

    binutils/testsuite: move objdump test output into tmpdir
    
    "objdump.out" is a testsuite trace and thus should be created within the
    tmpdir.

Diff:
---
 binutils/testsuite/binutils-all/compress.exp | 16 ++++++-------
 binutils/testsuite/binutils-all/objdump.exp  | 34 ++++++++++++++--------------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp
index 5db9417e170..db167f0d30d 100644
--- a/binutils/testsuite/binutils-all/compress.exp
+++ b/binutils/testsuite/binutils-all/compress.exp
@@ -163,24 +163,24 @@ if ![string match "" $got] then {
 }
 
 set testname "objdump compress debug sections"
-set got [remote_exec host "$OBJDUMP -W ${compressedfile}.o" "" "/dev/null" "objdump.out"]
+set got [remote_exec host "$OBJDUMP -W ${compressedfile}.o" "" "/dev/null" "tmpdir/objdump.out"]
 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
     fail "$testname"
     send_log "$got\n"
 }
-if { [regexp_diff objdump.out $srcdir/$subdir/dw2-1.W] } then {
+if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/dw2-1.W] } then {
     fail "$testname"
 } else {
     pass "$testname"
 }
 
 set testname "objdump compress debug sections 3"
-set got [remote_exec host "$OBJDUMP -W ${compressedfile3}.o" "" "/dev/null" "objdump.out"]
+set got [remote_exec host "$OBJDUMP -W ${compressedfile3}.o" "" "/dev/null" "tmpdir/objdump.out"]
 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
     fail "$testname"
     send_log "$got\n"
 }
-if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
+if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/dw2-3.W] } then {
     fail "$testname"
 } else {
     pass "$testname"
@@ -565,12 +565,12 @@ if ![string match "" $got] then {
 }
 
 set testname "objdump compress debug sections 3 with zlib-gabi"
-set got [remote_exec host "$OBJDUMP -W ${compressedfile3}gabi.o" "" "/dev/null" "objdump.out"]
+set got [remote_exec host "$OBJDUMP -W ${compressedfile3}gabi.o" "" "/dev/null" "tmpdir/objdump.out"]
 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
     fail "$testname"
     send_log "$got\n"
 }
-if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3gabi.W] } then {
+if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/dw2-3gabi.W] } then {
     fail "$testname"
 } else {
     pass "$testname"
@@ -639,7 +639,7 @@ proc convert_test { testname  as_flags  objcop_flags } {
 	return
     }
 
-    set got [remote_exec host "$OBJDUMP -W ${copyfile}.o" "" "/dev/null" "objdump.out"]
+    set got [remote_exec host "$OBJDUMP -W ${copyfile}.o" "" "/dev/null" "tmpdir/objdump.out"]
 
     if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
 	fail "$testname (reason: unexpected output)"
@@ -648,7 +648,7 @@ proc convert_test { testname  as_flags  objcop_flags } {
 	return
     }
 
-    if { [regexp_diff objdump.out $srcdir/$subdir/dw2-3.W] } then {
+    if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/dw2-3.W] } then {
 	fail "$testname"
     } else {
 	pass "$testname"
diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp
index 76ee30f8ed9..bddb0cb618a 100644
--- a/binutils/testsuite/binutils-all/objdump.exp
+++ b/binutils/testsuite/binutils-all/objdump.exp
@@ -454,7 +454,7 @@ if { ![is_elf_format] } then {
 	set compressed_testfile tmpdir/dw2-compressed.${obj}
     }
 
-    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -s -j .zdebug_abbrev $compressed_testfile" "" "/dev/null" "objdump.out"]
+    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -s -j .zdebug_abbrev $compressed_testfile" "" "/dev/null" "tmpdir/objdump.out"]
 
     if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
 	fail "objdump -s -j .zdebug_abbrev (reason: unexpected output)"
@@ -462,7 +462,7 @@ if { ![is_elf_format] } then {
 	send_log "\n"
     }
 
-    if { [regexp_diff objdump.out $srcdir/$subdir/objdump.s] } then {
+    if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/objdump.s] } then {
 	fail "objdump -s -j .zdebug_abbrev"
     } else {
 	pass "objdump -s -j .zdebug_abbrev"
@@ -470,7 +470,7 @@ if { ![is_elf_format] } then {
 
     # Test objdump -W on a file that contains some compressed .debug sections
 
-    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -W $compressed_testfile" "" "/dev/null" "objdump.out"]
+    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -W $compressed_testfile" "" "/dev/null" "tmpdir/objdump.out"]
 
     if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
 	fail "objdump -W (reason: unexpected output)"
@@ -478,7 +478,7 @@ if { ![is_elf_format] } then {
 	send_log "\n"
     }
 
-    if { [regexp_diff objdump.out $srcdir/$subdir/objdump.W] } then {
+    if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/objdump.W] } then {
 	fail "objdump -W"
     } else {
 	pass "objdump -W"
@@ -486,7 +486,7 @@ if { ![is_elf_format] } then {
 
     # Test objdump -Z -s on a file that contains some compressed .debug sections
 
-    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -Z -s -j .zdebug_abbrev $compressed_testfile" "" "/dev/null" "objdump.out"]
+    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -Z -s -j .zdebug_abbrev $compressed_testfile" "" "/dev/null" "tmpdir/objdump.out"]
 
     if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
 	fail "objdump -Z -s (reason: unexpected output)"
@@ -494,7 +494,7 @@ if { ![is_elf_format] } then {
 	send_log "\n"
     }
 
-    if { [regexp_diff objdump.out $srcdir/$subdir/objdump.Zs] } then {
+    if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/objdump.Zs] } then {
 	fail "objdump -Z -s"
     } else {
 	pass "objdump -Z -s"
@@ -530,7 +530,7 @@ if { ![is_elf_format]
 	set decodedline_testfile tmpdir/dw2-decodedline.${obj}
     }
 
-    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -WL $decodedline_testfile" "" "/dev/null" "objdump.out"]
+    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -WL $decodedline_testfile" "" "/dev/null" "tmpdir/objdump.out"]
 
     if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
 	fail "objdump -WL (reason: unexpected output)"
@@ -538,7 +538,7 @@ if { ![is_elf_format]
 	send_log "\n"
     }
 
-    if { [regexp_diff objdump.out $srcdir/$subdir/objdump.WL] } then {
+    if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/objdump.WL] } then {
 	fail "objdump -WL"
     } else {
 	pass "objdump -WL"
@@ -558,7 +558,7 @@ if { ![is_elf_format] } then {
 	set ranges_testfile tmpdir/dw2-ranges.${obj}
     }
 
-    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS --dwarf=Ranges $ranges_testfile" "" "/dev/null" "objdump.out"]
+    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS --dwarf=Ranges $ranges_testfile" "" "/dev/null" "tmpdir/objdump.out"]
 
     if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
 	fail "objdump -W for debug_ranges (reason: unexpected output)"
@@ -567,7 +567,7 @@ if { ![is_elf_format] } then {
     }
 
     setup_xfail "msp430-*-*"
-    if { [regexp_diff objdump.out $srcdir/$subdir/dw2-ranges.W] } then {
+    if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/dw2-ranges.W] } then {
 	fail "objdump -W for debug_ranges"
     } else {
 	pass "objdump -W for debug_ranges"
@@ -587,7 +587,7 @@ if { ![is_elf_format] } then {
        set op_testfile tmpdir/dw5-op.${obj}
     }
 
-    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -Wi $op_testfile" "" "/dev/null" "objdump.out"]
+    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -Wi $op_testfile" "" "/dev/null" "tmpdir/objdump.out"]
 
     if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
        fail "objdump -Wi (reason: unexpected output)"
@@ -595,8 +595,8 @@ if { ![is_elf_format] } then {
        send_log "\n"
     }
 
-    set got [remote_exec host "tail -n +4 objdump.out" "" "/dev/null" "objdump.out"]
-    set output [remote_upload host objdump.out]
+    set got [remote_exec host "tail -n +4 tmpdir/objdump.out" "" "/dev/null" "tmpdir/objdump.out"]
+    set output [remote_upload host tmpdir/objdump.out]
 
     if ![file size $output] then {
        # If the output file is empty, then this target does not
@@ -606,7 +606,7 @@ if { ![is_elf_format] } then {
        return
     }
 
-    if { [regexp_diff objdump.out $srcdir/$subdir/dw5-op.W] } then {
+    if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/dw5-op.W] } then {
        fail "objdump -Wi for DW_OP_*"
     } else {
        pass "objdump -Wi for DW_OP_*"
@@ -712,7 +712,7 @@ if { [is_elf_format] } then {
 	set testfile tmpdir/debuglink.${obj}
     }
 
-    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -Wk -WN $testfile" "" "/dev/null" "objdump.out"]
+    set got [remote_exec host "$OBJDUMP $OBJDUMPFLAGS -Wk -WN $testfile" "" "/dev/null" "tmpdir/objdump.out"]
 
     if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
 	fail "objdump -Wk (reason: unexpected output)"
@@ -720,7 +720,7 @@ if { [is_elf_format] } then {
 	send_log "\n"
     }
 
-    if { [regexp_diff objdump.out $srcdir/$subdir/objdump.Wk] } then {
+    if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/objdump.Wk] } then {
 	fail "objdump -Wk (reason: output does not match expectations)"
     } else {
 	pass "objdump -Wk"
@@ -764,7 +764,7 @@ proc test_follow_debuglink { options dumpfile } {
 
     if { [regexp_diff tmpdir/objdump.out $srcdir/$subdir/$dumpfile] } then {
 	fail $test
-	verbose "output is \n[file_contents objdump.out]" 2
+	verbose "output is \n[file_contents tmpdir/objdump.out]" 2
 	return
     }


More information about the Binutils-cvs mailing list