test: Added --jobs option

Default to the number of CPU cores, which seems about optimal
on my laptop. Using one more saves me 2 seconds actually.

Better packing of workers improves speed significantly.

In 2 tests runs, I saw segfaulting workers despite my attempt
to work around that issue. So detect when a worker does, and re-run it.

Removed installSignalHandlers again, because I was seeing an
error "lost signal due to full pipe", which I guess was somehow caused
by using it.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-03-16 14:42:07 -04:00
parent be31a8a3d2
commit 025c18128b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 77 additions and 24 deletions

View file

@ -1,6 +1,6 @@
{- git-annex test data types.
-
- Copyright 2011-2017 Joey Hess <id@joeyh.name>
- Copyright 2011-2022 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -8,27 +8,16 @@
module Types.Test where
import Test.Tasty.Options
import Data.Monoid
import qualified Data.Semigroup as Sem
import Prelude
import Types.Concurrency
import Types.Command
data TestOptions = TestOptions
{ tastyOptionSet :: OptionSet
, keepFailuresOption :: Bool
, fakeSsh :: Bool
, concurrentJobs :: Maybe Concurrency
, internalData :: CmdParams
}
instance Sem.Semigroup TestOptions where
a <> b = TestOptions
(tastyOptionSet a <> tastyOptionSet b)
(keepFailuresOption a || keepFailuresOption b)
(fakeSsh a || fakeSsh b)
(internalData a <> internalData b)
instance Monoid TestOptions where
mempty = TestOptions mempty False False mempty
type TestRunner = TestOptions -> IO ()