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

View file

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