git-annex test from standalone speedup

Avoid git-annex test being very slow when run from within the standalone
linux tarball or OSX app.

It may not really be necessary to add to PATH the directory where the
git-annex binary resides, but it can't hurt. Most places where the test
suite or git-annex run git-annex, they use programPath, so won't need
a modified PATH. But I'm not sure if that's always the case.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-03-01 16:08:55 -04:00
parent ecf7c29107
commit 2fc46e1871
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 19 additions and 2 deletions

View file

@ -468,10 +468,12 @@ setTestMode :: TestMode -> IO ()
setTestMode testmode = do
currdir <- getCurrentDirectory
p <- Utility.Env.getEnvDefault "PATH" ""
pp <- Annex.Path.programPath
mapM_ (\(var, val) -> Utility.Env.Set.setEnv var val True)
-- Ensure that the just-built git annex is used.
[ ("PATH", currdir ++ [searchPathSeparator] ++ p)
-- Ensure that the same git-annex binary that is running
-- git-annex test is at the front of the PATH.
[ ("PATH", takeDirectory pp ++ [searchPathSeparator] ++ p)
, ("TOPDIR", currdir)
-- Avoid git complaining if it cannot determine the user's
-- email address, or exploding if it doesn't know the user's