From 961ee943054f704c0eb9ff9c54d9276bf4eb7876 Mon Sep 17 00:00:00 2001 From: enitrat Date: Tue, 24 Sep 2024 14:02:36 +0200 Subject: [PATCH 1/2] dev: update test fixtures --- Makefile | 2 +- scripts/generate_skip_file.py | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 11d3b748..b151dbd6 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ endif # The release tag of https://github.com/kkrt-labs/tests to use for EF tests. Usually an # ethereum/tests release tag followed by `-kkrt`. -EF_TESTS_TAG := v14.1-kkrt +EF_TESTS_TAG := v14.1.1-kkrt EF_TESTS_URL := https://github.com/kkrt-labs/tests/archive/refs/tags/$(EF_TESTS_TAG).tar.gz EF_TESTS_DIR := ./crates/ef-testing/ethereum-tests diff --git a/scripts/generate_skip_file.py b/scripts/generate_skip_file.py index 45b453f1..3a29a771 100644 --- a/scripts/generate_skip_file.py +++ b/scripts/generate_skip_file.py @@ -3,22 +3,28 @@ from collections import defaultdict -def format_into_identifier(s: str) -> str: - if "Pyspec" in s: +def format_into_identifier(s: str, is_pyspec: bool = False) -> str: + if is_pyspec: + test_name = s.split("/")[-1].split("::")[-1] test_name = ( - s.split("::")[-1] - .replace("test_", "") + test_name.replace("test_", "") .replace("(", "_lpar_") - .replace(")", "_rpar") + .replace(")", "_rpar_") .replace("[", "__") .replace("]", "") .replace("-", "_minus_") + .replace(" ", "_") + .replace(".", "_") .split(",") ) test_name = "_".join(part.strip() for part in test_name) return test_name else: - return s.replace("-", "_minus_").replace("+", "_plus_").replace("^", "_xor_") + return ( + s.replace("-", "_minus_") + .replace("+", "_plus_") + .replace("^", "_xor_") + ) def extract_runresource_failures(input_file): @@ -29,8 +35,9 @@ def extract_runresource_failures(input_file): for line in file: if "reverted:" in line: test_name_line = line - test_name = test_name_line.split("reverted:")[0].split("::")[-1].strip() - test_name = format_into_identifier(test_name) + is_pyspec = ".py" in test_name_line + test_name_raw = test_name_line.split("reverted:")[0].split("::")[-1].strip() + test_name = format_into_identifier(test_name_raw, is_pyspec) last_reverted = test_name # If we find a line that says "RunResources has no remaining steps." after the last reverted test, # we know that the test failed due to a RunResources error From fee5310a1fb0f193ad6ba8928ab241d2f0e3ad0f Mon Sep 17 00:00:00 2001 From: enitrat Date: Tue, 24 Sep 2024 14:21:01 +0200 Subject: [PATCH 2/2] lint --- scripts/generate_skip_file.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/generate_skip_file.py b/scripts/generate_skip_file.py index 3a29a771..b34cc7b4 100644 --- a/scripts/generate_skip_file.py +++ b/scripts/generate_skip_file.py @@ -20,11 +20,7 @@ def format_into_identifier(s: str, is_pyspec: bool = False) -> str: test_name = "_".join(part.strip() for part in test_name) return test_name else: - return ( - s.replace("-", "_minus_") - .replace("+", "_plus_") - .replace("^", "_xor_") - ) + return s.replace("-", "_minus_").replace("+", "_plus_").replace("^", "_xor_") def extract_runresource_failures(input_file): @@ -36,7 +32,9 @@ def extract_runresource_failures(input_file): if "reverted:" in line: test_name_line = line is_pyspec = ".py" in test_name_line - test_name_raw = test_name_line.split("reverted:")[0].split("::")[-1].strip() + test_name_raw = ( + test_name_line.split("reverted:")[0].split("::")[-1].strip() + ) test_name = format_into_identifier(test_name_raw, is_pyspec) last_reverted = test_name # If we find a line that says "RunResources has no remaining steps." after the last reverted test,