From: Joey Hess Date: Wed, 7 Dec 2022 17:46:16 +0000 (-0400) Subject: speed up --pattern X-Git-Tag: archive/raspbian/10.20250416-2+rpi1~1^2~60^2~139 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ac77aa40e70216b90b538fb523dde37a0c1a2970;p=git-annex.git speed up --pattern The splitting of the tests into parts for parallelism made --pattern do extra work, because init tests have to be run for each part, but many of the parts are empty. For example, git-annex test --pattern '/move (ssh remote)/' took 12 seconds to run before. This improves the runtime to 4 seconds. Sponsored-by: Dartmouth College's Datalad project --- diff --git a/Test/Framework.hs b/Test/Framework.hs index d74ae7f3e1..9023eb0c83 100644 --- a/Test/Framework.hs +++ b/Test/Framework.hs @@ -749,7 +749,12 @@ parallelTestRunner' numjobs opts mkts -- Make more parts than there are jobs, because some parts -- are larger, and this allows the smaller parts to be packed -- in more efficiently, speeding up the test suite overall. - numparts = numjobs * 2 + -- + -- When there is a pattern, splitting into parts will cause + -- extra work. + numparts = if haspattern + then 1 + else numjobs * 2 worker rs nvar a = do (n, m) <- atomically $ do @@ -814,15 +819,16 @@ parallelTestRunner' numjobs opts mkts , exitFailure ) - tastyopts = case lookupOption (tastyOptionSet opts) of + (haspattern, tastyopts) = case lookupOption (tastyOptionSet opts) of -- Work around limitation of tasty; when tests to run -- are limited to a pattern, it does not include their -- dependencies. So, add another pattern including the -- init tests, which are a dependency of most tests. TestPattern (Just p) -> - setOption (TestPattern (Just (TP.Or p (TP.ERE initTestsName)))) - (tastyOptionSet opts) - TestPattern Nothing -> tastyOptionSet opts + (True, setOption (TestPattern (Just (TP.Or p (TP.ERE initTestsName)))) + (tastyOptionSet opts)) + TestPattern Nothing -> + (False, tastyOptionSet opts) topLevelTestGroup :: [TestTree] -> TestTree topLevelTestGroup = testGroup "Tests" diff --git a/doc/bugs/git_annex_test_never_exits__63__/comment_6_d12ddfb48706454eba1bd552a681e5ba._comment b/doc/bugs/git_annex_test_never_exits__63__/comment_6_d12ddfb48706454eba1bd552a681e5ba._comment index fffca75e74..030f6816ee 100644 --- a/doc/bugs/git_annex_test_never_exits__63__/comment_6_d12ddfb48706454eba1bd552a681e5ba._comment +++ b/doc/bugs/git_annex_test_never_exits__63__/comment_6_d12ddfb48706454eba1bd552a681e5ba._comment @@ -14,4 +14,6 @@ This will limit the test suite to only running the that test: I have that repeating locally in a loop, in case it's just something that happens every 1000 test runs or something like that. + +(I've patched git-annex to speed up the above command 400%.) """]]