Thread (43 messages) flat view 43 messages, 4 authors, 2017-12-28

Re: [PATCH v3 4/4] travis-ci: only print test failures if there are test results available

From: Lars Schneider <hidden>
Date: 2017-12-27 18:52:23

quoted hunk ↗ jump to hunk
On 27 Dec 2017, at 17:36, SZEDER Gábor [off-list ref] wrote:

When a build job running the test suite fails, our
'ci/print-test-failures.sh' script scans all 't/test-results/*.exit'
files to find failed tests and prints their verbose output.  However,
if a build job were to fail before it ever gets to run the test suite,
then there will be no files to match the above pattern and the shell
will take the pattern literally, resulting in errors like this in the
trace log:

 cat: t/test-results/*.exit: No such file or directory
 ------------------------------------------------------------------------
 t/test-results/*.out...
 ------------------------------------------------------------------------
 cat: t/test-results/*.out: No such file or directory

Check upfront and proceed only if there are any such files present.

Signed-off-by: SZEDER Gábor <redacted>
---
ci/print-test-failures.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh
index 97cc05901..4f261ddc0 100755
--- a/ci/print-test-failures.sh
+++ b/ci/print-test-failures.sh
@@ -8,6 +8,12 @@
# Tracing executed commands would produce too much noise in the loop below.
set +x

+if ! ls t/test-results/*.exit >/dev/null 2>/dev/null
+then
+	echo "Build job failed before the tests could have been run"
+	exit
+fi
+
Look good to me!

Minor nit: I am not 100% sure about the grammar but I am no native speaker
and can't really tell.


Thanks,
Lars


for TEST_EXIT in t/test-results/*.exit
do
	if [ "$(cat "$TEST_EXIT")" != "0" ]
-- 
2.15.1.500.g54ea76cc4
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help