Skip to content

Commit a5785f0

Browse files
committed
feat: add report generation from JSON
Signed-off-by: James McCorrie <james.mccorrie@lowrisc.org>
1 parent 7ceaaf1 commit a5785f0

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

src/dvsim/cli/main.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,45 @@
44

55
"""DVSim CLI main entry point."""
66

7+
from pathlib import Path
8+
79
import click
810

11+
from dvsim.report.data import ResultsSummary
12+
913

1014
@click.group(invoke_without_command=True)
1115
@click.pass_context
1216
def main(ctx) -> None:
1317
"""Entry point for DVSim."""
1418
if ctx.invoked_subcommand is None:
15-
from dvsim.cli.run import run # noqa: PLC0415
19+
from dvsim.cli.run import run
1620

1721
run()
1822

1923

24+
@main.group()
25+
def report() -> None:
26+
"""Reporting helper commands."""
27+
28+
29+
@report.command()
30+
@click.argument(
31+
"json_path",
32+
type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
33+
)
34+
@click.argument(
35+
"output_dir",
36+
type=click.Path(file_okay=False, dir_okay=True, path_type=Path),
37+
)
38+
def gen(json_path: Path, output_dir: Path) -> None:
39+
"""Generate a report from a existing results JSON."""
40+
from dvsim.report.generate import gen_summary_report
41+
42+
results = ResultsSummary.load(path=json_path)
43+
44+
gen_summary_report(summary=results, path=output_dir)
45+
46+
2047
if __name__ == "__main__":
2148
main()

0 commit comments

Comments
 (0)