Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add xml-test-report-name flag #935

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
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
Loading