Skip to content

Commit 2be9dbf

Browse files
committed
Log per-worker shrinking status
1 parent 5c8b253 commit 2be9dbf

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

lib/Echidna/UI.hs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ import Control.Monad.Reader
1313
import Control.Monad.State.Strict hiding (state)
1414
import Control.Monad.ST (RealWorld)
1515
import Data.ByteString.Lazy qualified as BS
16+
import Data.List (intercalate)
1617
import Data.List.Split (chunksOf)
1718
import Data.Map (Map)
18-
import Data.Maybe (isJust, listToMaybe, mapMaybe)
19+
import Data.Maybe (isJust, mapMaybe)
1920
import Data.Sequence ((|>))
2021
import Data.Text (Text)
2122
import Data.Time
@@ -409,21 +410,16 @@ statusLine env states lastUpdateRef = do
409410
writeIORef lastUpdateRef $ GasTracker now totalGas
410411

411412
let shrinkLimit = env.cfg.campaignConf.shrinkLimit
412-
let shrinkCounters = mapMaybe getShrinkCounter tests
413-
where getShrinkCounter test = case test.state of
414-
Large k -> Just k
415-
_ -> Nothing
413+
let shrinkingWorkers = mapMaybe getShrinkingWorker tests
414+
where getShrinkingWorker test = case (test.state, test.workerId) of
415+
(Large step, Just wid) -> Just (wid, step, length test.reproducer)
416+
_ -> Nothing
416417
let shrinkingPart
417-
| null shrinkCounters = ", shrinking: N/A"
418-
| otherwise = ", shrinking: " <> show (maximum shrinkCounters)
419-
<> "/" <> show shrinkLimit
420-
<> formatCurrentLength
418+
| null shrinkingWorkers = ", shrinking: N/A"
419+
| otherwise = ", shrinking: " <> intercalate " " (map formatWorker shrinkingWorkers)
421420
where
422-
formatCurrentLength =
423-
let lengths = [length test.reproducer | test <- tests,
424-
case test.state of Large _ -> True; _ -> False,
425-
not (null test.reproducer)]
426-
in maybe "" (\p -> " (" <> show p <> ")") (listToMaybe lengths)
421+
formatWorker (wid, step, seqLength) =
422+
"W" <> show wid <> ":" <> show step <> "/" <> show shrinkLimit <> "(" <> show seqLength <> ")"
427423

428424
pure $ "tests: " <> show (length $ filter didFail tests) <> "/" <> show (length tests)
429425
<> ", fuzzing: " <> show totalCalls <> "/" <> show env.cfg.campaignConf.testLimit

0 commit comments

Comments
 (0)