From 12e6f0c190ac7a2f2b65b09ec0bb188a1d350b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Walter?= Date: Mon, 9 Oct 2023 14:10:32 +0200 Subject: [PATCH 1/2] Fix cargo trace display and devx --- .github/workflows/test.yml | 2 +- Makefile | 14 +++++------ README.md | 4 ++-- crates/ef-testing/src/models/result.rs | 32 ++------------------------ crates/sequencer/src/sequencer.rs | 5 +++- docs/CONTRIBUTING.md | 4 ++-- 6 files changed, 18 insertions(+), 43 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 63771672..ab7891ba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,4 +34,4 @@ jobs: run: make setup - uses: taiki-e/install-action@nextest - name: run tests - run: make ef-tests + run: make tests diff --git a/Makefile b/Makefile index 3a97ce16..c886ddd8 100644 --- a/Makefile +++ b/Makefile @@ -15,18 +15,18 @@ $(EF_TESTS_DIR): # Ensures the commands for $(EF_TESTS_DIR) always run on `make setup`, regardless if the directory exists .PHONY: $(EF_TESTS_DIR) -setup: $(EF_TESTS_DIR) +setup: $(EF_TESTS_DIR) -setup-kakarot: pull-kakarot +setup-kakarot: pull-kakarot cd lib/kakarot && make setup && make build pull-kakarot: git submodule update --init --recursive -# Runs the Ethereum Foundation tests -ef-tests: - cargo nextest run -p ef-testing --features ef-tests +# Runs the repo tests +tests: + cargo nextest run --all-features -# Runs specific test +# Runs ef tests only ef-test: - TARGET=$(target) cargo test -p ef-testing --features ef-tests -- --nocapture + cargo nextest run --package ef-testing --test tests --features ef-tests -- blockchain_tests diff --git a/README.md b/README.md index 6f843648..8a1a5034 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,8 @@ instructions: ## Test execution -To run the whole test suite, execute `make ef-tests` To run a specific test or -list of tests, execute `make target=regular_expression ef-test` where +To run the whole test suite, execute `make ef-test` To run a specific test or +list of tests, execute `TARGET=regular_expression make ef-test` where regular_expression allows you to filter on the specific tests you want to run. ## Acknowledgement diff --git a/crates/ef-testing/src/models/result.rs b/crates/ef-testing/src/models/result.rs index 0df5cdf2..eb611f96 100644 --- a/crates/ef-testing/src/models/result.rs +++ b/crates/ef-testing/src/models/result.rs @@ -29,11 +29,8 @@ impl CaseResult { } /// Assert that all the given tests passed and print the results to stdout. -pub(crate) fn assert_tests_pass(suite_name: &str, path: &Path, results: &[CaseResult]) { - let (passed, failed, skipped) = categorize_results(results); - - print_results(suite_name, path, &passed, &failed, &skipped); - +pub(crate) fn assert_tests_pass(_suite_name: &str, _path: &Path, results: &[CaseResult]) { + let (_passed, failed, _skipped) = categorize_results(results); assert!(failed.is_empty(), "Some tests failed (see above)"); } @@ -55,28 +52,3 @@ pub(crate) fn categorize_results( (passed, failed, skipped) } - -/// Display the given test results to stdout. -pub(crate) fn print_results( - suite_name: &str, - path: &Path, - passed: &[&CaseResult], - failed: &[&CaseResult], - skipped: &[&CaseResult], -) { - println!("\n Suite: {suite_name} (at {})", path.display()); - println!( - "Ran {} tests ({} passed, {} failed, {} skipped) \n", - passed.len() + failed.len() + skipped.len(), - passed.len(), - failed.len(), - skipped.len() - ); - - for case in failed { - match &case.result { - Ok(_) => unreachable!(), - Err(err) => println!("[!] Case {} failed:\n{}", case.path.display(), err), - } - } -} diff --git a/crates/sequencer/src/sequencer.rs b/crates/sequencer/src/sequencer.rs index 4176047c..713ecfd8 100644 --- a/crates/sequencer/src/sequencer.rs +++ b/crates/sequencer/src/sequencer.rs @@ -59,7 +59,10 @@ where <&mut S>::commit(&mut cached_state)?; match execution_information.revert_error { Some(err) => { - warn!("Transaction execution reverted: {:?}", err) + warn!( + "Transaction execution reverted: {}", + err.replace("\\n", "\n") + ) } None => { trace!("Transaction execution succeeded {execution_information:?}") diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 09920065..066e526c 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -51,7 +51,7 @@ of an issue raised by an Integrator. ### Debugger Pick an issue from the available `Integrator` issues. Verify that the test fails -(you can run a specific test by using `make target=your_test_name ef-test`). If +(you can run a specific test by using `TARGET=your_test_name make ef-test`). If it does, you can start debugging it. The following documentation can be used: - [Test fillers](https://github.com/ethereum/tests/tree/develop/src/GeneralStateTestsFiller): @@ -103,7 +103,7 @@ Ethereum/test: blockifier = { git = "https://github.com/jobez/blockifier.git", rev = "7f00407" } ``` -- Run `make target=your_test_name ef-test`. You should see the executed opcodes +- Run `TARGET=your_test_name make ef-test`. You should see the executed opcodes being printed out. #### Reproducing in Python (to be updated once Python test flow is improved) From a0456447060f0e44e49a22cb6417700aed4a73f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Walter?= Date: Mon, 9 Oct 2023 15:22:19 +0200 Subject: [PATCH 2/2] Remove useless blockchain_test args in test, add workspace settings --- .vscode/extensions.json | 3 +++ .vscode/settings.json | 3 +++ Makefile | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 00000000..09c9d001 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["trunk.io", "streetsidesoftware.code-spell-checker"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..a863ae4a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "cSpell.words": ["delegatecall", "revm", "sload", "sstore"] +} diff --git a/Makefile b/Makefile index c886ddd8..2607b1db 100644 --- a/Makefile +++ b/Makefile @@ -29,4 +29,4 @@ tests: # Runs ef tests only ef-test: - cargo nextest run --package ef-testing --test tests --features ef-tests -- blockchain_tests + cargo nextest run --package ef-testing --test tests --features ef-tests