test: Deal with gpg-agent behavior change that broke the test suite.

gpg-agent started deleting its socket file on shutdown, and this tickled an
ugly behavior in removeDirectoryRecursive,
https://github.com/haskell/directory/issues/60

Running removeDirectoryRecursive again on exception avoids the problem.
This commit is contained in:
Joey Hess 2016-10-18 16:56:38 -04:00
parent 206dab8b44
commit 6e4fee1faf
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
2 changed files with 9 additions and 1 deletions

View file

@ -9,6 +9,7 @@ git-annex (6.20161013) UNRELEASED; urgency=medium
Thanks, James MacMahon. Thanks, James MacMahon.
* Assistant, repair: Improved filtering out of git fsck lines about * Assistant, repair: Improved filtering out of git fsck lines about
duplicate file entries in tree objects. duplicate file entries in tree objects.
* test: Deal with gpg-agent behavior change that broke the test suite.
-- Joey Hess <id@joeyh.name> Mon, 17 Oct 2016 12:46:54 -0400 -- Joey Hess <id@joeyh.name> Mon, 17 Oct 2016 12:46:54 -0400

View file

@ -352,7 +352,14 @@ testHarness cmd a = do
[testSecretKey, testKey] [testSecretKey, testKey]
return dir return dir
cleanup orig tmpdir = removeDirectoryRecursive tmpdir >> reset orig cleanup orig tmpdir = do
removeDirectoryRecursive tmpdir
-- gpg-agent may be shutting down at the same time
-- and may delete its socket at the same time as
-- we're trying to, causing an exception. Retrying
-- will deal with this race.
`catchIO` (\_ -> removeDirectoryRecursive tmpdir)
reset orig
reset (Just v) = setEnv var v True reset (Just v) = setEnv var v True
reset _ = unsetEnv var reset _ = unsetEnv var