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

Generate precompile tests #565

Merged
merged 23 commits into from
May 1, 2023
Merged

Generate precompile tests #565

merged 23 commits into from
May 1, 2023

Conversation

ceyonur
Copy link
Collaborator

@ceyonur ceyonur commented Mar 6, 2023

Why this should be merged

Adds unit test generation to precompile generation tool

How this works

Adds 2 new templates for contract and config tests.

How this was tested

Generated hello world precompile in #564

How is this documented

Page at https://docs.avax.network/subnets/hello-world-precompile-tutorial needs to be updated.

@ceyonur ceyonur self-assigned this Mar 6, 2023
@ceyonur ceyonur linked an issue Mar 6, 2023 that may be closed by this pull request
@ceyonur ceyonur added this to the Subnet-EVM@v0.4.12 milestone Mar 6, 2023
// Run tests.
for name, test := range tests {
t.Run(name, func(t *testing.T) {
test.Run(t, module, NewTestStateDB(t *testing.T))
Copy link
Collaborator

Choose a reason for hiding this comment

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

NewTestStateDB(t *testing.T) does not seem correct here.

Is it possible to include a test that generates a precompile then compiles or calls gofmt on the resulting code? We could do this as a separate PR or an issue, however I think it will make it easier to edit the templates in the long run.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You mean like a unit test in the precompile_bind_test?

params/precompile_config_test.go Outdated Show resolved Hide resolved
Base automatically changed from config-test-suites to master April 4, 2023 15:00
…late.go

Co-authored-by: Darioush Jalali <darioush.jalali@avalabs.org>
@aaronbuchwald aaronbuchwald merged commit 19e90a9 into master May 1, 2023
@aaronbuchwald aaronbuchwald deleted the generate-precompile-tests branch May 1, 2023 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate tests with precompile gen
3 participants