Patchwork [1,of,3] test-gpg: make temporary copy of GNUPGHOME

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 14, 2016, 9:29 a.m.
Message ID <4faac945fa5a66924ffb.1471166965@mimosa>
Download mbox | patch
Permalink /patch/16273/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 14, 2016, 9:29 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1471160987 -32400
#      Sun Aug 14 16:49:47 2016 +0900
# Node ID 4faac945fa5a66924ffb8e35f8c0a812ec2ec535
# Parent  0bb8f8c1910a03c917c27ef06707e8c39ba50bfe
test-gpg: make temporary copy of GNUPGHOME

GnuPG v2 will convert v1 secret keys and create a socket under $GNUPGHOME.
This patch makes sure no state would persist.

We no longer need to verify trustdb.gpg, which was added by aae219a99a6e.

Patch

diff --git a/tests/test-gpg.t b/tests/test-gpg.t
--- a/tests/test-gpg.t
+++ b/tests/test-gpg.t
@@ -7,8 +7,11 @@  Test the GPG extension
   > gpg=
   > 
   > [gpg]
-  > cmd=gpg --no-permission-warning --no-secmem-warning --no-auto-check-trustdb --homedir "$TESTDIR/gpg"
+  > cmd=gpg --no-permission-warning --no-secmem-warning --no-auto-check-trustdb
   > EOF
+  $ GNUPGHOME="$TESTTMP/gpg"; export GNUPGHOME
+  $ cp -R "$TESTDIR/gpg" "$GNUPGHOME"
+
   $ hg init r
   $ cd r
   $ echo foo > foo
@@ -36,12 +39,4 @@  Test the GPG extension
   e63c23eaa88a is signed by:
    hgtest
 
-verify that this test has not modified the trustdb.gpg file back in
-the main hg working dir
-  $ md5sum.py "$TESTDIR/gpg/trustdb.gpg"
-  f6b9c78c65fa9536e7512bb2ceb338ae  */gpg/trustdb.gpg (glob)
-
-don't leak any state to next test run
-  $ rm -f "$TESTDIR/gpg/random_seed"
-
   $ cd ..