tests: create gpg homedir on the fly
authorChristian Hesse <mail@eworm.de>
Fri, 12 Dec 2014 08:50:12 +0000 (09:50 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 Dec 2014 18:23:36 +0000 (10:23 -0800)
GnuPG 2.1 homedir looks different, so just create it on the fly by
importing needed private and public keys and ownertrust.

This solves an issue with gnupg 2.1 running interactive pinentry
when old secret key is present.

Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/lib-gpg.sh
t/lib-gpg/ownertrust [new file with mode: 0644]
t/lib-gpg/random_seed [deleted file]
t/lib-gpg/trustdb.gpg [deleted file]
index cd2baef383df7dbea5b1544a162f99573476520e..4e57942b35ce74f88711dc0e16160e385da7e808 100755 (executable)
@@ -16,11 +16,15 @@ else
                # Type DSA and Elgamal, size 2048 bits, no expiration date.
                # Name and email: C O Mitter <committer@example.com>
                # No password given, to enable non-interactive operation.
-               cp -R "$TEST_DIRECTORY"/lib-gpg ./gpghome
-               chmod 0700 gpghome
-               chmod 0600 gpghome/*
+               mkdir ./gpghome
+               chmod 0700 ./gpghome
                GNUPGHOME="$(pwd)/gpghome"
                export GNUPGHOME
+               gpg --homedir "${GNUPGHOME}" --import \
+                       "$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
+                       "$TEST_DIRECTORY"/lib-gpg/secring.gpg
+               gpg --homedir "${GNUPGHOME}" --import-ownertrust \
+                       "$TEST_DIRECTORY"/lib-gpg/ownertrust
                test_set_prereq GPG
                ;;
        esac
diff --git a/t/lib-gpg/ownertrust b/t/lib-gpg/ownertrust
new file mode 100644 (file)
index 0000000..b3e3c4f
--- /dev/null
@@ -0,0 +1,4 @@
+# List of assigned trustvalues, created Thu 11 Dec 2014 01:26:28 PM CET
+# (Use "gpg --import-ownertrust" to restore them)
+73D758744BE721698EC54E8713B6F51ECDDE430D:6:
+D4BE22311AD3131E5EDA29A461092E85B7227189:3:
diff --git a/t/lib-gpg/random_seed b/t/lib-gpg/random_seed
deleted file mode 100644 (file)
index 95d249f..0000000
Binary files a/t/lib-gpg/random_seed and /dev/null differ
diff --git a/t/lib-gpg/trustdb.gpg b/t/lib-gpg/trustdb.gpg
deleted file mode 100644 (file)
index 4879ae9..0000000
Binary files a/t/lib-gpg/trustdb.gpg and /dev/null differ