-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Console logs should ideally print _during_ fuzzing, not just after testing is complete #3844
Comments
I realize a workaround for this is to write my logs to a .log file using |
@webthethird wdyt of closing this as a duplicate of #585? It sounds like you just want confirmation things are still running and that the fuzzer isn't hanging. Or do you actually want to see the values being used during the fuzzing? If so I'd be curious to hear more about why |
@mds1 I'd actually like to see the values being used during fuzzing, since I'd like to make sure my tests don't have any bugs that would cause fuzzing to either succeed when they should be failing or take longer than they should. For example, by implementing a workaround of writing the logs to a .log file using |
hi @grandizzy please give some advice on this topic. I'd like to give it another try if the approach is fully discussed. also, I have my own idea, how about setup a flag with which user could decide whether |
hey @Azleal , yeah, I think a config for fuzz / invariant test printing console logs as they're executed makes sense (cc @mds1 ) Also would be neat to print them not only at the end, but as they go (as requested by this issue), that is after each call, e.g. for invariants foundry/crates/evm/evm/src/executors/invariant/mod.rs Lines 315 to 329 in 8dd7ad2
and for regular fuzz tests foundry/crates/evm/evm/src/executors/fuzz/mod.rs Lines 210 to 213 in 8dd7ad2
Side effect would be that if running with both show logs flag and show progress then progress will become flaky, but I guess that's acceptable. |
@Azleal lmk if you already looking into this, otherwise I'll pick it. thank you! |
hi @grandizzy sorry for my delayed reply. yes, I've already into this. I have tried to solve this issue once, so I'd like to give it another try. but i'm new to adding a new config, would appreciate it if you could give some suggestions or code referrences about adding and using a config in foundry. thanks |
@Azleal no worries, thanks for looking into! you would need to add a bool like foundry/crates/config/src/fuzz.rs Lines 10 to 12 in 034393c
Additionally you can make it inline / per test configurable by merging it here (I think this would be nice) foundry/crates/config/src/fuzz.rs Lines 68 to 92 in 034393c
You will need to update test Configs here foundry/crates/forge/tests/cli/config.rs Lines 29 to 30 in 034393c
and here
and I think that should be it |
thank you @grandizzy , lemme check it and I'll let you know if there's any updates. |
going to close this one as an impl was added in #8387 This is a little bit different than printing during fuzzing - logs are printed when test ends to make sure they're not mixed (to view test progress |
Component
Forge
Describe the feature you would like
It would be ideal if the console logs would print during the fuzzing, rather than only after the testing is complete. Fuzzing is often a long process, and I'd like some insight into what it is doing while it is running. Especially since nothing else is displayed while fuzzing, not even the current number of runs.
Additional context
No response
The text was updated successfully, but these errors were encountered: