Skip to content

test: Make a fixture file the only kind of test - #1699

Merged
chfast merged 1 commit into
masterfrom
test/one-test-per-file
Sep 7, 2026
Merged

test: Make a fixture file the only kind of test#1699
chfast merged 1 commit into
masterfrom
test/one-test-per-file

Conversation

@chfast

@chfast chfast commented Sep 4, 2026

Copy link
Copy Markdown
Member

Naming a file used to collect one test per fixture in it, which naming a directory could not afford: enumerating fixtures means loading every file, and a release is gigabytes. The two forms counted, filtered and skipped differently, and only one of them scaled.

A file is now one test either way, in both tools. Nothing is read until a test runs, so what --collect-only lists no longer depends on how the path was given.

Peeled out of #1685 to land the behaviour change on its own: a few tests change meaning here, which is worth reading apart from the command that replaces these tools.

@codspeed-hq

codspeed-hq Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 129 untouched benchmarks


Comparing test/one-test-per-file (eea90ca) with master (ab3d68e)

Open in CodSpeed

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.00%. Comparing base (ab3d68e) to head (eea90ca).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1699      +/-   ##
==========================================
- Coverage   98.01%   98.00%   -0.01%     
==========================================
  Files         180      180              
  Lines       16332    16288      -44     
  Branches     3739     3736       -3     
==========================================
- Hits        16007    15963      -44     
  Misses        247      247              
  Partials       78       78              
Flag Coverage Δ
eest-develop 87.64% <81.81%> (+0.50%) ⬆️
eest-develop-gmp 25.90% <42.42%> (-0.04%) ⬇️
eest-legacy 16.84% <39.39%> (+0.07%) ⬆️
eest-libsecp256k1 28.08% <42.42%> (-0.05%) ⬇️
eest-stable 87.60% <81.81%> (+0.50%) ⬆️
evmone-unittests 94.28% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 96.19% <ø> (ø)
tooling 93.96% <100.00%> (-0.14%) ⬇️
tests 99.81% <ø> (ø)
Files with missing lines Coverage Δ
test/blockchaintest/blockchaintest.cpp 95.34% <100.00%> (-1.63%) ⬇️
test/statetest/statetest.cpp 96.36% <100.00%> (-1.01%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chfast
chfast force-pushed the test/one-test-per-file branch from 0c1d1da to 70bbfdb Compare September 4, 2026 22:38
@chfast
chfast changed the base branch from master to test/results-per-fixture September 4, 2026 22:38
@chfast
chfast force-pushed the test/results-per-fixture branch from 7edd03a to 56bab94 Compare September 4, 2026 22:55
@chfast
chfast force-pushed the test/one-test-per-file branch 3 times, most recently from 17365fe to 3d12e3f Compare September 5, 2026 07:31
@chfast
chfast changed the base branch from test/results-per-fixture to master September 5, 2026 07:31
@chfast
chfast requested a balanced review from Copilot September 5, 2026 07:44
@chfast
chfast force-pushed the test/one-test-per-file branch from 3d12e3f to be2f78a Compare September 5, 2026 07:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The blockchain runner’s new direct-file collection branch lacks dedicated test coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Unifies fixture handling so each file is collected as one test without loading it during collection.

Changes:

  • Defers fixture loading until execution.
  • Aligns named-file and directory behavior.
  • Updates file-level collection and counting expectations.
File summaries
File Review
test/statetest/statetest.cpp Implements unified collection; update stale function and filtering comments.
test/integration/evmone-cli/test/statetest/CMakeLists.txt Updates state-test collection expectations.
test/integration/evmone-cli/test/blockchaintest/CMakeLists.txt Updates blockchain execution-count expectations.
test/blockchaintest/blockchaintest.cpp Implements equivalent behavior, but needs direct-file --collect-only coverage asserting test.json appears once.
Review details

Suppressed comments (3)

test/blockchaintest/blockchaintest.cpp:43

  • This changes directly named files to one file-level test, but the path option help at lines 59–61 still promises one separate test per fixture inside the file. Update the user-facing description so it matches the new collection semantics.
             }});

test/statetest/statetest.cpp:52

  • This changes directly named files to one file-level test, but the path option help at lines 68–70 still tells users that each test inside a named file becomes a separate test. Update the CLI contract together with the behavior.
            }});

test/statetest/statetest.cpp:50

  • Filtering now happens inside the file test for directly named files as well as directory entries. The filter_directory integration-test comment still says the direct-file case applies -k at registration, so it now documents a distinction that no longer exists; update that comment with this behavior change.
                    if (selected(test))
                        evmone::test::run_state_test(test, vm, trace, report);
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/blockchaintest/blockchaintest.cpp Outdated
Comment thread test/statetest/statetest.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Fix the integration coverage omission and update the outdated CLI help text.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread test/integration/evmone-cli/test/blockchaintest/CMakeLists.txt Outdated
Comment thread test/blockchaintest/blockchaintest.cpp Outdated
Comment thread test/statetest/statetest.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Lazy-loading coverage and help-text accuracy must be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (4)

