[committed][testsuite] Fix tcl error in dwz-tests.exp

Tom de Vries tdevries@suse.de
Tue Feb 9 22:41:31 GMT 2021


Hi,

When running:
...
$ make check CC="clang -gdwarf-5"
...
I run into:
...
ERROR: tcl error sourcing testsuite/dwz.tests/dwz-tests.exp.
ERROR: 2
readelf: Warning: DIE at offset 0xe6 refers to abbreviation number 8 \
  which does not exist while executing
"exec readelf -wi min | grep DW_AT_name | grep -c / "
...

Fix this by wrapping the exec in a catch.

Committed to trunk.

Thanks,
- Tom

[testsuite] Fix tcl error in dwz-tests.exp

2021-02-09  Tom de Vries  <tdevries@suse.de>

	* testsuite/dwz.tests/dwz-tests.exp: Wrap "exec readelf" in catch.

---
 testsuite/dwz.tests/dwz-tests.exp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/testsuite/dwz.tests/dwz-tests.exp b/testsuite/dwz.tests/dwz-tests.exp
index 2e5d19a..48c0015 100644
--- a/testsuite/dwz.tests/dwz-tests.exp
+++ b/testsuite/dwz.tests/dwz-tests.exp
@@ -24,11 +24,16 @@ foreach test $tests {
 	lappend required_execs "py-section-script"
     }
     if { $basename == "pr24341.sh" } {
-	# The exec min is used for the regression test for pr24341, but it only
-	# functions as such if the DWARF only contains the CUs of the test-case
-	# itself.
-	set matches [exec readelf -wi min | grep DW_AT_name | grep -c / ]
+	if { [catch {exec readelf -wi min | grep DW_AT_name | grep -c / } matches] } {
+	    # Some error occurred in the supported test, f.i. DWARF in min
+	    # unsupported by readelf.
+	    unsupported "$test"
+	    continue
+	}
 	if { $matches != 2 } {
+	    # The exec min is used for the regression test for pr24341, but it
+	    # only functions as such if the DWARF only contains the CUs of the
+	    # test-case itself.
 	    unsupported "$test"
 	    continue
 	}


More information about the Dwz mailing list