From 9a60a5b6de0ac20f2ac8cc37df22ca1081c84ac4 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Mon, 21 Jan 2013 05:01:46 +0200 Subject: [PATCH] [PATCH 2/2] test/test-lib.sh: separate signaled exit --- 2e/ad0c00e2631169776b19179257f8e9e0f5455b | 95 +++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 2e/ad0c00e2631169776b19179257f8e9e0f5455b diff --git a/2e/ad0c00e2631169776b19179257f8e9e0f5455b b/2e/ad0c00e2631169776b19179257f8e9e0f5455b new file mode 100644 index 000000000..1c1d7c26a --- /dev/null +++ b/2e/ad0c00e2631169776b19179257f8e9e0f5455b @@ -0,0 +1,95 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id DA382431FB6 + for ; Sun, 20 Jan 2013 19:02:02 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id r7tV0NygbKtJ for ; + Sun, 20 Jan 2013 19:02:02 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id DA53F431FBD + for ; Sun, 20 Jan 2013 19:02:01 -0800 (PST) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 361B81000CF; Mon, 21 Jan 2013 05:01:51 +0200 (EET) +From: Tomi Ollila +To: notmuch@notmuchmail.org +Subject: [PATCH 2/2] test/test-lib.sh: separate signaled exit +Date: Mon, 21 Jan 2013 05:01:46 +0200 +Message-Id: <1358737306-21744-2-git-send-email-tomi.ollila@iki.fi> +X-Mailer: git-send-email 1.8.0 +In-Reply-To: <1358737306-21744-1-git-send-email-tomi.ollila@iki.fi> +References: + <1358737306-21744-1-git-send-email-tomi.ollila@iki.fi> +Cc: tomi.ollila@iki.fi +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Mon, 21 Jan 2013 03:02:03 -0000 + +When execution of tests is interrupted by signal coming outside of the +test system itself, output just one line "interrupted by signal " +message to standard output. This distinguishes the case from internal +exit and reduces noise. +--- + test/test-lib.sh | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/test/test-lib.sh b/test/test-lib.sh +index 0098bfd..e717c52 100644 +--- a/test/test-lib.sh ++++ b/test/test-lib.sh +@@ -190,9 +190,15 @@ test_fixed=0 + test_broken=0 + test_success=0 + +-die () { ++_die_common () { + code=$? ++ trap - EXIT ++ set +ex + rm -rf "$TEST_TMPDIR" ++} ++ ++die () { ++ _die_common + if test -n "$GIT_EXIT_OK" + then + exit $code +@@ -206,10 +212,17 @@ die () { + fi + } + ++die_signal () { ++ _die_common ++ echo >&5 "FATAL: $0: interrupted by signal" $((code - 128)) ++ exit $code ++} ++ + GIT_EXIT_OK= + # Note: TEST_TMPDIR *NOT* exported! + TEST_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/notmuch-test-$$.XXXXXX") + trap 'die' EXIT ++trap 'die_signal' HUP INT TERM + + test_decode_color () { + sed -e 's/.\[1m//g' \ +-- +1.8.0 + -- 2.26.2