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