Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ tests/t8n_testdata

fixtures/

# Trace output (generated by --traces flag)
traces/

logs/
*.log

Expand Down
3 changes: 2 additions & 1 deletion docs/filling_tests/debugging_t8n_tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ There are two flags that can help debugging `t8n` tools or the execution-spec-te

## EVM Dump Directory

The `--evm-dump-dir` flag tells the framework to write the inputs and outputs of every call made to the `t8n` command to the specified output directory. The aim is to help debugging or simply understand how a test is interacting with the EVM. Debug output is only generated when this flag is explicitly specified.
The `--evm-dump-dir` flag tells the framework to write the inputs and outputs of every call made to the `t8n` command to the specified output directory. The aim is to help debugging or simply understand how a test is interacting with the EVM.
When `--traces` is specified without an explicit `--evm-dump-dir`, a default directory of `traces/` is used.

Each test case receives its own sub-directory under the `--evm-dump-dir` that contains these files which can be easily accessed from the HTML test report generated by `fill` (located by default in the root of the `--output` directory).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,13 @@ def pytest_configure(config: pytest.Config) -> None:
or config.getoption("optimize_gas", False)
)

# set default for --evm-dump-dir
if (
config.collect_traces # type: ignore[attr-defined]
and config.getoption("base_dump_dir")
) is None:
config.option.base_dump_dir = "traces"

# Instantiate the transition tool here to check that the binary path/trace
# option is valid. This ensures we only raise an error once, if
# appropriate, instead of for every test.
Expand Down
13 changes: 12 additions & 1 deletion packages/testing/src/execution_testing/client_clis/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from pydantic import BaseModel, RootModel

from execution_testing.client_clis.cli_types import LazyAlloc


def dump_files_to_directory(output_path: str, files: Dict[str, Any]) -> None:
"""Dump the files to the given directory."""
Expand All @@ -22,7 +24,16 @@ def dump_files_to_directory(output_path: str, files: Dict[str, Any]) -> None:
os.makedirs(os.path.join(output_path, rel_path), exist_ok=True)
file_path = os.path.join(output_path, file_rel_path)
with open(file_path, "w") as f:
if isinstance(file_contents, BaseModel) or isinstance(
if isinstance(file_contents, LazyAlloc):
# Validate and serialize the lazy alloc
f.write(
file_contents.get().model_dump_json(
indent=4,
exclude_none=True,
by_alias=True,
)
)
elif isinstance(file_contents, BaseModel) or isinstance(
file_contents, RootModel
):
f.write(
Expand Down
Loading