[PATCH 1/4] test: add 'GnuPG' prereq to dependent 'crypto' tests
authorPieter Praet <pieter@praet.org>
Thu, 2 Jun 2011 12:03:37 +0000 (14:03 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:29 +0000 (09:38 -0800)
e4/622652cf94d5807ef48769b69f4b5a344652bd [new file with mode: 0644]

diff --git a/e4/622652cf94d5807ef48769b69f4b5a344652bd b/e4/622652cf94d5807ef48769b69f4b5a344652bd
new file mode 100644 (file)
index 0000000..248a9a7
--- /dev/null
@@ -0,0 +1,208 @@
+Return-Path: <pieter@praet.org>\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 B9AAE429E28\r
+       for <notmuch@notmuchmail.org>; Thu,  2 Jun 2011 05:04:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 2U6ltwdbsbpD for <notmuch@notmuchmail.org>;\r
+       Thu,  2 Jun 2011 05:04:18 -0700 (PDT)\r
+Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id C6A53429E27\r
+       for <notmuch@notmuchmail.org>; Thu,  2 Jun 2011 05:04:17 -0700 (PDT)\r
+Received: by wyi11 with SMTP id 11so603864wyi.26\r
+       for <notmuch@notmuchmail.org>; Thu, 02 Jun 2011 05:04:16 -0700 (PDT)\r
+Received: by 10.227.43.9 with SMTP id u9mr650476wbe.74.1307016256189;\r
+       Thu, 02 Jun 2011 05:04:16 -0700 (PDT)\r
+Received: from localhost ([109.131.21.86])\r
+       by mx.google.com with ESMTPS id ge4sm347758wbb.64.2011.06.02.05.04.13\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 02 Jun 2011 05:04:14 -0700 (PDT)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH 1/4] test: add 'GnuPG' prereq to dependent 'crypto' tests\r
+Date: Thu,  2 Jun 2011 14:03:37 +0200\r
+Message-Id: <1307016220-17509-2-git-send-email-pieter@praet.org>\r
+X-Mailer: git-send-email 1.7.4.1\r
+In-Reply-To: <1307016220-17509-1-git-send-email-pieter@praet.org>\r
+References: <1307016220-17509-1-git-send-email-pieter@praet.org>\r
+Cc: Austin Clements <amdragon@mit.edu>\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: Thu, 02 Jun 2011 12:04:18 -0000\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 |   33 +++++++++++++++++++--------------\r
+ 1 files changed, 19 insertions(+), 14 deletions(-)\r
+\r
+diff --git a/test/crypto b/test/crypto\r
+index 8e92016..59f7989 100755\r
+--- a/test/crypto\r
++++ b/test/crypto\r
+@@ -7,6 +7,11 @@\r
+ test_description='PGP/MIME signature verification and decryption'\r
+ . ./test-lib.sh\r
\r
++# GnuPG is a prereq.\r
++test_expect_success "prereq: GnuPG is present" "which gpg" \\r
++    && test_set_prereq GPG\r
++\r
++\r
+ add_gnupg_home ()\r
+ {\r
+     local output\r
+@@ -31,7 +36,7 @@ FINGERPRINT=$(gpg --no-tty --list-secret-keys --with-colons --fingerprint | grep\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
+@@ -176,7 +181,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
+@@ -211,7 +216,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
+@@ -222,7 +227,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
+@@ -232,7 +237,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
+@@ -259,12 +264,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
+@@ -299,7 +304,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
+@@ -313,7 +318,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
+@@ -354,7 +359,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.4.1\r
+\r