From 07743c1340bebbaba78525d0d22c9104732c3f1d Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Sun, 5 Jan 2020 23:51:09 +0300 Subject: [PATCH] tcl_tests: Abbreviate output when run under CI To make CI output not too long - output only header of every test set and output only relevant log entries on test failures. When `CI' env is defined. Which should be defined for both Travis and Cirrus. Reference: https://docs.travis-ci.com/user/environment-variables/ https://cirrus-ci.org/guide/writing-tasks/#environment-variables --- tcl_tests/runtest.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tcl_tests/runtest.sh b/tcl_tests/runtest.sh index a9714fd..9e0dead 100644 --- a/tcl_tests/runtest.sh +++ b/tcl_tests/runtest.sh @@ -120,7 +120,21 @@ if [ "$*" ]; then exit $fail fi for t in $BASE_TESTS; do - $TCLSH $t.try || fail=1 + if [ "$CI" ]; then + if $TCLSH $t.try > $TESTDIR/$t.out 2>&1; then + head -1 $TESTDIR/$t.out + else + fail=1 + cat $TESTDIR/$t.out + echo "=== Output failures of $TESTDIR/$t.log ===" + awk "/ ends failed/" RS= ORS='\n\n' $TESTDIR/$t.log | + sed 's/^/\t/' + echo "=== End of $TESTDIR/$t.log ===" + exit 1 + fi + else + $TCLSH $t.try || fail=1 + fi done if false; then # ignore some tests for a time -- 2.39.5