Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

test: refactor testdata/ tests to be run in forge test #12049

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

Merged
grandizzy merged 102 commits into master from dani/test-testdata
Oct 17, 2025

Conversation

Copy link
Member

@DaniPopes DaniPopes commented Oct 10, 2025
edited
Loading

Refactor manual integration tests to just run forge test on the testdata folder project.

We set up testdata/ to be a Foundry project, and a single test that runs forge test on it.

Not all current tests pass due to inability of asserting higher level things like console output, general test failure, etc. These tests are migrated to inline forgetest! Rust snapshot tests.

The bulk of the manual work was migrating fuzz and invariant tests that assert data structures like counterexample list into str![[]] tests, making sure the config is also migrated from the relevant Rust test.
The rest was mostly automated / claude-coded.

Followups:

  • make testdata/ project have a more standard structure (src/, test/, better directory name)
  • remove DSTest in favor of forge-std
  • optimize Config::load_with_root in update_config. We ignore remappings so we shouldnt try to resolve them at all

zerosnacks reacted with thumbs up emoji
Copy link
Collaborator

grandizzy commented Oct 10, 2025
edited
Loading

this will be a game changer for CI! I'd suggest getting rid of default / Paris/ shanghai testdata / test runners stuff and using the newly added vm.setEvmVersion cheatcode to assert different outcomes in same tests instead

Copy link
Member Author

right, we can do that as a follow-up since the diff is going to be big already from just fixing tests and making it work in the first place

grandizzy reacted with thumbs up emoji


import "ds-test/test.sol";
forgetest_init!(
#[ignore = "slow"]
Copy link
Collaborator

@grandizzy grandizzy Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should re-enable this one with AST seeded fuzz dictionary PR, should be much faster cc @0xrusowsky

0xrusowsky reacted with thumbs up emoji
// Test that showcases PUSH collection on normal fuzzing.
// Ignored until we collect them in a smarter way.
forgetest_init!(
#[ignore]
Copy link
Collaborator

@grandizzy grandizzy Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as for #12049 (comment) with AST seeded fuzz dictionary we will collect values of 0x4446 and 0x5556 and use to fuzz selectors.

For the

 counter += numToIncrement;
 counterX2 += numToIncrement * 2;

case wonder if folding could help #12044 cc @0xrusowsky

Copy link
Contributor

@0xrusowsky 0xrusowsky Oct 17, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in our current plans we only had constant folding. In this case how would we derive a value for numToIncrement?

at most we could use the += and the * 2 to create smarter mutators for dict values, but not totally sure how to leverage that

import "ds-test/test.sol";
import "cheats/Vm.sol";
use foundry_test_utils::str;
Copy link
Collaborator

@grandizzy grandizzy Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note, pls lmk if I am wrong: we should still add sol files repros as before in testdata/default/repros but if there are repros that require check of output (fails or we want to check traces) we should add them here and assert

Copy link
Contributor

@0xrusowsky 0xrusowsky Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's also what i understood + it aligns with the PR desc

grandizzy reacted with thumbs up emoji
Copy link
Member Author

@DaniPopes DaniPopes Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's right, if the test can be implemented using foundry directly then it should go in testdata
only if it needs higher level assertions like console output should it go to forgetest!

optimizer_runs = 200
via_ir = false
ignored_error_codes = [
1878, # SPDX license identifier not provided
Copy link
Collaborator

@grandizzy grandizzy Oct 17, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we close #10577 with this PR? cc @zerosnacks
And probably #10744 not needed anymore

DaniPopes reacted with thumbs up emoji
Copy link
Member

@zerosnacks zerosnacks Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be cleaner to resolve them instead of ignoring them but I can quite easily create a follow-up PR to reduce the number of ignored error codes, especially 2319 and 2519 need to be addressed

grandizzy and 0xrusowsky reacted with thumbs up emoji
Copy link
Member

@zerosnacks zerosnacks Oct 17, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#10744 has been closed, I'll update the description of #10577 after merging of this PR and assign it to me

grandizzy reacted with thumbs up emoji
@grandizzy grandizzy self-requested a review October 17, 2025 10:58
Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! since a big diff waiting for other reviews before merge.

Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Contributor

@0xrusowsky 0xrusowsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

big diff, didn't spot anything that seemed wrong. lgtm

@grandizzy grandizzy merged commit c8086ad into master Oct 17, 2025
33 of 34 checks passed
@grandizzy grandizzy deleted the dani/test-testdata branch October 17, 2025 12:15
@github-project-automation github-project-automation bot moved this from In Progress to Done in Foundry Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@grandizzy grandizzy grandizzy approved these changes

@0xrusowsky 0xrusowsky 0xrusowsky approved these changes

@zerosnacks zerosnacks zerosnacks approved these changes

@mattsse mattsse Awaiting requested review from mattsse mattsse is a code owner

@onbjerg onbjerg Awaiting requested review from onbjerg onbjerg is a code owner

Labels

None yet

Projects

Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /