Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 278D76DE0217 for ; Sat, 28 May 2016 05:40:04 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.252 X-Spam-Level: X-Spam-Status: No, score=0.252 tagged_above=-999 required=5 tests=[AWL=0.261, HEADER_FROM_DIFFERENT_DOMAINS=0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0-QMQa-KN3u1 for ; Sat, 28 May 2016 05:39:55 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 9D1506DE01EE for ; Sat, 28 May 2016 05:39:55 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id 825281000C6; Sat, 28 May 2016 15:39:43 +0300 (EEST) From: Tomi Ollila To: notmuch@notmuchmail.org Cc: tomi.ollila@iki.fi Subject: [PATCH v2 2/3] test: add function die () and have use of it in add_email_corpus () Date: Sat, 28 May 2016 15:39:29 +0300 Message-Id: <1464439170-25978-2-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1464439170-25978-1-git-send-email-tomi.ollila@iki.fi> References: <1464439170-25978-1-git-send-email-tomi.ollila@iki.fi> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 May 2016 12:40:04 -0000 Added die() function to test-lib.sh with the following first use of it: If notmuch new fails during email corpus addition the database is most probably inexistent or broken and the added corpus would be unusable while running single tests, giving misleading failures ("only" full 'make test' cleans out old corpus). --- test/test-lib.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index fa9f9beec4f2..ce3780a0426d 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -251,6 +251,16 @@ trap_signal () { exit $code } +die () { + _exit_common + exec >&6 + say_color error '%-6s' FATAL + echo " $*" + echo + echo "Unexpected exit while executing $0." + exit 1 +} + GIT_EXIT_OK= # Note: TEST_TMPDIR *NOT* exported! TEST_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/notmuch-test-$$.XXXXXX") @@ -544,7 +554,7 @@ add_email_corpus () cp -a $TEST_DIRECTORY/corpus.mail ${MAIL_DIR} else cp -a $TEST_DIRECTORY/corpus ${MAIL_DIR} - notmuch new >/dev/null + notmuch new >/dev/null || die "'notmuch new' failed while adding email corpus" cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpus.mail fi } -- 2.8.2