relocate gpg test framework temp dir to outside repo

The gitAnnexTmpOtherDir cleanup made it be deleted too early sometimes,
and so the test suite failed. Also there was a report of a similar
failure which likely had a similar cause and hopwfully this fixes that
too.
This commit is contained in:
Joey Hess 2019-01-21 14:00:21 -04:00
parent f76c4a0973
commit f5f059e288
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 9 additions and 9 deletions

14
Test.hs
View file

@ -60,7 +60,6 @@ import qualified Annex.WorkTree
import qualified Annex.Init
import qualified Annex.CatFile
import qualified Annex.Path
import qualified Annex.Perms
import qualified Annex.VectorClock
import qualified Annex.View
import qualified Annex.View.ViewedFile
@ -1619,13 +1618,14 @@ test_crypto = do
testscheme "pubkey"
where
gpgcmd = Utility.Gpg.mkGpgCmd Nothing
testscheme scheme = intmpclonerepo $ whenM (Utility.Path.inPath (Utility.Gpg.unGpgCmd gpgcmd)) $ do
gpgtmpdir <- annexeval $ (</> "gpgtest")
<$> Annex.fromRepo Annex.Locations.gitAnnexTmpOtherDir
annexeval $ Annex.Perms.createAnnexDirectory gpgtmpdir
Utility.Gpg.testTestHarness gpgtmpdir gpgcmd
testscheme scheme = do
gpgtmp <- (</> "gpgtest") <$> absPath tmpdir
createDirectoryIfMissing False gpgtmp
testscheme' scheme gpgtmp
testscheme' scheme gpgtmp = intmpclonerepo $ whenM (Utility.Path.inPath (Utility.Gpg.unGpgCmd gpgcmd)) $ do
Utility.Gpg.testTestHarness gpgtmp gpgcmd
@? "test harness self-test failed"
Utility.Gpg.testHarness gpgtmpdir gpgcmd $ do
Utility.Gpg.testHarness gpgtmp gpgcmd $ do
createDirectory "dir"
let a cmd = git_annex cmd $
[ "foo"

View file

@ -347,8 +347,8 @@ keyBlock public ls = unlines
#ifndef mingw32_HOST_OS
{- Runs an action using gpg in a test harness, in which gpg does
- not use ~/.gpg/, but sets up the test key in the passed directory
- and uses it. -}
- not use ~/.gpg/, but sets up the test key in a subdirectory of
- the passed directory and uses it. -}
testHarness :: FilePath -> GpgCmd -> IO a -> IO a
testHarness tmpdir cmd a = bracket setup cleanup (const a)
where