From 162b986d7df3be78ff51f63821b8c2c44972f715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= Date: Wed, 6 Nov 2024 13:34:49 +0100 Subject: [PATCH] Print total calls as part of the stats on exit Echidna will now print the number of calls done as part of the stats printed when exiting. Unique instructions: 287 Unique codehashes: 1 Corpus size: 1 Seed: 830942768189866820 Total calls: 10 Closes #1322 --- lib/Echidna/UI/Report.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Echidna/UI/Report.hs b/lib/Echidna/UI/Report.hs index a7aca634..a917645c 100644 --- a/lib/Echidna/UI/Report.hs +++ b/lib/Echidna/UI/Report.hs @@ -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) @@ -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