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 415936DE0222 for ; Fri, 15 Apr 2016 05:17:49 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.283 X-Spam-Level: X-Spam-Status: No, score=0.283 tagged_above=-999 required=5 tests=[AWL=0.292, 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 x1LLv-vd4cLq for ; Fri, 15 Apr 2016 05:17:41 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id ADBAB6DE00F5 for ; Fri, 15 Apr 2016 05:17:40 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id 852D010019D; Fri, 15 Apr 2016 15:17:35 +0300 (EEST) From: Tomi Ollila To: notmuch@notmuchmail.org Cc: tomi.ollila@iki.fi Subject: [PATCH] test: fix die() in test-lib.sh and test-lib-common.sh Date: Fri, 15 Apr 2016 15:17:33 +0300 Message-Id: <1460722653-19363-1-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1460525704-15145-1-git-send-email-tomi.ollila@iki.fi> References: <1460525704-15145-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: Fri, 15 Apr 2016 12:17:49 -0000 Restoring fd was forgotten in die() implemented in test-lib.sh (so far it did not matter as the only place die was called the standard fd redirections were not in effect). In scripts that include test-lib-common.sh but not test-lib.sh the die() implementation needs to be a bit different due to fd redirection differences. test-lib-common.sh implements die() only if it was not implemented already. --- test/test-lib-common.sh | 6 ++++++ test/test-lib.sh | 1 + 2 files changed, 7 insertions(+) diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh index 4e17b78..f3b00d8 100644 --- a/test/test-lib-common.sh +++ b/test/test-lib-common.sh @@ -17,6 +17,12 @@ # This file contains common code to be used by both the regular # (correctness) tests and the performance tests. +# test-lib.sh defines die() which echoes to nonstandard fd where +# output was redirected earlier in that file. If test-lib.sh is not +# loaded, neither this redirection nor die() function were defined. +# +type die >/dev/null 2>&1 || die () { echo "$@" >&2; exit 1; } + find_notmuch_path () { dir="$1" diff --git a/test/test-lib.sh b/test/test-lib.sh index 2951a8f..b000232 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -252,6 +252,7 @@ die_signal () { die () { _die_common + exec >&6 say_color error '%-6s' FATAL echo " $*" echo -- 2.5.5