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
87 changes: 87 additions & 0 deletions .github/scripts/differential-tests-error-out-on-failures.py
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be better to us jq instead of a python script

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know that the Python script is a bit longer than JQ, but I think that it's more readable than it when it comes to what we're trying to do here :)

Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't that end up in a pretty unreadable CLI?

Copy link
Contributor

@0xRVE 0xRVE Dec 4, 2025

Choose a reason for hiding this comment

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

I didn't try it but I think it should be a simple oneliner.

Better have the test-suite return status e.g. number of tests failed -> 0 means success. IF that is easy to make

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really care
but this do seems to be a bit of an overkill if we can just do

report_file="$1"
if jq -e '
  any(
    .execution_information[]
    | .case_reports[]
    | .mode_execution_reports[]
    | .status.status;
    . == "Failed"
  )
'  $report_file; then
  exit 1
else
  exit 0
fi 

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
"""
This script is used to turn the JSON report produced by the revive differential tests, detecting
failures and exiting with the appropriate code if a failure is encountered.
"""

import json, typing, sys


class Report(typing.TypedDict):
context: "Context"
execution_information: dict["MetadataFilePathString", "MetadataFileReport"]


class MetadataFileReport(typing.TypedDict):
case_reports: dict["CaseIdxString", "CaseReport"]


class CaseReport(typing.TypedDict):
mode_execution_reports: dict["ModeString", "ExecutionReport"]


class ExecutionReport(typing.TypedDict):
status: "TestCaseStatus"


class Context(typing.TypedDict):
Test: "TestContext"


class TestContext(typing.TypedDict):
corpus_configuration: "CorpusConfiguration"


class CorpusConfiguration(typing.TypedDict):
test_specifiers: list["TestSpecifier"]


class CaseStatusSuccess(typing.TypedDict):
status: typing.Literal["Succeeded"]
steps_executed: int


class CaseStatusFailure(typing.TypedDict):
status: typing.Literal["Failed"]
reason: str


class CaseStatusIgnored(typing.TypedDict):
status: typing.Literal["Ignored"]
reason: str


TestCaseStatus = typing.Union[CaseStatusSuccess, CaseStatusFailure, CaseStatusIgnored]
"""A union type of all of the possible statuses that could be reported for a case."""

TestSpecifier = str
"""A test specifier string. For example resolc-compiler-tests/fixtures/solidity/test.json::0::Y+"""

ModeString = str
"""The mode string. For example Y+ >=0.8.13"""

MetadataFilePathString = str
"""The path to a metadata file. For example resolc-compiler-tests/fixtures/solidity/test.json"""

CaseIdxString = str
"""The index of a case as a string. For example '0'"""


def main() -> None:
with open(sys.argv[1], "r") as file:
report: Report = json.load(file)

for _, mode_to_case_mapping in report["execution_information"].items():
for _, case_idx_to_report_mapping in mode_to_case_mapping[
"case_reports"
].items():
for _, execution_report in case_idx_to_report_mapping[
"mode_execution_reports"
].items():
if execution_report["status"]["status"] == "Failed":
exit(1)

exit(0)


if __name__ == "__main__":
main()
5 changes: 4 additions & 1 deletion .github/workflows/tests-evm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: paritytech/revive-differential-tests
ref: 66feb36b4ef2c79415ca8ea765d8235d48dfa8f8
ref: cd6b7969acafbd3c29907e543a9751d886df6d00
path: revive-differential-tests
submodules: recursive
- name: Installing Retester
Expand Down Expand Up @@ -96,6 +96,9 @@ jobs:
with:
header: diff-tests-report-${{ matrix.platform }}
path: report.md
- name: Check for Failures
if: ${{ matrix.platform == 'revive-dev-node-revm-solc' }}
run: ./.github/scripts/differential-tests-error-out-on-failures.py report.json

evm-test-suite:
needs: [preflight]
Expand Down
8 changes: 8 additions & 0 deletions prdoc/pr_10544.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: Check for failures in DT CI
doc:
- audience: Runtime Dev
description: |-
# Description

This is a small PR that makes the CI of the differential testing framework fail if any failure is encountered. We only do this with the `revive-dev-node-revm-solc` target since this is the only target at the moment that has no failures.
crates: []
Loading