Skip to content

Refactor HTML/JSON report generation + fix revision information#109

Merged
AlexJones0 merged 3 commits intolowRISC:masterfrom
AlexJones0:report_refactor
Mar 10, 2026
Merged

Refactor HTML/JSON report generation + fix revision information#109
AlexJones0 merged 3 commits intolowRISC:masterfrom
AlexJones0:report_refactor

Conversation

@AlexJones0
Copy link
Contributor

@AlexJones0 AlexJones0 commented Mar 5, 2026

This PR is the third of a series of 4 PRs which aim to fix issues in HTML report generation and add back Markdown CLI reports to DVSim.

This PR refactors and abstracts the HTML/JSON report generation logic in a way that will make it easier to introduce the Markdown CLI reporting in a follow-up PR. It also fixes the storage of revision information (commit, branch, URL) in the stored metadata to better capture the values used in the original DVSim / testplans. Specifically, it distinguishes between the commit (parsed via gitpython) and revision (optional user override for reporting) more clearly, fixing some of the deploy object output, and more clearly defines the shortened commit sha via gitpython.

It is recommended to review commit-by-commit, checking the commit messages for more info. See also this comment on the previous PR for information about revision handling.

@AlexJones0 AlexJones0 force-pushed the report_refactor branch 4 times, most recently from 8d8181e to 62e625f Compare March 10, 2026 11:03
@AlexJones0 AlexJones0 marked this pull request as ready for review March 10, 2026 11:06
@AlexJones0 AlexJones0 force-pushed the report_refactor branch 2 times, most recently from 7af363a to d3b115b Compare March 10, 2026 11:12
gen_block_report(results=flow_result, path=path, version=summary.version)
for renderer in (JsonReportRenderer(), HtmlReportRenderer()):
report_files = renderer.render(summary)
write_report(report_files, path)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to write to disk earlier for the individual files?
At the moment it looks like if there is an error in the template rendering (which can happen if certain values are optional), then we crash without saving any data at all.

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've made this change now in my last two force pushes. I've retained the write_report interface, but each report renderer now takes an optional outdir argument of type Path | None. If that outdir is given, it writes generated artifacts to that path whilst generating. This way we have incremental writes - if templating fails halfway through we will still get some data.

For Markdown (which I will add later), I will just not provide an outdir and so this behaviour will not occur, since we just have the singular markdown output anyhow.

Copy link
Collaborator

@machshev machshev left a comment

Choose a reason for hiding this comment

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

Thanks Alex! Nice improvements.

@AlexJones0 AlexJones0 force-pushed the report_refactor branch 2 times, most recently from cc52d8c to f2ef0ca Compare March 10, 2026 18:05
Refactor the current report handling to more clearly abstract the
details and interface of rendering HTML/JSON reports to artifacts and
then emitting those artifacts. We still take an optional output
directory to allow writing to disk whilst emitting, to account for the
fact that an error might occur during templating, so that we still get
partial results which might be of value. Otherwise we decouple the two.

This will then be more extendible to adding Markdown report formatting,
which will be much more involved than the HTML. It also easily allows us
to add methods to emit the Markdown report to the CLI, instead of just
writing it to disk.

Now that we still generate a "summary" even if we are just generating a
non-primary config, this results in a cleaner abstraction here.

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
This is still a bit messy, because we do not have ideal abstractions in
place for the cfgs/flows. It might also be nice to separate out the
revision info from the IP Meta even more in the future - some of the
abstractions here still feel a bit arbitrary.

This corrects a few issues with regards to current git commit / revision
handling:
 - Report the short commit hash returned by git, not just an arbitrarily
   truncated hash.
 - The deploy commit is now listed correctly, instead of picking up the
   sim_cfg "revision" string which is generally not the same as the
   commit.
 - While the commit hash, branch and URL are used alternatively, the
   overriding "revision" string from the expanded SimCfg is now also
   picked up into IP metadata right now. This will need to be surfaced
   for Markdown reporting later. It currently isn't used in the HTML
   report, but probably should be later.

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
@AlexJones0 AlexJones0 added this pull request to the merge queue Mar 10, 2026
Merged via the queue into lowRISC:master with commit d6d53f6 Mar 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants