]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix gdb.dwarf2/dw-form-strx-out-of-bounds.exp with make-check-all.sh
authorTom de Vries <tdevries@suse.de>
Tue, 20 May 2025 09:10:29 +0000 (11:10 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 20 May 2025 09:10:29 +0000 (11:10 +0200)
I forgot to run test-case gdb.dwarf2/dw-form-strx-out-of-bounds.exp with
make-check-all.sh, and consequently failed to notice that it fails with for
instance target board fission-dwp.

The test-case does:
...
source $srcdir/$subdir/dw-form-strx.exp.tcl
...
and in that tcl file, prepare_for_testing fails, so a -1 is returned, but
that is ignored by the source command.

Fix this by using require, but rather that testing the result of the source
command, communicate success by setting a global variable
prepare_for_testing_done.

Likewise in gdb.dwarf2/dw-form-strx.exp.

Also, the test-case gdb.dwarf2/dw-form-strx-out-of-bounds.exp fails for target
board readnow, because the DWARF error occurs during a different command than
expected.

Fix this by just skipping the test-case in that case.

Tested on x86_64-linux.

Reported-by: Simon Marchi <simark@simark.ca>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/gdb.dwarf2/dw-form-strx-out-of-bounds.exp
gdb/testsuite/gdb.dwarf2/dw-form-strx.exp
gdb/testsuite/gdb.dwarf2/dw-form-strx.exp.tcl

index f2123fa7e079cd05dcb9f2596f84c3c39f04f455..cb24b19a1319da904eb4655f84c1d8ec4bacca06 100644 (file)
 # Out of bounds index.
 set int_str_idx 1
 
+# With readnow, the dwarf error is printed during the file command, so skip
+# the test.
+require !readnow
+
+set prepare_for_testing_done 0
 source $srcdir/$subdir/dw-form-strx.exp.tcl
+require {expr $prepare_for_testing_done == 1}
 
 set re_dwarf_error \
     [string_list_to_regexp \
index 9b62edfee0b6f32812ec3717193aeafe266a094d..3f739c4adea731eeba3492f65dc6511ba9999c7d 100644 (file)
@@ -18,6 +18,8 @@
 # Correct index.
 set int_str_idx 0
 
+set prepare_for_testing_done 0
 source $srcdir/$subdir/dw-form-strx.exp.tcl
+require {expr $prepare_for_testing_done == 1}
 
 gdb_test "ptype global_var" "type = int"
index 15cfe276f9662edb6cd2a42d10af53cd07c4a60a..d69b517f2e79523596389a478ca31a42434f53fa 100644 (file)
@@ -56,5 +56,9 @@ Dwarf::assemble $asm_file {
 
 if { [prepare_for_testing "failed to prepare" ${testfile} \
          [list $srcfile $asm_file] {nodebug}] } {
-    return -1
+    return
 }
+
+# Let includers know prepare_for_testing was done, without having to check
+# source return status.
+set prepare_for_testing_done 1