-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[WIP] Extract solidity end-to-end tests #8346
Conversation
Simple means here, that where was no need to manually change the generated files.
Can you add the tool to the repository? |
As I said, I do not want to review the result, I want to review the generator. If that is fine, spot-checks to the result should be all that is needed. |
Also please do not use numbers to abbreviate actual words :) |
Run a solidity formatter: Maybe it's fine to just remove the leading tabs. |
Sure. I just thought that it may not be very useful once we extracted all the extractable tests. However, I will add the generator to this PR.
Yes, I agree. That would be perfect.
That's really a pity :D
Yes, I will do that. |
Can you explain the purpose of the individual files? Why did you need to add a fake compiler stack? |
#define BOOST_AUTO_TEST_CASE(X) m_tests[#X] = ExtractionTask(#X, [this]() { \
prepareTest(#X, m_tests);
#define m_compiler extractor_m_compiler() If those "members" where used by a specific test-case, the test-casee will be marked as not extractable.
|
Why can you avoid compiling if you actually need to run? Or do you run two passes? |
I use one analysis pass that is mainly executing the bounded With compiling I meant the compilation of the solidity test-cases. But we already know that they are compilable. We only want to use its source-code. |
@chriseth I think that the cpp based test-extractor is probably a bit too complex. So I wrote more simple test-extractor in python (see https://github.com/ethereum/solidity/blob/58651e7ebd977288afa1404648395a2a4ab46fa5/test/tools/extractor.py/extractor.py). But this extractor is only able to extract the very simple test-cases. It looks like that there are 260 very simple test-cases. The python extractor is also able to preserve the comments given in the original test-cases. However, some test-cases seem to have compilation problems. I didn't investigated these problems so far.
|
Can you extract the python-based extractor and the tests it extracts into its own PR? |
Created its own PR, see #8381 |
To generate the given solidity files a generator was used that can be found here https://github.com/aarlt/solidity/tree/62c1515bc45c4bcc587dfd52458ca783c5ff9cd1/test/tools/end2end-extractor.
The generator is checking for the used features per test-case. Currently, the generator detects that 180 test-cases are not extractable. Tests that are not extractable use
m_evmHost
,m_output
,m_contractAddress
,m_compiler
, try to send value or need to pass arguments to the constructor. Tests usingtestContractAgainstCppOnRange
,testContractAgainstCpp
are excluded from the extraction, because these kind of tests are tested against C++ functions and are better readable compared to resulting semantic tests. Tests that callcompileAndRun
multiple times while defining different source-codes within a single test will also get excluded for now.However, 364 test-cases seem to be extractable. As for now I was not able to write a generic encoder that allows the generation of all these test-cases without any manual change.
259 test-cases
are simple.FAILURE
need to be added to the test-cases either manually or with the help ofisoltest
.solidity/test/libsolidity/SolidityEndToEndTest.cpp
As for now
259 / 364
test-cases where extracted.@chriseth I'm still not sure whether this will be better reviewable :-(
Fixes #8197. Old PR #8284.