[PATCH 6/8] CLI: refactor dumping of tags.
[notmuch-archives.git] / 12 / 198bade5f0a3fc7b2d26e1e6377dd03446cafe
1 Return-Path: <dkg@fifthhorseman.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5  by arlo.cworth.org (Postfix) with ESMTP id D23F66DE1AEF\r
6  for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 12:40:11 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12  autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id QK8PpjGe__wz for <notmuch@notmuchmail.org>;\r
16  Sun, 31 Jan 2016 12:40:09 -0800 (PST)\r
17 Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108])\r
18  by arlo.cworth.org (Postfix) with ESMTP id E7FAD6DE1781\r
19  for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 12:40:08 -0800 (PST)\r
20 Received: from fifthhorseman.net (ip-64-134-185-108.public.wayport.net\r
21  [64.134.185.108])\r
22  by che.mayfirst.org (Postfix) with ESMTPSA id 39D34F999\r
23  for <notmuch@notmuchmail.org>; Sun, 31 Jan 2016 15:40:06 -0500 (EST)\r
24 Received: by fifthhorseman.net (Postfix, from userid 1000)\r
25  id 40ED220C6C; Sun, 31 Jan 2016 15:40:06 -0500 (EST)\r
26 From: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
27 To: Notmuch Mail <notmuch@notmuchmail.org>\r
28 Subject: [PATCH v3 06/16] Prefer gpg2 in the test suite if available\r
29 Date: Sun, 31 Jan 2016 15:39:51 -0500\r
30 Message-Id: <1454272801-23623-7-git-send-email-dkg@fifthhorseman.net>\r
31 X-Mailer: git-send-email 2.7.0.rc3\r
32 In-Reply-To: <1454272801-23623-1-git-send-email-dkg@fifthhorseman.net>\r
33 References: <1454272801-23623-1-git-send-email-dkg@fifthhorseman.net>\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.20\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38  <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
40  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
45  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Sun, 31 Jan 2016 20:40:12 -0000\r
47 \r
48 Now that the notmuch client prefers gpg2 if available, having the test\r
49 suite use the same preference makes it more likely to validate as\r
50 expected.\r
51 \r
52 Be warned that the final test in T350-crypto.sh fails with an infinite\r
53 loop in gpg if you're using an unpatched GnuPG 2.1.10, due to an\r
54 upstream GnuPG bug: https://bugs.gnupg.org/gnupg/issue2187.  In\r
55 debian, this is resolved in 2.1.10-3\r
56 ---\r
57  test/README         |  2 +-\r
58  test/T030-config.sh |  2 +-\r
59  test/T040-setup.sh  |  2 +-\r
60  test/T350-crypto.sh | 16 ++++++++--------\r
61  test/test-lib.sh    | 10 +++++++++-\r
62  5 files changed, 20 insertions(+), 12 deletions(-)\r
63 \r
64 diff --git a/test/README b/test/README\r
65 index e54e36b..9a7e539 100644\r
66 --- a/test/README\r
67 +++ b/test/README\r
68 @@ -16,7 +16,7 @@ that you know if you break anything.\r
69    - emacs(1)\r
70    - emacsclient(1)\r
71    - gdb(1)\r
72 -  - gpg(1)\r
73 +  - gpg(1) or gpg2(1)\r
74    - python(1)\r
75  \r
76  Running Tests\r
77 diff --git a/test/T030-config.sh b/test/T030-config.sh\r
78 index f404908..daa7b44 100755\r
79 --- a/test/T030-config.sh\r
80 +++ b/test/T030-config.sh\r
81 @@ -54,7 +54,7 @@ new.tags=unread;inbox;\r
82  new.ignore=\r
83  search.exclude_tags=\r
84  maildir.synchronize_flags=true\r
85 -crypto.gpg_path=gpg\r
86 +crypto.gpg_path=$GPG\r
87  foo.string=this is another string value\r
88  foo.list=this;is another;list value;"\r
89  \r
90 diff --git a/test/T040-setup.sh b/test/T040-setup.sh\r
91 index cf0c00b..9313aec 100755\r
92 --- a/test/T040-setup.sh\r
93 +++ b/test/T040-setup.sh\r
94 @@ -29,6 +29,6 @@ new.tags=foo;bar;\r
95  new.ignore=\r
96  search.exclude_tags=baz;\r
97  maildir.synchronize_flags=true\r
98 -crypto.gpg_path=gpg"\r
99 +crypto.gpg_path=$GPG"\r
100  \r
101  test_done\r
102 diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh\r
103 index 3656cce..4bc15bc 100755\r
104 --- a/test/T350-crypto.sh\r
105 +++ b/test/T350-crypto.sh\r
106 @@ -12,11 +12,11 @@ add_gnupg_home ()\r
107      local output\r
108      [ -d ${GNUPGHOME} ] && return\r
109      mkdir -m 0700 "$GNUPGHOME"\r
110 -    gpg --no-tty --import <$TEST_DIRECTORY/gnupg-secret-key.asc >"$GNUPGHOME"/import.log 2>&1\r
111 +    $GPG --no-tty --import <$TEST_DIRECTORY/gnupg-secret-key.asc >"$GNUPGHOME"/import.log 2>&1\r
112      test_debug "cat $GNUPGHOME/import.log"\r
113 -    if (gpg --quick-random --version >/dev/null 2>&1) ; then\r
114 +    if ($GPG --quick-random --version >/dev/null 2>&1) ; then\r
115         echo quick-random >> "$GNUPGHOME"/gpg.conf\r
116 -    elif (gpg --debug-quick-random --version >/dev/null 2>&1) ; then\r
117 +    elif ($GPG --debug-quick-random --version >/dev/null 2>&1) ; then\r
118         echo debug-quick-random >> "$GNUPGHOME"/gpg.conf\r
119      fi\r
120      echo no-emit-version >> "$GNUPGHOME"/gpg.conf\r
121 @@ -26,7 +26,7 @@ add_gnupg_home ()\r
122  \r
123  add_gnupg_home\r
124  # get key fingerprint\r
125 -FINGERPRINT=$(gpg --no-tty --list-secret-keys --with-colons --fingerprint | grep '^fpr:' | cut -d: -f10)\r
126 +FINGERPRINT=$($GPG --no-tty --list-secret-keys --with-colons --fingerprint | grep '^fpr:' | cut -d: -f10)\r
127  \r
128  test_expect_success 'emacs delivery of signed message' \\r
129  'emacs_fcc_message \\r
130 @@ -67,8 +67,8 @@ test_expect_equal_json \\r
131  \r
132  test_begin_subtest "signature verification with full owner trust"\r
133  # give the key full owner trust\r
134 -echo "${FINGERPRINT}:6:" | gpg --no-tty --import-ownertrust >>"$GNUPGHOME"/trust.log 2>&1\r
135 -gpg --no-tty --check-trustdb >>"$GNUPGHOME"/trust.log 2>&1\r
136 +echo "${FINGERPRINT}:6:" | $GPG --no-tty --import-ownertrust >>"$GNUPGHOME"/trust.log 2>&1\r
137 +$GPG --no-tty --check-trustdb >>"$GNUPGHOME"/trust.log 2>&1\r
138  output=$(notmuch show --format=json --verify subject:"test signed message 001" \\r
139      | notmuch_json_show_sanitize \\r
140      | sed -e 's|"created": [1234567890]*|"created": 946728000|')\r
141 @@ -325,8 +325,8 @@ Notmuch Test Suite key revocation (automated) $(date '+%F_%T%z')\r
142  y\r
143  \r
144  " \\r
145 -    | gpg --no-tty --quiet --command-fd 0 --armor --gen-revoke "0x${FINGERPRINT}!" 2>/dev/null \\r
146 -    | gpg --no-tty --quiet --import\r
147 +    | $GPG --no-tty --quiet --command-fd 0 --armor --gen-revoke "0x${FINGERPRINT}!" 2>/dev/null \\r
148 +    | $GPG --no-tty --quiet --import\r
149  output=$(notmuch show --format=json --verify subject:"test signed message 001" \\r
150      | notmuch_json_show_sanitize \\r
151      | sed -e 's|"created": [1234567890]*|"created": 946728000|')\r
152 diff --git a/test/test-lib.sh b/test/test-lib.sh\r
153 index cc08a98..8c1f3c6 100644\r
154 --- a/test/test-lib.sh\r
155 +++ b/test/test-lib.sh\r
156 @@ -85,6 +85,13 @@ unset GREP_OPTIONS\r
157  # For emacsclient\r
158  unset ALTERNATE_EDITOR\r
159  \r
160 +# choose the preferred GnuPG binary:\r
161 +if command -v gpg2 > /dev/null; then\r
162 +    GPG=gpg2\r
163 +else\r
164 +    GPG=gpg\r
165 +fi\r
166 +\r
167  # Convenience\r
168  #\r
169  # A regexp to match 5 and 40 hexdigits\r
170 @@ -1144,6 +1151,7 @@ test_emacs () {\r
171                                 $load_emacs_tests \\r
172                                 --eval '(setq server-name \"$server_name\")' \\r
173                                 --eval '(server-start)' \\r
174 +                               --eval '(setq epg-gpg-program \"$GPG\")' \\r
175                                 --eval '(orphan-watchdog $$)'" || return\r
176                 EMACS_SERVER="$server_name"\r
177                 # wait until the emacs server is up\r
178 @@ -1332,7 +1340,7 @@ test_declare_external_prereq dtach\r
179  test_declare_external_prereq emacs\r
180  test_declare_external_prereq ${TEST_EMACSCLIENT}\r
181  test_declare_external_prereq gdb\r
182 -test_declare_external_prereq gpg\r
183 +test_declare_external_prereq gpg2 || test_declare_external_prereq gpg\r
184  test_declare_external_prereq openssl\r
185  test_declare_external_prereq gpgsm\r
186  test_declare_external_prereq ${NOTMUCH_PYTHON}\r
187 -- \r
188 2.7.0.rc3\r
189 \r