Skip to content

Pin the verdict of every obligation in the golden suite - #23

Open
evertonfraga wants to merge 1 commit into
mainfrom
test/per-obligation-goldens
Open

evertonfraga wants to merge 1 commit into
mainfrom
test/per-obligation-goldens

Conversation

@evertonfraga

Copy link
Copy Markdown
Contributor

Summary

The golden suite now compares each obligation's verdict, checks the fixtures' own intended-outcome comments, and fails in CI when a fixture has no golden file.

test/run_tests.sh

  • Compares, per fixture:

    • every obligation as <verdict> <line>: <description>, sorted by line and description, plus the totals line;
    • Exception: lines and, newly, uncaught exception: lines from stderr;
    • the first line of each BUG: diagnostic from stderr;
    • the warnings, as before (.warnings).

    Previously only the section counts and totals were compared, so swapping a proven and a refuted verdict in short_circuit.sol still passed.

  • Checks fixture comments that start with // Passes, // Fails, // Refuted or // Not proven (58 in 53 fixtures) against the verdicts of the obligations below them, up to the next such comment:

    Comment Must report
    Passes at least one obligation, all ✅
    Refuted at least one ❌
    Fails, Not proven at least one obligation that is not ✅
  • Under CI (CI set), a missing .expected or .warnings file fails instead of being generated.

  • UPDATE=1 bash test/run_tests.sh rewrites the golden files after a deliberate change.

Golden files

All 53 regenerated in the new format. No verdict changed: for every fixture the number of proven, refuted and unknown obligations equals its old section counts (414 obligations in total), and the totals and Exception: lines are identical. environment and external_calls now also record the BUG: static call to this_address … line they print.

Other changes

  • test/examples/internal_calls.sol: depositWrong's comment said "Refuted", but its obligation has been ❓ since the fixture was added. The comment now says "Not proven".
  • README.md: explains the golden format, the outcome comments and UPDATE=1.

Testing

  • CI=true bash test/run_tests.sh: 53 passed, 0 failed; exit-code contract 8/8.
  • On a scratch copy of the harness:
    • a flipped verdict fails, with a one-line diff;
    • swapping two verdicts is caught by the outcome comments as well;
    • under CI=true, a fixture with no golden file and one with no .warnings file both fail, and nothing is written; locally both are generated;
    • an uncaught exception: crash is recorded in the golden.

The golden files recorded only the section counts and totals, so a change
that proved one property and refuted another, keeping the counts, passed:
swapping the two verdicts in short_circuit.sol left CI green. A fixture
without a golden file got one generated, so it ran unchecked, and a crash
reported as `uncaught exception:` was not captured at all.

test/run_tests.sh now compares, per fixture:
- every obligation as `<verdict> <line>: <description>`, sorted by line
  and description, plus the totals line;
- translation failures (`Exception:` and now `uncaught exception:`) and
  the first line of each internal `BUG:` diagnostic, from stderr;
- the warnings, as before (`.warnings`).

Fixture comments that state an intended outcome (`// Passes`, `// Fails`,
`// Refuted`, `// Not proven`, 58 of them in 53 fixtures) are checked
against the verdicts of the obligations below them, so a golden file
cannot be regenerated into a contradiction of the fixture's own intent.

Under CI (`CI` set) a missing golden or warnings file fails instead of
being written. `UPDATE=1` rewrites every golden file after a deliberate
change.

The 53 golden files are regenerated in the new format. No verdict
changed: each fixture lists the same number of proven, refuted and
unknown obligations as its old section counts (414 in total), with the
same totals and exception lines. environment.sol and external_calls.sol
now also record the `BUG: static call to this_address …` diagnostic they
print.

internal_calls.sol: `depositWrong`'s comment said "Refuted"; its
obligation has been unknown since the fixture was added, which still
means it is not proven. The comment now says "Not proven".

This branch has not been deployed

No deployments
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.

1 participant