--- /dev/null
+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 8931E429E21\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Oct 2011 09:48:47 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\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 Pu5jDpka+i0V for <notmuch@notmuchmail.org>;\r
+ Mon, 3 Oct 2011 09:48:46 -0700 (PDT)\r
+Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
+ by olra.theworths.org (Postfix) with ESMTP id 0C0FA431FB6\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Oct 2011 09:48:45 -0700 (PDT)\r
+Received: from localhost.localdomain (thor.loria.fr [152.81.12.250])\r
+ by ks3536.kimsufi.com (Postfix) with ESMTPSA id 771716A06B0;\r
+ Mon, 3 Oct 2011 18:48:43 +0200 (CEST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
+ s=key-schnouki; t=1317660523;\r
+ bh=s6e7GW9RyH90CeutVGvgMB9KsaOj0xmeOa59RJ4cj4Q=;\r
+ h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\r
+ In-Reply-To:References;\r
+ b=fILKdjt8ybqr2oAnXwVbmhceN4yoTGL5xhj5ZJvWtDtzeQ36CWDrewb2WhgS9KCeA\r
+ 6Kr6DPH0ro0QaHq4O4vA4mz4nr3ZkLxTzJxlySSFu33P2op6zniNjkBQJj1SPBISlj\r
+ kUtIrMDq/VyLea/6fZa7lwqk4ICFA9yp6EG83DiA=\r
+From: Thomas Jost <schnouki@schnouki.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 02/13] test: add 'GnuPG' prereq to dependent 'crypto' tests\r
+Date: Mon, 3 Oct 2011 18:47:16 +0200\r
+Message-Id: <1317660447-27520-3-git-send-email-schnouki@schnouki.net>\r
+X-Mailer: git-send-email 1.7.6.4\r
+In-Reply-To: <1317660447-27520-1-git-send-email-schnouki@schnouki.net>\r
+References: <1317660447-27520-1-git-send-email-schnouki@schnouki.net>\r
+In-Reply-To: <871uuuywtt.fsf@convex-new.cs.unb.ca>\r
+References: <871uuuywtt.fsf@convex-new.cs.unb.ca>\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: Mon, 03 Oct 2011 16:48:47 -0000\r
+\r
+From: Pieter Praet <pieter@praet.org>\r
+\r
+Adds a new test that checks for the presence of 'gpg',\r
+and adds that test as a prereq to all subsequent tests\r
+that rely on GnuPG.\r
+\r
+This causes tests with unmet dependencies to be skipped.\r
+\r
+Signed-off-by: Pieter Praet <pieter@praet.org>\r
+---\r
+ test/crypto | 35 ++++++++++++++++++++---------------\r
+ 1 files changed, 20 insertions(+), 15 deletions(-)\r
+\r
+diff --git a/test/crypto b/test/crypto\r
+index b49a4e0..4ee318f 100755\r
+--- a/test/crypto\r
++++ b/test/crypto\r
+@@ -7,11 +7,16 @@\r
+ test_description='PGP/MIME signature verification and decryption'\r
+ . ./test-lib.sh\r
+ \r
++# GnuPG is a prereq.\r
++test_set_bin_prereq gpg "GnuPG" GPG\r
++\r
++\r
+ add_gnupg_home ()\r
+ {\r
+ local output\r
+ [ -d ${GNUPGHOME} ] && return\r
+ mkdir -m 0700 "$GNUPGHOME"\r
++ test_have_prereq GPG || return\r
+ gpg --no-tty --import <$TEST_DIRECTORY/gnupg-secret-key.asc >"$GNUPGHOME"/import.log 2>&1\r
+ test_debug "cat $GNUPGHOME/import.log"\r
+ if (gpg --quick-random --version >/dev/null 2>&1) ; then\r
+@@ -25,13 +30,13 @@ add_gnupg_home ()\r
+ \r
+ add_gnupg_home\r
+ # get key fingerprint\r
+-FINGERPRINT=$(gpg --no-tty --list-secret-keys --with-colons --fingerprint | grep '^fpr:' | cut -d: -f10)\r
++test_have_prereq GPG && FINGERPRINT=$(gpg --no-tty --list-secret-keys --with-colons --fingerprint | grep '^fpr:' | cut -d: -f10)\r
+ \r
+ # for some reason this is needed for emacs_deliver_message to work,\r
+ # although I can't figure out why\r
+ add_email_corpus\r
+ \r
+-test_expect_success 'emacs delivery of signed message' \\r
++test_expect_success GPG 'emacs delivery of signed message' \\r
+ 'emacs_deliver_message \\r
+ "test signed message 001" \\r
+ "This is a test signed message." \\r
+@@ -64,7 +69,7 @@ expected='[[[{"id": "XXXXX",\r
+ {"id": 3,\r
+ "content-type": "application/pgp-signature"}]}]},\r
+ []]]]'\r
+-test_expect_equal \\r
++test_expect_equal GPG \\r
+ "$output" \\r
+ "$expected"\r
+ \r
+@@ -99,7 +104,7 @@ expected='[[[{"id": "XXXXX",\r
+ {"id": 3,\r
+ "content-type": "application/pgp-signature"}]}]},\r
+ []]]]'\r
+-test_expect_equal \\r
++test_expect_equal GPG \\r
+ "$output" \\r
+ "$expected"\r
+ \r
+@@ -132,7 +137,7 @@ expected='[[[{"id": "XXXXX",\r
+ {"id": 3,\r
+ "content-type": "application/pgp-signature"}]}]},\r
+ []]]]'\r
+-test_expect_equal \\r
++test_expect_equal GPG \\r
+ "$output" \\r
+ "$expected"\r
+ mv "${GNUPGHOME}"{.bak,}\r
+@@ -141,7 +146,7 @@ mv "${GNUPGHOME}"{.bak,}\r
+ cat <<EOF >TESTATTACHMENT\r
+ This is a test file.\r
+ EOF\r
+-test_expect_success 'emacs delivery of encrypted message with attachment' \\r
++test_expect_success GPG 'emacs delivery of encrypted message with attachment' \\r
+ 'emacs_deliver_message \\r
+ "test encrypted message 001" \\r
+ "This is a test encrypted message.\n" \\r
+@@ -175,7 +180,7 @@ Non-text part: application/octet-stream\r
+ \f\r
+part}\r
+ \f\r
+body}\r
+ \f\r
+message}'\r
+-test_expect_equal \\r
++test_expect_equal GPG \\r
+ "$output" \\r
+ "$expected"\r
+ \r
+@@ -210,7 +215,7 @@ expected='[[[{"id": "XXXXX",\r
+ "content-type": "application/octet-stream",\r
+ "filename": "TESTATTACHMENT"}]}]}]},\r
+ []]]]'\r
+-test_expect_equal \\r
++test_expect_equal GPG \\r
+ "$output" \\r
+ "$expected"\r
+ \r
+@@ -221,7 +226,7 @@ output=$(notmuch show --format=json --part=4 --decrypt subject:"test encrypted m\r
+ expected='{"id": 4,\r
+ "content-type": "text/plain",\r
+ "content": "This is a test encrypted message.\n"}'\r
+-test_expect_equal \\r
++test_expect_equal GPG \\r
+ "$output" \\r
+ "$expected"\r
+ \r
+@@ -231,7 +236,7 @@ notmuch show \\r
+ --part=5 \\r
+ --decrypt \\r
+ subject:"test encrypted message 001" >OUTPUT\r
+-test_expect_equal_file OUTPUT TESTATTACHMENT\r
++test_expect_equal_file GPG OUTPUT TESTATTACHMENT\r
+ \r
+ test_begin_subtest "decryption failure with missing key"\r
+ mv "${GNUPGHOME}"{,.bak}\r
+@@ -258,12 +263,12 @@ expected='[[[{"id": "XXXXX",\r
+ {"id": 3,\r
+ "content-type": "application/octet-stream"}]}]},\r
+ []]]]'\r
+-test_expect_equal \\r
++test_expect_equal GPG \\r
+ "$output" \\r
+ "$expected"\r
+ mv "${GNUPGHOME}"{.bak,}\r
+ \r
+-test_expect_success 'emacs delivery of encrypted + signed message' \\r
++test_expect_success GPG 'emacs delivery of encrypted + signed message' \\r
+ 'emacs_deliver_message \\r
+ "test encrypted message 002" \\r
+ "This is another test encrypted message.\n" \\r
+@@ -298,7 +303,7 @@ expected='[[[{"id": "XXXXX",\r
+ "content-type": "text/plain",\r
+ "content": "This is another test encrypted message.\n"}]}]},\r
+ []]]]'\r
+-test_expect_equal \\r
++test_expect_equal GPG \\r
+ "$output" \\r
+ "$expected"\r
+ \r
+@@ -312,7 +317,7 @@ On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> w\r
+ Non-text part: multipart/encrypted\r
+ Non-text part: application/pgp-encrypted\r
+ > This is another test encrypted message.'\r
+-test_expect_equal \\r
++test_expect_equal GPG \\r
+ "$output" \\r
+ "$expected"\r
+ \r
+@@ -353,7 +358,7 @@ expected='[[[{"id": "XXXXX",\r
+ {"id": 3,\r
+ "content-type": "application/pgp-signature"}]}]},\r
+ []]]]'\r
+-test_expect_equal \\r
++test_expect_equal GPG \\r
+ "$output" \\r
+ "$expected"\r
+ \r
+-- \r
+1.7.6.4\r
+\r