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

feat: add real-time counter for fuzz/invariant runs #585

Closed
mds1 opened this issue Jan 26, 2022 · 8 comments · Fixed by #7914
Closed

feat: add real-time counter for fuzz/invariant runs #585

mds1 opened this issue Jan 26, 2022 · 8 comments · Fixed by #7914
Labels
C-forge Command: forge Cmd-forge-test Command: forge test D-average Difficulty: average T-feature Type: feature T-perf Type: performance

Comments

@mds1
Copy link
Collaborator

mds1 commented Jan 26, 2022

dapptools has a counter like the one in the screenshot below so you can track progress in fuzz runs while those fuzz runs are executing. I recently ran a 10k fuzz run test that uses ffi, so it was quite slow and appears as if tests hang. A counter that updates live like the one below would be helpful for monitoring fuzz/invariant run progress and having confidence tests are still running as expected

image

@onbjerg onbjerg added Cmd-forge-test Command: forge test C-forge Command: forge D-easy Difficulty: easy good first issue Good for newcomers T-feature Type: feature labels Jan 26, 2022
@pbshgthm
Copy link
Contributor

I could see the run count, along with mean and median too - implemented in this line.

https://github.com/gakonst/foundry/blob/9de25d1928da362cd3b185ebaccc0e3d00aee2c8/forge/src/runner.rs#L101

Am I missing something here, or this feature is already implemented?

Screenshot 2022-01-26 at 1 54 42 PM

@onbjerg
Copy link
Member

onbjerg commented Jan 26, 2022

Oh, you are right.

Perhaps the request is probably moreso the real-time update of the counter (if supported by your terminal) than the count itself? Generally we should work on streaming in test results where possible which is (sort of) tracked in #141, so I'll close this as a duplicate.

Do let me know if something was misunderstood here!

@onbjerg onbjerg closed this as completed Jan 26, 2022
@mds1
Copy link
Collaborator Author

mds1 commented Jan 26, 2022

Ah yea it does show the number of fuzz runs after a run already. The main motivation for opening this issue was to show a counter during the fuzz runs. I recently ran 10k fuzz runs with ffi, so it was quite slow, and it looks like your tests are hanging since there's nothing printed to the terminal during execution.

A real-time fuzz run counter seems to be a simpler scope than #141, and I don't see this functionality mentioned in there (though I only skimmed all the comments), so I feel like they could be tracked separately. But either way is fine with me 🙂

@onbjerg
Copy link
Member

onbjerg commented Jan 26, 2022

I agree it would be valuable to have some sort of real-time counter. Let's track it here then 😅 Can you update the original issue to reflect it?

@onbjerg onbjerg reopened this Jan 26, 2022
@onbjerg onbjerg added D-average Difficulty: average and removed good first issue Good for newcomers D-easy Difficulty: easy labels Jan 26, 2022
@mds1 mds1 changed the title feat: add counter for fuzz runs feat: add real-time counter for fuzz runs Jan 26, 2022
@mds1
Copy link
Collaborator Author

mds1 commented Jan 26, 2022

done!

@mds1 mds1 changed the title feat: add real-time counter for fuzz runs feat: add real-time counter for fuzz/invariant runs Oct 26, 2022
@lucas-manuel
Copy link

I would love to see this for invariants

@PaulRBerg
Copy link
Contributor

PaulRBerg commented Jan 23, 2023

This would also be useful for long-winded end-to-end fork tests that also fuzz inputs, since they can take a long time to run.

@brockelmore
Copy link
Member

We should add coverage % for invariant runs. Basically, record locations of JUMPDESTs in a contract, and when we hit it record that and print out something like:

Runs: 6097
Coverage: 54% (27/54 Blocks)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-test Command: forge test D-average Difficulty: average T-feature Type: feature T-perf Type: performance
Projects
No open projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

6 participants