t: lib-gpg: flush gpg agent on startup
When running gpg-relevant tests, a gpg-daemon is spawned for each GNUPGHOME used. This daemon may stay running after the test and cache file descriptors for the trash directories, even after the trash directory is removed. This leads to ENOENT errors when attempting to create files if tests are run multiple times. Add a cleanup script to force flushing the gpg-agent for that GNUPGHOME (if any) before setting up the GPG relevant-environment. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Santiago Torres <santiago@nyu.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Santiago Torres committed
Jul 20, 2017 at 17:05 UTC
29ff1f8f7493ecd5b90521adff6ed523d61ec73f
1 file changed
+1
t/lib-gpg.sh
+1
@@ -31,6 +31,7 @@ then
31
chmod 0700 ./gpghome &&
32
GNUPGHOME="$(pwd)/gpghome" &&
33
export GNUPGHOME &&
34
+ (gpgconf --kill gpg-agent 2>&1 >/dev/null || : ) &&
35
gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
36
"$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
37
gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \