Skip to content
Merged
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
14 changes: 14 additions & 0 deletions tests/core/pyspec/eth2spec/gen_helpers/gen_base/dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,20 @@ def dump_ssz(self, test_case: TestCase, name: str, data: bytes) -> None:
with path.open("wb") as f:
f.write(compress(data))

def dump_manifest(self, test_case: TestCase) -> None:
"""Write manifest.yml file containing test case metadata."""
manifest_data = {
"preset": test_case.preset_name,
"fork": test_case.fork_name,
"runner": test_case.runner_name,
"handler": test_case.handler_name,
"suite": test_case.suite_name,
"case": test_case.case_name,
}
# Use cfg_yaml which has block style formatting (default_flow_style=False)
# This ensures each field appears on a separate line, matching data.yaml format
self._dump_yaml(test_case, "manifest", manifest_data, self.cfg_yaml)

def _dump_yaml(self, test_case: TestCase, name: str, data: any, yaml_encoder: YAML) -> None:
"""Helper to write YAML files for test case."""
path = test_case.dir / f"{name}.yaml"
Expand Down
3 changes: 3 additions & 0 deletions tests/core/pyspec/eth2spec/gen_helpers/gen_base/gen_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def execute_test(test_case: TestCase, dumper: Dumper):
if meta:
dumper.dump_meta(test_case, meta)

# Always write manifest.yml for every test case
dumper.dump_manifest(test_case)


def run_generator(input_test_cases: Iterable[TestCase], args=None):
start_time = time.time()
Expand Down
25 changes: 24 additions & 1 deletion tests/formats/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ testing.
- [Common output formats](#common-output-formats)
- [Special output parts](#special-output-parts)
- [`meta.yaml`](#metayaml)
- [`manifest.yaml`](#manifestyaml)
- [`config.yaml`](#configyaml)
- [Config sourcing](#config-sourcing)
- [Note for implementers](#note-for-implementers)
Expand Down Expand Up @@ -213,6 +214,28 @@ bls_setting: int -- optional, can have 3 different values:
2: known as "BLS ignored" - if the test validity is strictly dependent on BLS being OFF
```

##### `manifest.yaml`

Included in every test case. Contains metadata that identifies the test vector:

```yaml
preset: minimal # Preset (mainnet, minimal, general)
fork: phase0 # Fork/phase name
runner: bls # Test runner category
handler: eth_aggregate_pubkeys # Specific handler
suite: bls # Test suite name
case: eth_aggregate_pubkeys_valid_0 # Individual test case name
```

This metadata duplicates what is already encoded in the directory path:

```
tests/<preset>/<fork>/<runner>/<handler>/<suite>/<case>/
```

Having it in a file means test vectors can be moved or distributed without
losing context.

##### `config.yaml`

The runtime-configurables may be different for specific tests. When present,
Expand Down Expand Up @@ -252,7 +275,7 @@ The basic pattern for test-suite loading and running is:
`operations > deposits`). Again, repeat for each if running all.
4. Select a test suite. Or repeat for each.
5. Select a test case. Or repeat for each.
6. Load the parts of the case. And `meta.yaml` if present.
6. Load the parts of the case. `manifest.yaml` and `meta.yaml` if present.
7. Run the test, as defined by the test format.

Step 1 may be a step with compile time selection of a configuration, if desired
Expand Down