Skip to content

Commit

Permalink
Fixed performance regression when using --no-progress
Browse files Browse the repository at this point in the history
  • Loading branch information
coot committed May 3, 2023
1 parent 208edc3 commit 035bf29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions core/Test/Tasty/Ingredients/ConsoleReporter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ buildTestOutput opts tree =
hFlush stdout

printTestProgress progress
| getHideProgress (lookupOption opts ) ||
progress == emptyProgress = pure ()
| progress == emptyProgress = pure ()

| otherwise = do
let
Expand Down
7 changes: 5 additions & 2 deletions core/Test/Tasty/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ executeTest
-- a parameter
-> TVar Status -- ^ variable to write status to
-> Timeout -- ^ optional timeout to apply
-> HideProgress -- ^ hide progress option
-> Seq Initializer -- ^ initializers (to be executed in this order)
-> Seq Finalizer -- ^ finalizers (to be executed in this order)
-> IO ()
executeTest action statusVar timeoutOpt inits fins = mask $ \restore -> do
executeTest action statusVar timeoutOpt hideProgressOpt inits fins = mask $ \restore -> do
resultOrExn <- try . restore $ do
-- N.B. this can (re-)throw an exception. It's okay. By design, the
-- actual test will not be run, then. We still run all the
Expand Down Expand Up @@ -220,6 +221,8 @@ executeTest action statusVar timeoutOpt inits fins = mask $ \restore -> do

tell $ First mbExcn

yieldProgress _newP | getHideProgress hideProgressOpt =
pure ()
yieldProgress newP | newP == emptyProgress =
-- This could be changed to `Maybe Progress` to lets more easily indicate
-- when progress should try to be printed ?
Expand Down Expand Up @@ -357,7 +360,7 @@ createTestActions opts0 tree = do
(parentPath, testDeps) <- ask
let
testPath = parentPath |> name
testAction = executeTest (run opts test) testStatus (lookupOption opts)
testAction = executeTest (run opts test) testStatus (lookupOption opts) (lookupOption opts)
pure $ TAction (TestAction {..})

foldResource :: OptionSet -> ResourceSpec a -> (IO a -> Tr) -> Tr
Expand Down

0 comments on commit 035bf29

Please sign in to comment.