unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Thomas Jost <schnouki@schnouki.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 4/6] test: add 'Emacs' prereq to dependent 'crypto' tests
Date: Wed, 16 Nov 2011 15:33:53 +0100	[thread overview]
Message-ID: <1321454035-22023-5-git-send-email-schnouki@schnouki.net> (raw)
In-Reply-To: <1321454035-22023-1-git-send-email-schnouki@schnouki.net>

From: Pieter Praet <pieter@praet.org>

Adds a new test that checks for the presence of 'emacs',
and adds that test as a prereq to all subsequent tests
that rely on Emacs.

This causes tests with unmet dependencies to be skipped.

Right now, all crypto tests do depend on Emacs, because it
is used to generate the signed/encrypted messages that are
needed by the tests.

Signed-off-by: Pieter Praet <pieter@praet.org>
---
 test/crypto |   39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/test/crypto b/test/crypto
index eca59b6..085070b 100755
--- a/test/crypto
+++ b/test/crypto
@@ -7,9 +7,20 @@
 test_description='PGP/MIME signature verification and decryption'
 . ./test-lib.sh
 
+# Emacs is a prereq.
+test_set_bin_prereq dtach "dtach" DTACH
+test_have_prereq DTACH && test_set_bin_prereq emacs "Emacs" EMACS
+
 # GnuPG is a prereq.
 test_set_bin_prereq gpg "GnuPG" GPG
 
+# Some tests have multiple prereqs, but the test_expect_* functions
+# accept only a single argument as prereq tag, and using test_have_prereq
+# in and around tests causes various errors for me, so a dirty workaround
+# will have to do for the time being.
+test_have_prereq EMACS && test_have_prereq GPG \
+    && test_set_prereq EMACS+GPG
+
 
 add_gnupg_home ()
 {
@@ -36,7 +47,7 @@ test_have_prereq GPG && FINGERPRINT=$(gpg --no-tty --list-secret-keys --with-col
 # although I can't figure out why
 add_email_corpus
 
-test_expect_success GPG 'emacs delivery of signed message' \
+test_expect_success EMACS+GPG 'emacs delivery of signed message' \
 'emacs_deliver_message \
     "test signed message 001" \
     "This is a test signed message." \
@@ -69,7 +80,7 @@ expected='[[[{"id": "XXXXX",
  {"id": 3,
  "content-type": "application/pgp-signature"}]}]},
  []]]]'
-test_expect_equal GPG \
+test_expect_equal EMACS+GPG \
     "$output" \
     "$expected"
 
@@ -104,7 +115,7 @@ expected='[[[{"id": "XXXXX",
  {"id": 3,
  "content-type": "application/pgp-signature"}]}]},
  []]]]'
-test_expect_equal GPG \
+test_expect_equal EMACS+GPG \
     "$output" \
     "$expected"
 
@@ -137,7 +148,7 @@ expected='[[[{"id": "XXXXX",
  {"id": 3,
  "content-type": "application/pgp-signature"}]}]},
  []]]]'
-test_expect_equal GPG \
+test_expect_equal EMACS+GPG \
     "$output" \
     "$expected"
 mv "${GNUPGHOME}"{.bak,}
@@ -146,7 +157,7 @@ mv "${GNUPGHOME}"{.bak,}
 cat <<EOF >TESTATTACHMENT
 This is a test file.
 EOF
-test_expect_success GPG 'emacs delivery of encrypted message with attachment' \
+test_expect_success EMACS+GPG 'emacs delivery of encrypted message with attachment' \
 'emacs_deliver_message \
     "test encrypted message 001" \
     "This is a test encrypted message.\n" \
@@ -180,7 +191,7 @@ Non-text part: application/octet-stream
 \fpart}
 \fbody}
 \fmessage}'
-test_expect_equal GPG \
+test_expect_equal EMACS+GPG \
     "$output" \
     "$expected"
 
@@ -215,7 +226,7 @@ expected='[[[{"id": "XXXXX",
  "content-type": "application/octet-stream",
  "filename": "TESTATTACHMENT"}]}]}]},
  []]]]'
-test_expect_equal GPG \
+test_expect_equal EMACS+GPG \
     "$output" \
     "$expected"
 
@@ -226,7 +237,7 @@ output=$(notmuch show --format=json --part=4 --decrypt subject:"test encrypted m
 expected='{"id": 4,
  "content-type": "text/plain",
  "content": "This is a test encrypted message.\n"}'
