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 B6A3442116A for ; Wed, 16 Nov 2011 06:34:49 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org 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 geJYYwq+iys3 for ; Wed, 16 Nov 2011 06:34:49 -0800 (PST) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id 7B1C4429E52 for ; Wed, 16 Nov 2011 06:34:25 -0800 (PST) Received: from thor.loria.fr (thor.loria.fr [152.81.12.250]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id 56B9C6A0028; Wed, 16 Nov 2011 15:34:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1321454064; bh=neWK76obMY5ADtHEpTYm3wwYdWQz1LNCJuv8XwHXEnI=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=AyGCOS8o9Ex9WchaRCkpfuXDyA+xRAHUC0G8IkgWykJOO9PZ637KRQS4wklPUnc08 tgUQQjRPTsikHSwI42dn9gN5L507vNAmVjxMKr2z1v6i2YOyiu6n4L5qUVzMgdDfHh oELvMm65u67LhJCFKTWh1zxUhaNNPvuRyML0yyaQ= From: Thomas Jost To: notmuch@notmuchmail.org Subject: [PATCH 1/6] test: define a helper function for defining prereqs on executables Date: Wed, 16 Nov 2011 15:33:50 +0100 Message-Id: <1321454035-22023-2-git-send-email-schnouki@schnouki.net> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1321454035-22023-1-git-send-email-schnouki@schnouki.net> References: <1320176954-4897-1-git-send-email-pieter@praet.org> <1321454035-22023-1-git-send-email-schnouki@schnouki.net> 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: Wed, 16 Nov 2011 14:34:50 -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). (Thanks to Pieter Praet for suggesting the use of "hash" instead of "which".) --- 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 1ea7fa9..382934f 100755 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -543,6 +543,19 @@ test_have_prereq () { esac } +test_set_bin_prereq () { + bin=$1 + name=$2 + prereq=$3 + if hash $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.7.3