]> dgit.raspbian.org Git - git-annex.git/commitdiff
git-annex test from standalone speedup
authorJoey Hess <joeyh@joeyh.name>
Tue, 1 Mar 2022 20:08:55 +0000 (16:08 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 1 Mar 2022 20:08:55 +0000 (16:08 -0400)
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
CHANGELOG
Test/Framework.hs
doc/todo/speed_up___34__standalone_build__34___and__47__or_tests/comment_2_f462ee4719b4c459c12e36ce29ab82b5._comment [new file with mode: 0644]

index 799ed1baa63b31bb750f6ec46bea395b23dc4bba..18d2e4f62f5ed0882446d0dc9d8e940aeb7e7f8b 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -15,6 +15,8 @@ git-annex (10.20220223) UNRELEASED; urgency=medium
   * Propagate nonzero exit status from git ls-files when a specified
     file does not exist, or a specified directory does not contain
     any files checked into git.
+  * Avoid git-annex test being very slow when run from within the
+    standalone linux tarball or OSX app.
 
  -- Joey Hess <id@joeyh.name>  Wed, 23 Feb 2022 14:14:09 -0400
 
index 6a2eae28f18e596a57ee4954d7ba5672e2237620..7f85ae06aed97faf982a0e5d2ceb0a5571f53b3f 100644 (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
diff --git a/doc/todo/speed_up___34__standalone_build__34___and__47__or_tests/comment_2_f462ee4719b4c459c12e36ce29ab82b5._comment b/doc/todo/speed_up___34__standalone_build__34___and__47__or_tests/comment_2_f462ee4719b4c459c12e36ce29ab82b5._comment
new file mode 100644 (file)
index 0000000..03a1db4
--- /dev/null
@@ -0,0 +1,13 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 2"""
+ date="2022-03-01T19:58:37Z"
+ content="""
+I have fixed the problem I identified, which was due to git-annex test adding
+the cwd to PATH, which caused it to run git-annex.linux/git, so runshell
+was being run repeatedly and unncessarily.
+
+Now it will run git-annex.linux/bin/git and avoid the repeated runshell
+overhead, so will be about as fast as git-annex not run from the standalone
+tarball.
+"""]]