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
master
Emilio López 4 weeks ago committed by Emilio López
parent 740e950e76
commit 162b986d7d
  1. 7
      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 (WorkerEvent _ _ (TestFalsified test)) -> ("\n Call sequence:\n" <>) . unlines <$> mapM (ppTx vm $ length (nub $ (.src) <$> test.reproducer) /= 1) test.reproducer
_ -> pure "" _ -> 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 :: (MonadIO m, MonadReader Env m) => VM Concrete RealWorld -> [WorkerState] -> m String
ppCampaign vm workerStates = do ppCampaign vm workerStates = do
tests <- liftIO . traverse readIORef =<< asks (.testRefs) tests <- liftIO . traverse readIORef =<< asks (.testRefs)
@ -51,12 +56,14 @@ ppCampaign vm workerStates = do
coveragePrinted <- ppCoverage coveragePrinted <- ppCoverage
let seedPrinted = "Seed: " <> show (head workerStates).genDict.defSeed let seedPrinted = "Seed: " <> show (head workerStates).genDict.defSeed
corpusPrinted <- ppCorpus corpusPrinted <- ppCorpus
let callsPrinted = ppTotalCalls workerStates
pure $ unlines pure $ unlines
[ testsPrinted [ testsPrinted
, gasInfoPrinted , gasInfoPrinted
, coveragePrinted , coveragePrinted
, corpusPrinted , corpusPrinted
, seedPrinted , seedPrinted
, callsPrinted
] ]
-- | Given rules for pretty-printing associated addresses, and whether to print -- | Given rules for pretty-printing associated addresses, and whether to print

Loading…
Cancel
Save