Skip to content

test: Replace gtest assertions in the fixture runners - #1673

Merged
chfast merged 1 commit into
masterfrom
test/report-without-gtest
Aug 26, 2026
Merged

test: Replace gtest assertions in the fixture runners#1673
chfast merged 1 commit into
masterfrom
test/report-without-gtest

Conversation

@chfast

@chfast chfast commented Aug 23, 2026

Copy link
Copy Markdown
Member

evmone-statetest and evmone-blockchaintest use gtest for two unrelated jobs: registering and
driving the tests, and an assertion vocabulary inside the runners. This replaces the second with
TestReport, which the runners take by reference and record into: start_case() names the
fixture's test, at() the place within it, check()/check_eq() what is compared, fail() what
did not hold. There are no macros, so the report is a parameter rather than a global and a check
is named in the fixture's own terms instead of by a stringified expression. Each failure reaches
the driver's sink as it is recorded, where a small bridge turns it into a gtest failure; the
bridge goes away with the driver.

tests/prague/eip7702_set_code_tx/test_set_code_txs.py::test_contract_create[fork_Prague-state_test]:
  Prague/0:
    state root:
      actual   0x52d14b553a8578ef2c4f2574061ba0140de743e87fb0429e0faffc48b94b1e75
      expected 0xdededededededededededededededededededededededededededededededede

Behaviour is unchanged: every former ASSERT_* became an explicit return with the same scope,
every EXPECT_* a non-returning check. A green fixture run reaches none of this code, so the
polarity of all 40 sites was checked against the original rather than inferred from passing
suites.

@codspeed-hq

codspeed-hq Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 129 untouched benchmarks


Comparing test/report-without-gtest (4e2da50) with master (203d093)

Open in CodSpeed

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.62069% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.56%. Comparing base (203d093) to head (4e2da50).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
test/blockchaintest/blockchaintest_runner.cpp 61.03% 21 Missing and 9 partials ⚠️
test/statetest/statetest_runner.cpp 82.35% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1673      +/-   ##
==========================================
- Coverage   97.72%   97.56%   -0.16%     
==========================================
  Files         171      174       +3     
  Lines       15666    15876     +210     
  Branches     3625     3646      +21     
==========================================
+ Hits        15310    15490     +180     
- Misses        269      289      +20     
- Partials       87       97      +10     
Flag Coverage Δ
eest-develop 87.66% <55.41%> (-0.94%) ⬇️
eest-develop-gmp 26.28% <11.37%> (-0.24%) ⬇️
eest-legacy 16.95% <23.79%> (-0.14%) ⬇️
eest-libsecp256k1 28.52% <11.37%> (-0.27%) ⬇️
eest-stable 87.66% <55.41%> (-0.94%) ⬇️
evmone-unittests 93.35% <81.03%> (-0.09%) ⬇️

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

Components Coverage Δ
core 96.11% <ø> (ø)
tooling 90.69% <79.24%> (-1.28%) ⬇️
tests 99.81% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
test/blockchaintest/blockchaintest.cpp 88.70% <100.00%> (+0.99%) ⬆️
test/statetest/statetest.cpp 91.02% <100.00%> (+0.48%) ⬆️
test/unittests/test_report_test.cpp 100.00% <100.00%> (ø)
test/utils/statetest.hpp 69.23% <ø> (-7.70%) ⬇️
test/utils/test_report.cpp 100.00% <100.00%> (ø)
test/utils/test_report.hpp 100.00% <100.00%> (ø)
test/statetest/statetest_runner.cpp 87.71% <82.35%> (-4.74%) ⬇️
test/blockchaintest/blockchaintest_runner.cpp 75.26% <61.03%> (-8.26%) ⬇️
🚀 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/report-without-gtest branch 6 times, most recently from e44c90b to 81fad7d Compare August 24, 2026 18:20
@chfast
chfast requested a balanced review from Copilot August 25, 2026 11:34

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.

Pull request overview

Replaces GoogleTest assertions inside fixture runners with structured TestReport failure collection while retaining GoogleTest as the test driver.

Changes:

  • Adds scoped, structured failure reporting and rendering.
  • Migrates state and blockchain runners to explicit checks and failures.
  • Bridges collected failures to GoogleTest and adds unit coverage.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/utils/test_report.hpp Defines reporting API and failure model.
test/utils/test_report.cpp Formats structured failures.
test/utils/statetest.hpp Adds report parameter to state runner.
test/utils/CMakeLists.txt Builds reporting utilities.
test/unittests/test_report_test.cpp Tests reporting and rendering.
test/unittests/CMakeLists.txt Registers report tests.
test/statetest/statetest.cpp Bridges state-test reports to GoogleTest.
test/statetest/statetest_runner.cpp Replaces runner assertions with report checks.
test/blockchaintest/blockchaintest.cpp Bridges blockchain reports to GoogleTest.
test/blockchaintest/blockchaintest_runner.hpp Adds report parameter to blockchain runner.
test/blockchaintest/blockchaintest_runner.cpp Migrates blockchain assertions to reporting.

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

@chfast
chfast force-pushed the test/report-without-gtest branch 8 times, most recently from d321037 to 5fb5731 Compare August 25, 2026 21:42
The state and blockchain test runners used gtest only as an assertion
vocabulary. Replace it with TestReport, which the runners take by
reference and record into: start_case() names the fixture's test, at()
the place within it, check()/check_eq() what is compared, fail() what did
not hold. The binaries still drive the tests, passing a sink that turns
each failure into a gtest one as it is recorded, so a run that dies
part-way still reports what it found. A failure is reported the way
pytest reports one:

    <test name>:
      Prague/0:
        state root:
          actual   0x5f8c...
          expected 0x9e21...

No macros, so no global report to reach from one and no stringified
expressions: a check is named in the fixture's terms instead. Detail too
expensive to format unless a check fails is passed as a callable, run
before the failure is recorded so that the sink sees it whole; one site
dumps the entire result state that way.
@chfast
chfast force-pushed the test/report-without-gtest branch from 229e536 to 4e2da50 Compare August 26, 2026 08:23
@chfast
chfast requested a balanced review from Copilot August 26, 2026 08:28

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.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

/// Records that @p what did not hold.
void fail(std::string_view what, std::string detail = {})
{
m_sink(Failure{m_test, m_where, std::string{what}, std::move(detail)});
@chfast
chfast merged commit 471b3e7 into master Aug 26, 2026
24 of 26 checks passed
@chfast
chfast deleted the test/report-without-gtest branch August 26, 2026 08:44
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