Skip to content

Commit

Permalink
Add xml-test-report-name flag
Browse files Browse the repository at this point in the history
  • Loading branch information
anvacaru committed Jan 20, 2025
1 parent f8af9ae commit 20bcbd7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/kontrol/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,12 @@ def parse(s: str) -> list[T]:
action='store_true',
help='Generate a JUnit XML report',
)
prove_args.add_argument(
'--xml-test-report-name',
dest='xml_test_report_name',
default=None,
help='Specify the filename for the JUnit XML report',
)
prove_args.add_argument(
'--cse', dest='cse', action='store_true', default=None, help='Use Compositional Symbolic Execution'
)
Expand Down
4 changes: 2 additions & 2 deletions src/kontrol/foundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ def foundry_list(foundry: Foundry) -> list[str]:
return lines


def foundry_to_xml(foundry: Foundry, proofs: list[APRProof]) -> None:
def foundry_to_xml(foundry: Foundry, proofs: list[APRProof], report_name: str) -> None:
testsuites = Et.Element(
'testsuites', tests='0', failures='0', errors='0', time='0', timestamp=str(datetime.datetime.now())
)
Expand Down Expand Up @@ -1108,7 +1108,7 @@ def foundry_to_xml(foundry: Foundry, proofs: list[APRProof]) -> None:
testsuites.set('time', str(total_exec_time))
tree = Et.ElementTree(testsuites)
Et.indent(tree, space='\t', level=0)
tree.write('kontrol_prove_report.xml')
tree.write(report_name)


def foundry_minimize_proof(foundry: Foundry, options: MinimizeProofOptions) -> None:
Expand Down
2 changes: 2 additions & 0 deletions src/kontrol/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ class ProveOptions(
include_summaries: list[tuple[str, int | None]]
with_non_general_state: bool
xml_test_report: bool
xml_test_report_name: str
cse: bool
hevm: bool
minimize_proofs: bool
Expand Down Expand Up @@ -411,6 +412,7 @@ def default() -> dict[str, Any]:
'include_summaries': [],
'with_non_general_state': False,
'xml_test_report': False,
'xml_test_report_name': 'kontrol_prove_report.xml',
'cse': False,
'hevm': False,
'minimize_proofs': False,
Expand Down
2 changes: 1 addition & 1 deletion src/kontrol/prove.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def _run_prover(_test_suite: list[FoundryTest], include_summaries: bool = False)
test_results = _run_prover(test_suite, include_summaries=True)

if options.xml_test_report:
foundry_to_xml(foundry, constructor_results + setup_results + test_results)
foundry_to_xml(foundry, constructor_results + setup_results + test_results, options.xml_test_report_name)

return test_results

Expand Down

0 comments on commit 20bcbd7

Please sign in to comment.