diff --git a/src/kontrol/cli.py b/src/kontrol/cli.py index d53514e40..4bbead52c 100644 --- a/src/kontrol/cli.py +++ b/src/kontrol/cli.py @@ -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' ) diff --git a/src/kontrol/foundry.py b/src/kontrol/foundry.py index cbd6f7c4e..21c3aebf8 100644 --- a/src/kontrol/foundry.py +++ b/src/kontrol/foundry.py @@ -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()) ) @@ -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: diff --git a/src/kontrol/options.py b/src/kontrol/options.py index f258e693b..dce08fb02 100644 --- a/src/kontrol/options.py +++ b/src/kontrol/options.py @@ -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 @@ -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, diff --git a/src/kontrol/prove.py b/src/kontrol/prove.py index 5f5e346cd..beed49937 100644 --- a/src/kontrol/prove.py +++ b/src/kontrol/prove.py @@ -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