unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
To: Notmuch Mail <notmuch@notmuchmail.org>
Subject: [PATCH v2] test: report summary even when aborting
Date: Sun, 26 May 2019 11:03:13 -0400	[thread overview]
Message-ID: <20190526150313.2786-1-dkg@fifthhorseman.net> (raw)
In-Reply-To: <m2d0k6l3sp.fsf@guru.guru-group.fi>

In certain cases of test suite failure, the summary report was not
being printed.  In particular, any failure on the parallel test suite,
and any aborted test in the serialized test suite would end up hiding
the summary.

It's better to always show the summary where we can (while preserving
the return code).  If we do abort due to this high-level failure,
though, we should also announce to the user that we're doing so as
close to the end of the process as possible, to make it easier to find
the problem.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
---
 test/notmuch-test | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/test/notmuch-test b/test/notmuch-test
index 50ed8721..b58fd3b3 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -45,6 +45,8 @@ else
 fi
 
 trap 'e=$?; kill $!; exit $e' HUP INT TERM
+
+META_FAILURE=
 # Run the tests
 if test -z "$NOTMUCH_TEST_SERIALIZE" && command -v parallel >/dev/null ; then
     test -t 1 && export COLORS_WITHOUT_TTY=t || :
@@ -57,8 +59,7 @@ if test -z "$NOTMUCH_TEST_SERIALIZE" && command -v parallel >/dev/null ; then
     fi
     RES=$?
     if [[ $RES != 0 ]]; then
-        echo "parallel test suite returned error code $RES"
-        exit $RES
+        META_FAILURE="parallel test suite returned error code $RES"
     fi
 else
     for test in $TESTS; do
@@ -69,7 +70,8 @@ else
         RES=$?
         testname=$(basename $test .sh)
         if [[ $RES != 0 && ! -e "$NOTMUCH_BUILDDIR/test/test-results/$testname" ]]; then
-            exit $RES
+            META_FAILURE="Aborting on $testname (returned $RES)"
+            break
         fi
     done
 fi
@@ -79,6 +81,12 @@ trap - HUP INT TERM
 echo
 $NOTMUCH_SRCDIR/test/aggregate-results.sh $NOTMUCH_BUILDDIR/test/test-results/*
 ev=$?
+if [ -n "$META_FAILURE" ]; then
+    printf 'ERROR: %s\n' "$META_FAILURE"
+    if [ $ev = 0 ]; then
+        ev=$RES
+    fi
+fi
 
 # Clean up
 rm -rf $NOTMUCH_BUILDDIR/test/test-results
-- 
2.20.1

  reply	other threads:[~2019-05-26 15:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-25 17:30 [PATCH] test: report summary even when aborting Daniel Kahn Gillmor
2019-05-25 19:41 ` Tomi Ollila
2019-05-26 15:03   ` Daniel Kahn Gillmor [this message]
2019-05-26 21:35     ` [PATCH v2] " Tomi Ollila
2019-05-26 21:56     ` David Bremner
2019-05-31 10:59     ` David Bremner
2019-05-26 15:06   ` [PATCH] " Daniel Kahn Gillmor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190526150313.2786-1-dkg@fifthhorseman.net \
    --to=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).