-
Notifications
You must be signed in to change notification settings - Fork 360
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 rust tests for jsontests #259
Feat: add rust tests for jsontests #259
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why though? What are the advantage of using the testing framework instead of making it a CLI command? This also makes it more difficult to debug -- previously one just need to add the --debug
flag to whatever command they are running.
Plus the testing framework by default run things multi-threaded, which makes the output unreadable.
Extended description. Actually, PR does not remove CLI, just extends it. So it's easy to use any of the solutions.
I think, for debugging CLI is pretty good. But to just check, that all test passed with multi thread in |
@sorpaas This PR propose just extend with rust-specific test, and do not remove CLI capabilities. |
@sorpaas Also have a question. Do you plan to pass other Eth Fork? Especially |
I see what you mean. However, I still have some concerns about the design. Currently, the added tests look like this:
This is rather non-gradual -- each unit test case is a whole folder. Optimally, we would want a We can do this with proc-macro, or just simply generated Rust files. What are you actual workflows? If you are using some IDEs which allows you to click-and-run some tests individually, then generated Rust files, while a bit messy, might be a better idea than proc-macro (because the IDE will likely not support that). |
Yes definitely. :) |
It just runs AFAIK it's about 129 files. It's not a big deal to add it. But one of the pitfalls is that it can be changed, as it's an external repo. But it's also not a problem. @sorpaas One of the questions - do you approve of that approach and tp spend time on that? My point is to have rust-specific way for testing, and it does not affect CLI. |
We can generate the file. It does not need to be hand-written. I think I have an idea and it'll also simplify testing against Geth.
Yeah, but we need a more gradual list of test cases. What I would suggest is that you revert back the CI to use CLI test command. Then I can merge this and we can spend our time working on better libtest integration. |
@sorpaas In separate PR, if it's aligned with your vision of
with func test body like:
or proc-macro, something like:
Or leave it AS IS, for future solutions. )) |
@mrLSD I like the proc macro thing because it'll be less code. But I'd first want to confirm -- does it work for you? You mentioned that one of the reasons you want to integrate into Rust's test framework is that this can work with your IDE. Does this still work with proc macro? From what I know, they only check the |
@sorpaas Yes, you're absolutely right. IDE If this approach suits you, I can take on this implementation. |
Description
Currently, tests are represented via
jsontests
crate. It's a good tool 💯, to use as a CLI standalone application.➡️ This PR also added possibilities to use
Rust
specific way to run tests with:cargo test
.➡️ The main motivation is to run tests through
Rust
, to choose which tests to run, and to be able to add tests later. And mostly go through cargo test flow. However, this does not negate all the capabilities of the CLI application. For this purpose, refactoring was done, and utility functions were placed in a separate module, which will allow them to be used both in the application and inRust
tests.➡️ Also added comments to the code where it makes sense.
➡️ Each single test runs tests from a separate
evm jsontests
directory.➡️ The CI has been refactored (however, in this particular case - I'm not sure what is more representative from the CI point of view - running as an application or as
cargo test
).