-
Notifications
You must be signed in to change notification settings - Fork 369
refactor(tests): General benchmark folder restructuring #1681
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
refactor(tests): General benchmark folder restructuring #1681
Conversation
a5b2dee to
26d7e56
Compare
26d7e56 to
08e6754
Compare
|
I have not yet removed the old test files, this is to avoid future merge conflict overhead. I could delete them really quick after not much changes required for this PR. |
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.
Thanks @LouisTsai-Csie, the new structure looks great!
Unfortunately, we'll need to refactor the imports from the EEST libraries to match the changes in:
I just approved the workflow (sorry about that this is disabled for you right now, you'll get collab rights to the this repo soon, it's been requested!). As expected, the workflow has failed due to the change in the execution_testing package layout.
c686a0d to
8efe2d3
Compare
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.
Thanks for fixing up the imports @LouisTsai-Csie! I checked them all manually to see if we need to improve execution_testing and was happy to see that all the objects are already available as a direct import from the package π
In my initial review, I completely missed that the new "test modules" are no longer prefixed with test_. This looks very clean! But then I wondered why it worked, as pytest (by default) only collects modules that use the test_ prefix. It turns out that it works, because we have:
Line 4 in 15b5cfd
| python_files = *.py |
I reverted this config in #1710 to explicitly use the default value of test_*.py:
To make sure that test collection will still work with the naming convention in this PR and #1710, I pushed one small conftest config that will future-proof this PR for that change!
Ready to merge from my side, except for the remaining tests/benchmark/test_worst_* modules that still need to be ported.
688dce6 to
fa51f56
Compare
|
Hi @danceratopz , all the |
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.
As per team meeting, please rename any python module that contains a "test" to be prefixed test_*.py. Folders are ok, as-is.
fa51f56 to
b63cde3
Compare
|
I pushed a fix to the naming of one fixture, but I'm still reviewing. |
|
Pushed change in 5f001b6. It splits It further adds |
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.
lgtm... love the refactor ππΌ
|
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/osaka #1681 +/- ##
============================================
Coverage 86.07% 86.07%
============================================
Files 743 743
Lines 44078 44078
Branches 3894 3894
============================================
Hits 37938 37938
Misses 5659 5659
Partials 481 481
Flags with carried forward coverage won't be shown. Click here to find out more. β View full report in Codecov by Sentry. π New features to boost your workflow:
|
ποΈ Description
Folder Restructure Proposal:
Generally, this structure matches the one under
src/ethereum/forks/<forks>for consistency.Besides the folder restructuring, also rename test name and update the docstring, related rules are as follows:
Benchmark <category> instructionsorBenchmark <precompile> precompiles.test_<instruction/precompile>_<modifier>(_<modifier>is optional). The rationale behind this format is to enable user to quickly find related test. Example: if i want to know all the tests related toADD, i could searchtest_add.Note:
rebaseprocess during PR reviewLogic Changes
test_worst_precompile_fixed_costis now split into separate tests for each precompile. Input setup is simplified by replacing multipleMSTOREγ with a singleCALLDATACOPYthat copies the pre-encoded transaction calldata into memory.Below is the renaming table for reviewer to verify there is no missing benchmark during tests porting.
test_worst_compute.py
test_worst_zero_paramtest_block_opsinstruction/block.pytest_worst_zero_paramtest_environment_opsinstruction/environment.pytest_worst_zero_paramtest_gas_opinstruction/control_flow.pytest_worst_calldatasizetest_calldatasizeinstruction/environment.pytest_worst_callvaluetest_callvalueinstruction/environment.pytest_worst_returndatasize_nonzerotest_returndatasize_nonzeroinstruction/environment.pytest_worst_returndatasize_zerotest_returndatasize_zeroinstruction/environment.pytest_worst_msizetest_msizeinstruction/memory.pytest_worst_keccaktest_keccakinstruction/keccak.pytest_worst_precompile_only_data_inputtest_identityprecompile/identity.pytest_worst_precompile_only_data_inputtest_sha256precompile/sha256.pytest_worst_precompile_only_data_inputtest_ripemd160precompile/ripemd160.pytest_worst_modexptest_worst_modexpprecompile/modexp.pytest_worst_precompile_fixed_costtest_alt_bn128precompile/alt_bn128.pytest_worst_precompile_fixed_costtest_ecrecoverprecompile/ecrecover.pytest_worst_precompile_fixed_costtest_blake2fprecompile/blake2f.pytest_worst_precompile_fixed_costtest_point_evaluationprecompile/point_evaluation.pytest_worst_precompile_fixed_costtest_bls12_381precompile/bls12_381.pytest_worst_precompile_fixed_costtest_p256verifyprecompile/p256verify.pytest_worst_jumpstest_jumpsinstruction/control_flow.pytest_worst_jumpi_fallthroughtest_jumpi_fallthroughinstruction/control_flow.pytest_worst_jumpistest_jumpisinstruction/control_flow.pytest_worst_jumpdeststest_jumpdestsinstruction/control_flow.pytest_worst_binop_simpletest_comparisoninstruction/comparison.pytest_worst_binop_simpletest_arithmeticinstruction/arithmetic.pytest_worst_binop_simpletest_bitwiseinstruction/bitwise.pytest_worst_unoptest_iszeroinstruction/comparison.pytest_worst_unoptest_not_opinstruction/bitwise.pytest_worst_tloadtest_tloadinstruction/storage.pytest_worst_tstoretest_tstoreinstruction/storage.pytest_worst_shiftstest_shiftsinstruction/bitwise.pytest_worst_blobhashtest_blobhashinstruction/environment.pytest_worst_modtest_modinstruction/arithmetic.pytest_worst_memory_accesstest_memory_accessinstruction/memory.pytest_worst_modarithtest_mod_arithmeticinstruction/arithmetic.pytest_empty_blocktest_empty_blockscenarios/diff_tx_types.pytest_amortized_bn128_pairingstest_bn128_pairings_amortizedprecompile/alt_bn128.pytest_worst_calldataloadtest_calldataloadinstruction/environment.pytest_worst_swaptest_swapinstruction/stack.pytest_worst_duptest_dupinstruction/stack.pytest_worst_pushtest_pushinstruction/stack.pytest_worst_return_reverttest_return_revertinstruction/system.pytest_worst_clz_same_inputtest_clz_sameinstruction/bitwise.pytest_worst_clz_diff_inputtest_clz_diffinstruction/bitwise.pytest_worst_opcode.py
test_worst_log_opcodestest_loginstruction/log.pytest_worst_memory.py
test_worst_calldatacopytest_calldatacopyinstruction/environment.pytest_worst_codecopytest_codecopyinstruction/environment.pytest_worst_returndatacopytest_returndatacopyinstruction/environment.pytest_worst_mcopytest_worst_mcopyinstruction/memory.pytest_worst_blocks.py
test_block_full_of_ether_transferstest_block_full_of_ether_transfersscenarios/diff_tx_types.pytest_block_full_datatest_block_full_datascenarios/diff_tx_types.pytest_block_full_access_list_and_datatest_block_full_access_list_and_datascenarios/diff_tx_types.pytest_worst_case_auth_blocktest_worst_case_auth_blockscenarios/diff_tx_types.pytest_worst_stateful_opcodes.py
test_worst_address_state_coldtest_worst_address_state_coldinstruction/environment.pytest_worst_address_state_warmtest_worst_address_state_warmscenarios/mix_operations.pytest_worst_storage_access_coldtest_storage_access_coldinstruction/storage.pytest_worst_storage_access_warmtest_storage_access_warminstruction/storage.pytest_worst_blockhashtest_blockhashinstruction/block.pytest_worst_selfbalancetest_selfbalanceinstruction/environment.pytest_worst_extcodecopy_warmtest_extcodecopy_warminstruction/environment.pytest_worst_selfdestruct_existingtest_selfdestruct_existinginstruction/system.pytest_worst_selfdestruct_createdtest_selfdestruct_createdinstruction/system.pytest_worst_selfdestruct_initcodetest_selfdestruct_initcodeinstruction/system.pytest_worst_bytecode.py
test_worst_bytecode_single_opcodetest_extcode_opsinstruction/environment.pytest_worst_bytecode_single_opcodetest_xcallinstruction/system.pytest_worst_initcode_jumpdest_analysistest_jumpdest_analysisscenarios/mix_operations.pytest_worst_createtest_createinstruction/system.pytest_worst_creates_collisionstest_creates_collisionsinstruction/system.pyπ Related Issues or PRs
Issue: #1570
β Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.mkdocs servelocally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.@ported_frommarker.Cute Animal Picture