-test_expect_equal GPG \
+test_expect_equal EMACS+GPG \
     "$output" \
     "$expected"
 
@@ -236,7 +247,7 @@ notmuch show \
     --part=5 \
     --decrypt \
     subject:"test encrypted message 001" >OUTPUT
-test_expect_equal_file GPG OUTPUT TESTATTACHMENT
+test_expect_equal_file EMACS+GPG OUTPUT TESTATTACHMENT
 
 test_begin_subtest "decryption failure with missing key"
 mv "${GNUPGHOME}"{,.bak}
@@ -263,12 +274,12 @@ expected='[[[{"id": "XXXXX",
  {"id": 3,
  "content-type": "application/octet-stream"}]}]},
  []]]]'
-test_expect_equal GPG \
+test_expect_equal EMACS+GPG \
     "$output" \
     "$expected"
 mv "${GNUPGHOME}"{.bak,}
 
-test_expect_success GPG 'emacs delivery of encrypted + signed message' \
+test_expect_success EMACS+GPG 'emacs delivery of encrypted + signed message' \
 'emacs_deliver_message \
     "test encrypted message 002" \
     "This is another test encrypted message.\n" \
@@ -303,7 +314,7 @@ expected='[[[{"id": "XXXXX",
  "content-type": "text/plain",
  "content": "This is another test encrypted message.\n"}]}]},
  []]]]'
-test_expect_equal GPG \
+test_expect_equal EMACS+GPG \
     "$output" \
     "$expected"
 
@@ -315,7 +326,7 @@ Subject: Re: test encrypted message 002
 
 On 01 Jan 2000 12:00:00 -0000, Notmuch Test Suite <test_suite@notmuchmail.org> wrote:
 > This is another test encrypted message.'
-test_expect_equal GPG \
+test_expect_equal EMACS+GPG \
     "$output" \
     "$expected"
 
@@ -356,7 +367,7 @@ expected='[[[{"id": "XXXXX",
  {"id": 3,
  "content-type": "application/pgp-signature"}]}]},
  []]]]'
-test_expect_equal GPG \
+test_expect_equal EMACS+GPG \
     "$output" \
     "$expected"
 
-- 
1.7.7.3

  parent reply	other threads:[~2011-11-16 14:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-01 19:49 set test prereqs (Emacs, GDB, GPG) v4 Pieter Praet
2011-11-01 19:49 ` [PATCH 1/4] test: add 'GnuPG' prereq to dependent 'crypto' tests Pieter Praet
2011-11-01 21:17   ` Jameson Graef Rollins
2011-11-02 17:20     ` Pieter Praet
2011-11-01 19:49 ` [PATCH 2/4] test: add 'Emacs' " Pieter Praet
2011-11-01 19:49 ` [PATCH 3/4] test: add 'Emacs' prereq to dependent 'emacs' tests Pieter Praet
2011-11-01 19:49 ` [PATCH 4/4] test: add 'Emacs' prereq to dependent 'emacs-large-search-buffer' tests Pieter Praet
2011-11-01 20:20 ` set test prereqs (Emacs, GDB, GPG) v4 Ali Polatel
2011-11-02 17:21   ` Pieter Praet
2011-11-16 14:33 ` [PATCH 0/6] Rebase of Pieter's "set test prereqs" Thomas Jost
2011-11-16 14:33   ` [PATCH 1/6] test: define a helper function for defining prereqs on executables Thomas Jost
2011-11-16 14:33   ` [PATCH 2/6] test: check if emacs and dtach are available in test_emacs() Thomas Jost
2011-11-16 14:33   ` [PATCH 3/6] test: add 'GnuPG' prereq to dependent 'crypto' tests Thomas Jost
2011-11-16 14:33   ` Thomas Jost [this message]
2011-11-16 14:33   ` [PATCH 5/6] test: add 'Emacs' prereq to dependent 'emacs' tests Thomas Jost
2011-11-16 14:33   ` [PATCH 6/6] test: add 'Emacs' prereq to dependent 'emacs-large-search-buffer' tests Thomas Jost
2011-11-16 18:53   ` [PATCH 0/6] Rebase of Pieter's "set test prereqs" Jameson Graef Rollins
2011-11-16 20:17     ` Thomas Jost
2011-11-16 20:50   ` Pieter Praet
2011-11-17 10:14     ` Thomas Jost
2012-01-12 17:07       ` Pieter Praet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321454035-22023-5-git-send-email-schnouki@schnouki.net \
    --to=schnouki@schnouki.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).