From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C75A8429E32 for ; Mon, 3 Oct 2011 09:48:45 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] 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 XPOJPsz7H2YZ for ; Mon, 3 Oct 2011 09:48:45 -0700 (PDT) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id 168E8429E27 for ; Mon, 3 Oct 2011 09:48:45 -0700 (PDT) Received: from localhost.localdomain (thor.loria.fr [152.81.12.250]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id 440546A06A9; Mon, 3 Oct 2011 18:48:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1317660523; bh=zg5MTO9mYSZxa/whmkHMDVLtKHY5s71gqlCy0FvNV6Q=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: In-Reply-To:References; b=InJGYQA2vLXBPGSdKDRFWFw6SxkzQIOiZ7P45EseZROBd7JmIlHg+/r5zQ6O8zxn5 goRujMGUY+eSFwFrCik/DUQiVzqvloX8iUJnbXftE4xjLjloiEN1tAJ8+IO9EqhT70 dYMzZ1WuM7r5/WJeTf8DcT8hAhhm3sPwKxZi8Hv4= From: Thomas Jost To: notmuch@notmuchmail.org Subject: [PATCH 01/13] test: define a helper function for defining prereqs on executables Date: Mon, 3 Oct 2011 18:47:15 +0200 Message-Id: <1317660447-27520-2-git-send-email-schnouki@schnouki.net> X-Mailer: git-send-email 1.7.6.4 In-Reply-To: <1317660447-27520-1-git-send-email-schnouki@schnouki.net> References: <1317660447-27520-1-git-send-email-schnouki@schnouki.net> In-Reply-To: <871uuuywtt.fsf@convex-new.cs.unb.ca> References: <871uuuywtt.fsf@convex-new.cs.unb.ca> 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, 03 Oct 2011 16:48:46 -0000 While test_expect_success could be used to define these prereqs, this is probably not a good idea: if a prereq is not available, using test_expect_success would result in a test being reported as FAILED at the end of the test suite (and its dependencies as skipped). On the contrary, when using test_set_bin_prereq, no test will be reported as FAILED. --- test/test-lib.sh | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index f8df6a5..8e16a7e 100755 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -542,6 +542,19 @@ test_have_prereq () { esac } +test_set_bin_prereq () { + bin=$1 + name=$2 + prereq=$3 + if which $bin &>/dev/null + then + test_set_prereq $prereq + else + say_color info "%-6s" "INFO" + echo " Missing test prerequisite: $name" + fi +} + # You are not expected to call test_ok_ and test_failure_ directly, use # the text_expect_* functions instead. -- 1.7.6.4