summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2017-05-25 16:07:45 -0400
committerNiko Tyni <ntyni@debian.org>2018-06-29 10:20:20 +0200
commitddc919c9c1fa7181662bfcb60ee3edf8d715b589 (patch)
treefaf8c5eff693f756d460248d7f8f25ce88cb532d
parentf1a0d94040443490400b08b37307212f775bfc68 (diff)
Kill any GnuPG agent before and after the test suite.
This helps to ensure that the test suite daemon is started fresh at every test suite run. And it also avoids leaving a daemon running after the test suite, assuming the test suite manages to reach the end. This is considered a reasonable practice by upstream. Gbp-Pq: Name 0017-Kill-any-GnuPG-agent-before-and-after-the-test-suite.patch
-rw-r--r--t/000_setup.t3
-rw-r--r--t/zzz_cleanup.t2
2 files changed, 5 insertions, 0 deletions
diff --git a/t/000_setup.t b/t/000_setup.t
index b183241..4dc4329 100644
--- a/t/000_setup.t
+++ b/t/000_setup.t
@@ -17,6 +17,9 @@ TEST
$agentconf->write("pinentry-program " . getcwd() . "/test/fake-pinentry.pl\n");
$agentconf->close();
copy('test/gpg.conf', 'test/gnupghome/gpg.conf');
+ # reset the state of any long-lived gpg-agent, ignoring errors:
+ system('gpgconf', '--homedir=test/gnupghome', '--quiet', '--kill', 'gpg-agent');
+
reset_handles();
my $pid = $gnupg->import_keys(command_args => [ 'test/public_keys.pgp', 'test/secret_keys.pgp', 'test/new_secret.pgp' ],
diff --git a/t/zzz_cleanup.t b/t/zzz_cleanup.t
index 5c03a72..eea3a48 100644
--- a/t/zzz_cleanup.t
+++ b/t/zzz_cleanup.t
@@ -12,6 +12,8 @@ use File::Path qw (remove_tree);
TEST
{
my $err = [];
+ # kill off any long-lived gpg-agent, ignoring errors:
+ system('gpgconf', '--homedir=test/gnupghome', '--quiet', '--kill', 'gpg-agent');
remove_tree('test/gnupghome', {error => \$err});
return ! @$err;
};