Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print total calls as part of the stats on exit #1328

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/Echidna/UI/Report.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ ppCampaignEventLog vm ev = (ppCampaignEvent ev <>) <$> ppTxIfHas where
(WorkerEvent _ _ (TestFalsified test)) -> ("\n Call sequence:\n" <>) . unlines <$> mapM (ppTx vm $ length (nub $ (.src) <$> test.reproducer) /= 1) test.reproducer
_ -> pure ""

ppTotalCalls :: [WorkerState] -> String
ppTotalCalls workerStates = "Total calls: " <> show calls
where
calls = sum $ (.ncalls) <$> workerStates

ppCampaign :: (MonadIO m, MonadReader Env m) => VM Concrete RealWorld -> [WorkerState] -> m String
ppCampaign vm workerStates = do
tests <- liftIO . traverse readIORef =<< asks (.testRefs)
Expand All @@ -51,12 +56,14 @@ ppCampaign vm workerStates = do
coveragePrinted <- ppCoverage
let seedPrinted = "Seed: " <> show (head workerStates).genDict.defSeed
corpusPrinted <- ppCorpus
let callsPrinted = ppTotalCalls workerStates
pure $ unlines
[ testsPrinted
, gasInfoPrinted
, coveragePrinted
, corpusPrinted
, seedPrinted
, callsPrinted
]

-- | Given rules for pretty-printing associated addresses, and whether to print
Expand Down