allow tests to be split for more granularity

Unit tests are the main bulk of runtime, so splitting them into 2 or 3
parts should help.

For now, the number of parts is still 1, because on my 4 core laptop,
2 was a little bit slower, and 3 slower yet. However, this probably does
vary based on the number of cores, so needs to be revisited, and perhaps
made dynamic.

Since each test mode gets split into the specified number of parts,
plus property and remote tests, 2 gives 8 parts, and 3 gives 11 parts.
Load went to maybe 18, so there was probably contention slowing things
down.

So probably it needs to start N workers with some parts, and when a
worker finishes, run it with the next part, until all parts are
processed.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-03-14 17:23:52 -04:00
parent 8d14ce8f38
commit 57c01b2a63
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 18 additions and 9 deletions

View file

@ -679,11 +679,12 @@ make_writeable d = void $
- leave open are closed before finalCleanup is run at the end. This
- prevents some failures to clean up after the test suite.
-}
parallelTestRunner :: TestOptions -> (Bool -> Bool -> TestOptions -> [TestTree]) -> IO ()
parallelTestRunner :: TestOptions -> (Int -> Bool -> Bool -> TestOptions -> [TestTree]) -> IO ()
parallelTestRunner opts mkts
| fakeSsh opts = runFakeSsh (internalData opts)
| otherwise = go =<< Utility.Env.getEnv subenv
where
numparts = 1
subenv = "GIT_ANNEX_TEST_SUBPROCESS"
go Nothing = do
ensuredir tmpdir
@ -691,7 +692,7 @@ parallelTestRunner opts mkts
(toRawFilePath tmpdir)
Nothing Nothing False
adjustedbranchok <- Annex.AdjustedBranch.isGitVersionSupported
let ts = mkts crippledfilesystem adjustedbranchok opts
let ts = mkts numparts crippledfilesystem adjustedbranchok opts
let warnings = fst (tastyParser ts)
unless (null warnings) $ do
hPutStrLn stderr "warnings from tasty:"
@ -722,7 +723,7 @@ parallelTestRunner opts mkts
go (Just subenvval) = case readish subenvval of
Nothing -> error ("Bad " ++ subenv)
Just (n, crippledfilesystem, adjustedbranchok) -> isolateGitConfig $ do
let ts = mkts crippledfilesystem adjustedbranchok opts
let ts = mkts numparts crippledfilesystem adjustedbranchok opts
let t = topLevelTestGroup
-- This group is needed to avoid what
-- seems to be a tasty bug which causes a