[PATCH 1/6] test: define a helper function for defining prereqs on executables
authorThomas Jost <schnouki@schnouki.net>
Wed, 16 Nov 2011 14:33:50 +0000 (15:33 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:13 +0000 (09:40 -0800)
ab/e8df33b6b7ab17a68ef7140c47e7e539607b84 [new file with mode: 0644]

diff --git a/ab/e8df33b6b7ab17a68ef7140c47e7e539607b84 b/ab/e8df33b6b7ab17a68ef7140c47e7e539607b84
new file mode 100644 (file)
index 0000000..fd13562
--- /dev/null
@@ -0,0 +1,91 @@
+Return-Path: <schnouki@schnouki.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id B6A3442116A\r
+       for <notmuch@notmuchmail.org>; Wed, 16 Nov 2011 06:34:49 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.1\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id geJYYwq+iys3 for <notmuch@notmuchmail.org>;\r
+       Wed, 16 Nov 2011 06:34:49 -0800 (PST)\r
+Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
+       by olra.theworths.org (Postfix) with ESMTP id 7B1C4429E52\r
+       for <notmuch@notmuchmail.org>; Wed, 16 Nov 2011 06:34:25 -0800 (PST)\r
+Received: from thor.loria.fr (thor.loria.fr [152.81.12.250])\r
+       by ks3536.kimsufi.com (Postfix) with ESMTPSA id 56B9C6A0028;\r
+       Wed, 16 Nov 2011 15:34:24 +0100 (CET)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
+       s=key-schnouki; t=1321454064;\r
+       bh=neWK76obMY5ADtHEpTYm3wwYdWQz1LNCJuv8XwHXEnI=;\r
+       h=From:To:Subject:Date:Message-Id:In-Reply-To:References;\r
+       b=AyGCOS8o9Ex9WchaRCkpfuXDyA+xRAHUC0G8IkgWykJOO9PZ637KRQS4wklPUnc08\r
+       tgUQQjRPTsikHSwI42dn9gN5L507vNAmVjxMKr2z1v6i2YOyiu6n4L5qUVzMgdDfHh\r
+       oELvMm65u67LhJCFKTWh1zxUhaNNPvuRyML0yyaQ=\r
+From: Thomas Jost <schnouki@schnouki.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/6] test: define a helper function for defining prereqs on\r
+       executables\r
+Date: Wed, 16 Nov 2011 15:33:50 +0100\r
+Message-Id: <1321454035-22023-2-git-send-email-schnouki@schnouki.net>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To: <1321454035-22023-1-git-send-email-schnouki@schnouki.net>\r
+References: <1320176954-4897-1-git-send-email-pieter@praet.org>\r
+       <1321454035-22023-1-git-send-email-schnouki@schnouki.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 16 Nov 2011 14:34:50 -0000\r
+\r
+While test_expect_success could be used to define these prereqs, this is\r
+probably not a good idea: if a prereq is not available, using\r
+test_expect_success would result in a test being reported as FAILED at the end\r
+of the test suite (and its dependencies as skipped).\r
+\r
+(Thanks to Pieter Praet for suggesting the use of "hash" instead of "which".)\r
+---\r
+ test/test-lib.sh |   13 +++++++++++++\r
+ 1 files changed, 13 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 1ea7fa9..382934f 100755\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -543,6 +543,19 @@ test_have_prereq () {\r
+       esac\r
+ }\r
\r
++test_set_bin_prereq () {\r
++      bin=$1\r
++      name=$2\r
++      prereq=$3\r
++      if hash $bin &>/dev/null\r
++      then\r
++              test_set_prereq $prereq\r
++      else\r
++              say_color info "%-6s" "INFO"\r
++              echo " Missing test prerequisite: $name"\r
++      fi\r
++}\r
++\r
+ # You are not expected to call test_ok_ and test_failure_ directly, use\r
+ # the text_expect_* functions instead.\r
\r
+-- \r
+1.7.7.3\r
+\r