[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[committed] Show dwz stderr on failure



Hi,

We redirect dwz stderr to a dwz.err file in case we're expecting some error
message, or want to grep for it, but in case the test fails in some way, we
still want to see dwz.err in the testrun output.

Fix this by adding 'cat dwz.err' where appropriate.

Committed to trunk.

Thanks,
- Tom

Show dwz stderr on failure

2019-03-16  Tom de Vries  <tdevries@suse.de>

	* testsuite/dwz.tests/objcopy-remove-debug-abbrev.sh: Emit dwz.err on
	exit.
	* testsuite/dwz.tests/objcopy-strip-debug.sh: Same.
	* testsuite/dwz.tests/pr24174.sh: Same.
	* testsuite/dwz.tests/too-many-dies.sh: Redirect stderr to dwz.err and
	grep for expected error message.  Emit dwz.err on exit.

---
 testsuite/dwz.tests/objcopy-remove-debug-abbrev.sh |  5 +++--
 testsuite/dwz.tests/objcopy-strip-debug.sh         |  5 +++--
 testsuite/dwz.tests/pr24174.sh                     |  1 +
 testsuite/dwz.tests/too-many-dies.sh               | 13 +++++++++++--
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/testsuite/dwz.tests/objcopy-remove-debug-abbrev.sh b/testsuite/dwz.tests/objcopy-remove-debug-abbrev.sh
index d5cfa9c..93fa04b 100644
--- a/testsuite/dwz.tests/objcopy-remove-debug-abbrev.sh
+++ b/testsuite/dwz.tests/objcopy-remove-debug-abbrev.sh
@@ -6,12 +6,13 @@ if dwz 1 2>dwz.err; status=$?; then
     true
 fi
 
-[ $status -eq 1 ]
-
 if ! grep -q "\.debug_abbrev not present" dwz.err; then
+    cat dwz.err
     exit 1
 fi
 
+[ $status -eq 1 ]
+
 cmp 1 1.saved
 
 rm -f 1 1.saved dwz.err
diff --git a/testsuite/dwz.tests/objcopy-strip-debug.sh b/testsuite/dwz.tests/objcopy-strip-debug.sh
index 4f1a51c..3aec669 100644
--- a/testsuite/dwz.tests/objcopy-strip-debug.sh
+++ b/testsuite/dwz.tests/objcopy-strip-debug.sh
@@ -6,12 +6,13 @@ if dwz 1 2>dwz.err; status=$?; then
     true
 fi
 
-[ $status -eq 1 ]
-
 if ! grep -q "\.debug_info section not present" dwz.err; then
+    cat dwz.err
     exit 1
 fi
 
+[ $status -eq 1 ]
+
 cmp 1 1.saved
 
 rm -f 1 1.saved dwz.err
diff --git a/testsuite/dwz.tests/pr24174.sh b/testsuite/dwz.tests/pr24174.sh
index 6543d3b..1044368 100644
--- a/testsuite/dwz.tests/pr24174.sh
+++ b/testsuite/dwz.tests/pr24174.sh
@@ -5,6 +5,7 @@ if dwz 1 2>dwz.err; status=$?; then
 fi
 
 if grep -q "DWARF version 0 unhandled" dwz.err; then
+    cat dwz.err
     exit 1
 fi
 
diff --git a/testsuite/dwz.tests/too-many-dies.sh b/testsuite/dwz.tests/too-many-dies.sh
index 23ecb01..aa2639b 100644
--- a/testsuite/dwz.tests/too-many-dies.sh
+++ b/testsuite/dwz.tests/too-many-dies.sh
@@ -1,7 +1,16 @@
 cp ../hello 1
 
-if dwz -L0 1 2>/dev/null; then exit 1; fi
+if dwz -L0 1 2>dwz.err; status=?; then
+    true
+fi
+
+if ! grep -q "Too many DIEs, not optimizing" dwz.err; then
+    cat dwz.err
+    exit 1
+fi
+
+[ $status -eq 1 ]
 
 cmp 1 ../hello
 
-rm -f 1
+rm -f 1 dwz.err