Avoid a test suite failure when the environment does not let gpg be tested

Due to eg, too long a path to the agent socket, caused by running gpg in a
container where /run is not mounted, and/or some other gpg behavior like
unnecessarily making relative paths to its home directory absolute.
This commit is contained in:
Joey Hess 2020-04-28 15:47:23 -04:00
parent 24eabbbc55
commit 4a6d328ae9
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 42 additions and 13 deletions

View file

@ -1576,14 +1576,12 @@ test_crypto = do
testscheme scheme = do
abstmp <- absPath tmpdir
testscheme' scheme abstmp
testscheme' scheme abstmp = intmpclonerepo $ whenM (Utility.Path.inPath (Utility.Gpg.unGpgCmd gpgcmd)) $ do
-- Use a relative path to avoid too long path to gpg's
-- agent socket.
testscheme' scheme abstmp = intmpclonerepo $ do
gpgtmp <- (</> "gpgtmp") <$> relPathCwdToFile abstmp
createDirectoryIfMissing False gpgtmp
Utility.Gpg.testTestHarness gpgtmp gpgcmd
Utility.Gpg.testTestHarness gpgtmp gpgcmd
@? "test harness self-test failed"
Utility.Gpg.testHarness gpgtmp gpgcmd $ do
void $ Utility.Gpg.testHarness gpgtmp gpgcmd $ do
createDirectory "dir"
let a cmd = git_annex cmd $
[ "foo"