add test summary with number of parts and time
authorJoey Hess <joeyh@joeyh.name>
Thu, 18 May 2023 15:19:59 +0000 (11:19 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 18 May 2023 15:20:27 +0000 (11:20 -0400)
Sponsored-by: Brock Spratlen on Patreon
Test.hs
Test/Framework.hs

diff --git a/Test.hs b/Test.hs
index 5352351a8bd78d89427bbac8d9a3df1113120ee3..f55d9b8dc34f7f85ecae856da2227cfd47f5b767 100644 (file)
--- a/Test.hs
+++ b/Test.hs
@@ -128,7 +128,7 @@ runner :: TestOptions -> IO ()
 runner opts = parallelTestRunner opts tests
 
 tests :: Int -> Bool -> Bool -> TestOptions -> [TestTree]
-tests n crippledfilesystem adjustedbranchok opts = 
+tests numparts crippledfilesystem adjustedbranchok opts = 
        properties 
                : withTestMode remotetestmode testRemotes
                : concatMap mkrepotests testmodes
@@ -147,7 +147,7 @@ tests n crippledfilesystem adjustedbranchok opts =
                | otherwise = Nothing
        mkrepotests (d, te) = map 
                (\uts -> withTestMode te uts)
-               (repoTests d n)
+               (repoTests d numparts)
 
 properties :: TestTree
 properties = localOption (QuickCheckTests 1000) $ testGroup "QuickCheck" $
index 7c2316c238e1f604c8aa42282d1c6551d48c7509..7d073e746852116e4b16907c3070c0a936abae4f 100644 (file)
@@ -23,6 +23,7 @@ import Control.Concurrent.STM
 import System.Environment (getArgs)
 import System.Console.Concurrent
 import System.Console.ANSI
+import Data.Time.Clock
 import GHC.Conc
 import System.IO.Unsafe (unsafePerformIO)
 import System.PosixCompat.Files (isSymbolicLink, isRegularFile, fileMode, unionFileModes, ownerWriteMode)
@@ -63,6 +64,7 @@ import qualified Utility.Exception
 import qualified Utility.ThreadScheduler
 import qualified Utility.Tmp.Dir
 import qualified Utility.Metered
+import qualified Utility.HumanTime
 import qualified Command.Uninit
 
 -- Run a process. The output and stderr is captured, and is only
@@ -799,11 +801,20 @@ parallelTestRunner' numjobs opts mkts
                        (_, _, _, pid) <- createProcessConcurrent p
                        waitForProcess pid
                nvar <- newTVarIO (1, length ts)
+               starttime <- getCurrentTime
                exitcodes <- forConcurrently [1..numjobs] $ \_ -> 
                        worker [] nvar runone
                unless (keepFailuresOption opts) finalCleanup
+               duration <- Utility.HumanTime.durationSince starttime
                case nub (filter (/= ExitSuccess) (concat exitcodes)) of
-                       [] -> exitSuccess
+                       [] -> do
+                               putStrLn ""
+                               putStrLn $ "All tests succeeded. (Ran "
+                                       ++ show (length ts) 
+                                       ++ " test groups in " 
+                                       ++ Utility.HumanTime.fromDuration duration
+                                       ++ ")"
+                               exitSuccess
                        [ExitFailure 1] -> do
                                putStrLn "  (Failures above could be due to a bug in git-annex, or an incompatibility"
                                putStrLn "   with utilities, such as git, installed on this system.)"