test/blockchaintest/blockchaintest.cpp:40

  • The deleted unloadable-file case leaves this new lazy-loading guarantee untested: all remaining direct-file collection tests use valid JSON, so they still pass if collection accidentally starts parsing files again. Keep not_json.txt as a --collect-only case that must succeed and list the path once, and separately assert that running it fails.
        cases.push_back(
            {file.path.string(), [path = file.path, &vm](evmone::test::TestReport& report) {
                 std::ifstream f{path};

test/blockchaintest/blockchaintest.cpp:60

  • The help text's index.json exception applies only while walking a directory. A directly named index.json (or even a non-JSON file) reaches the else branch above and is registered as one test, so this currently documents behavior that the command does not enforce. Distinguish named-file handling from directory discovery.
               "Path to a test file or a directory of them. Every .json file is one test, "
               "except index.json, which is not a test file.")

test/statetest/statetest.cpp:69

  • The help text's index.json exception applies only while walking a directory. A directly named index.json (or even a non-JSON file) reaches the else branch above and is registered as one test, so this currently documents behavior that the command does not enforce. Distinguish named-file handling from directory discovery.
               "Path to a test file or a directory of them. Every .json file is one test, "
               "except index.json, which is not a test file.")

test/statetest/statetest.cpp:49

  • Named files now use this deferred selected predicate too, but the filter_directory test comment in test/integration/evmone-cli/test/statetest/CMakeLists.txt:99-101 still says filtering happens at registration for the direct-file test above. Update that comment so it no longer describes the removed distinction.
            [path = file.path, selected, &vm, trace](evmone::test::TestReport& report) {
                std::ifstream f{path};
                for (const auto& test : evmone::test::load_state_tests(f))
                {
                    if (selected(test))
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread test/statetest/statetest.cpp Outdated
@chfast
chfast force-pushed the test/one-test-per-file branch 2 times, most recently from 425baca to 4ef815c Compare September 5, 2026 11:27
@chfast
chfast requested a balanced review from Copilot September 5, 2026 12:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The state-test help text does not accurately describe direct-file behavior.

Review details

Suppressed comments (1)

test/statetest/statetest.cpp:69

  • This help text is inaccurate for directly named paths: collect_tests() treats any non-directory—including index.json and the notes.txt fixture exercised below—as one test. Restrict the .json/index.json rule to directory traversal and describe the direct-file behavior, as the blockchain runner does.
               "Path to a test file or a directory of them. Every .json file is one test, "
               "except index.json, which is not a test file.")
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The reviewed changes have no unresolved approval-blocking issues.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

All reviewed changes are covered with no unresolved issues.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@chfast
chfast force-pushed the test/one-test-per-file branch from 7f9060c to e2b5133 Compare September 7, 2026 09:23
@chfast
chfast force-pushed the test/one-test-per-file branch from e2b5133 to 05f7fca Compare September 7, 2026 10:17
@chfast
chfast changed the base branch from master to test/collector-relative-path September 7, 2026 10:17
@chfast
chfast force-pushed the test/collector-relative-path branch from 46b448d to d398555 Compare September 7, 2026 10:34
@chfast
chfast force-pushed the test/one-test-per-file branch from 05f7fca to dd57611 Compare September 7, 2026 10:36
@chfast
chfast force-pushed the test/collector-relative-path branch 2 times, most recently from 029b414 to 4840b3d Compare September 7, 2026 11:06
@chfast
chfast force-pushed the test/one-test-per-file branch from dd57611 to 418522b Compare September 7, 2026 11:07
Base automatically changed from test/collector-relative-path to master September 7, 2026 11:23
Naming a file collected one test per fixture in it, which naming a
directory could not afford: enumerating fixtures means loading every
file, and a release is gigabytes. The two forms counted, filtered and
skipped differently, and only one of them scaled.

A file is now one test either way, and collection loads nothing, so it
can no longer fail. Three consequences a reader should not have to infer
from the diff: --collect-only on a named file lists the file rather
than what is inside it, a -k which selects nothing from a named file
now passes, as it already did for a directory, and --ignore applies to
a named file as well, relative to that file.

Claude-Session: https://claude.ai/code/session_016UHPAGwcwXMjqhTLpT31K7

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Blockchain-runner direct-file ignore behavior lacks dedicated regression coverage.

Review details

Suppressed comments (1)

test/integration/evmone-cli/test/blockchaintest/CMakeLists.txt:104

  • The new direct-file --ignore path is only exercised by the statetest integration suite, so this separate blockchain-runner implementation can regress (for example, by using root instead of root.parent_path()) while all blockchain tests still pass. Add the analogous two-file collection case here, ignoring one basename and asserting only the other file is listed.
    PASS_REGULAR_EXPRESSION "^[^\n]*test\\.json\n$"
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@chfast
chfast merged commit 20c5b22 into master Sep 7, 2026
26 checks passed
@chfast
chfast deleted the test/one-test-per-file branch September 7, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants