From 3ca7e96e384d5872c71ceb3b2e2a05b0c1b7e1a0 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 12 Aug 2013 14:32:21 +0200 Subject: [PATCH] Make test suite workable with GnuPG 2.1. * tests/gpg/start-stop-agent: New. * tests/gpg/initial.test: New. * tests/gpg/final.test: New. * tests/gpg/Makefile.am (c_tests): New. (TESTS): Move all to c_tests. Add initial.test, final.test, and c_tests. (TESTS_ENVIRONMENT): Add C_ALL=C (private_keys): New. (EXTRA_DIST): Add new files. (./private-keys-v1.d/gpg-sample.stamp): Copy private keys. (all-local): Depend on gpg-sample.stamp. * tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F: New. * tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD: New. * tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66: New. * tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C: New. * tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD: New. -- GnuPG 2.1 requires that the agent knows the private keys. Thus we need to install them. The code should still work with GnuPG < 2.1. To make the whole testing using a agent more robust, the way to start the agent has also be changed. --- .../13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F | Bin 0 -> 682 bytes .../13CD0F3BDF24BE53FE192D62F18737256FF6E4FD | Bin 0 -> 828 bytes .../76F7E2B35832976B50A27A282D9B87E44577EB66 | Bin 0 -> 493 bytes .../7A030357C0F253A5BBCD282FFC4E521B37558F5C | Bin 0 -> 636 bytes .../A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD | Bin 0 -> 636 bytes tests/gpg/Makefile.am | 47 +++++++++++++----- tests/gpg/final.test | 4 ++ tests/gpg/initial.test | 4 ++ tests/gpg/start-stop-agent | 45 +++++++++++++++++ 9 files changed, 87 insertions(+), 13 deletions(-) create mode 100644 tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F create mode 100644 tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD create mode 100644 tests/gpg/76F7E2B35832976B50A27A282D9B87E44577EB66 create mode 100644 tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C create mode 100644 tests/gpg/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD create mode 100755 tests/gpg/final.test create mode 100755 tests/gpg/initial.test create mode 100755 tests/gpg/start-stop-agent diff --git a/tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F b/tests/gpg/13CBE3758AFE42B5E5E2AE4CED27AFA455E3F87F new file mode 100644 index 0000000000000000000000000000000000000000..4ec6d13506ffb9e559e1e5534518bc85bca904fb GIT binary patch literal 682 zcmdNeGPEiv$}dSxE=f(%Ehx$?ODsv%%}%YILU$)q8eebrxn_px2ci(~p$G&4IblN8D} z_&L3*^oiO;H<`RYYrW5QU*f6P1iGXU=vIbZJZBYl)ZZ<0O7(9H_$C*#e|Z2SNHQJl z%!cb}5?}X(9&gf5ouzS#&nTn7AtNife(MsW7jH^k1%An0KVaJzEGV1)UUF~CnIk`5 ze^prJ{>R_?rbN`W)m!&(@5^33dB@e(3%8$n%2z)9b$x;FED`Z)WNMXPkeXMJUZ7iSlx?hAoRMg#o0wXxo1B!a zp+2<%=2m7Vrbb3aCYpw3R%dm#?D#+B+NHVowq^TQKiAQ;FtC!Z z>NWT0Z*V@<%r5D!f1+4^gOkZ$i}OEUYE1W-a+lFkRqK6zR&duwe=h%%?(3ffe_5ZK zn6NYQ`Fe4|wvVALeDjJQt(b3^vE=!pr#52o6Gef6W`uC8Zeod{sg;p|p|OF5p;3sT MfvKUfiKeC|0DW63AOHXW literal 0 HcmV?d00001 diff --git a/tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD b/tests/gpg/13CD0F3BDF24BE53FE192D62F18737256FF6E4FD new file mode 100644 index 0000000000000000000000000000000000000000..16138cf75bc08cf59fb919226d0d1fc41156b727 GIT binary patch literal 828 zcmV-C1H=3%GBG-Ea&L5HV{~O?EpT#ac42g7Eo)_YC^I@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D282FFC4E521B37558F5C b/tests/gpg/7A030357C0F253A5BBCD282FFC4E521B37558F5C new file mode 100644 index 0000000000000000000000000000000000000000..ad505abf3bc5f9aa6d1be248a911766ff13093f6 GIT binary patch literal 636 zcmdNeGPEiv$}dSxE=f(%Ehx$?ODsv%%}%Ymm< zS!RDcug%a{T)e`(Ry#`KmN<`>es@9Hf**@qt(6+Tym0j|CIZ7Ygz54O1+VPGgCuQ-I8QtpUwpV9N?B}sKICc5| zHp}|AYWePuIhO_l>i88))-Dy9U6SnUcW9qW z`@#+BvE9{TQZoak^1`=IS~;=*S@Cag(Pf+_ry3f+PAFIzDI--a)Y{XelEgDrY_-er z>nzR-zD+EC_*3$hriLXV;EYVI@(WV)3epR7i;c34b&E3+4RsS!i*=Kek~K6;tU!FA zldrG7k^IG#(cH?+#MH>h$VAi7%xd>V&c@8>K&B;H$IHB@^~q@(S{hk(Z~iCwYHLFu zi<_6@6Gi_`*C*{&l#X&d%>T)aHz{+9jMpNyeIf6PlN7HlD*1nkOHJBx-e-rPo|w8{ z6V`z9&oQz*x?Ht$wXS5iM&<8Eg=zK@ zrE#ghZhx@fQ*0=*<zP!R(Fn8}9I}u*S9o8n1VJfQw*QMXT-tm^}zR&xuGoR*f_Sqx;`Mucb z%AUGCYd$@f)VhAYTX=fNkD{(p5lO9G9~!ioPoMU5d1vvKTS?bahr_DhaH08)2NPN1 z(zQ13+^13f_hd`!-=-a$|86UrYXV)8ZfM00qALxJEUYA-J~P_5=s7dbv_uKwt&4@%G~0;NUr&na+*^ANwOe&GCzD z6i5o|Sy$r7-Ei|p+uSoA-cy=4KM~FRXZ~>AevQz80?ny!*4z81?D<#SrvB^1l%St+ z-Pd05U;38D(kHu;UsJ;p5pYJPR`~^~c?IbOy2VD>#=6BBiH5p~sl~dYHZ;h0tBJh%dh62# zj$f`CuT$RcvUbkO9X=;N9Ot~g>K)g<$I`|8`4;{gmz>ZHd2}Zu?j&o#B!@>i0Ya<> z{Y&N5^d7qK+zNW}#(Lour875P7G3YoUV8td=+r|?J7+g{zxNXa#g-8wbaWF-3{9 ./private-keys-v1.d/gpg-sample.stamp ./pubring.gpg: $(srcdir)/pubdemo.asc -$(GPG) --no-permission-warning \ diff --git a/tests/gpg/final.test b/tests/gpg/final.test new file mode 100755 index 00000000..5148a34b --- /dev/null +++ b/tests/gpg/final.test @@ -0,0 +1,4 @@ +#!/bin/sh + +${srcdir}/start-stop-agent --stop +exit 0 diff --git a/tests/gpg/initial.test b/tests/gpg/initial.test new file mode 100755 index 00000000..1981c99d --- /dev/null +++ b/tests/gpg/initial.test @@ -0,0 +1,4 @@ +#!/bin/sh + +${srcdir}/start-stop-agent --start +exit 0 diff --git a/tests/gpg/start-stop-agent b/tests/gpg/start-stop-agent new file mode 100755 index 00000000..ab47d8d9 --- /dev/null +++ b/tests/gpg/start-stop-agent @@ -0,0 +1,45 @@ +#!/bin/sh +# Copyright (C) 2013 g10 Code GmbH +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. This file is +# distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY, to the extent permitted by law; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +if [ -z "$(command -v gpg-connect-agent)" ]; then + echo "gpg-agent not installed and thus not started" >&2 + exit 0; +fi + +GPG_AGENT_INFO= +export GPG_AGENT_INFO + +token=$(echo "gpgme-$(pwd)" | tr ' ' '_') + +if [ "$1" = "--stop" ]; then + if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ + != "D set" ]; then + echo "gpg-agent not running" >&2 + exit 0 + fi + echo "stopping gpg-agent " >&2 + gpg-connect-agent KILLAGENT /bye >/dev/null 2>&1 + exit 0 +fi + +if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ + = "D set" ]; then + echo "gpg-agent already running" >&2 + exit 0 +fi + +echo "starting gpg-agent " >&2 +gpg-connect-agent putval\ $token\ set /bye >/dev/null 2>&1 +if [ "$(gpg-connect-agent getval\ $token /bye 2>/dev/null | head -1)" \ + != "D set" ]; then + echo "error starting gpg-agent" >&2 + exit 1 +fi +exit 0