[igt-dev] [PATCH 12/12] code_cov_parse_info: add support for generating html reports

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Mon Apr 11 15:49:28 UTC 2022


On Mon, 11 Apr 2022 15:15:19 +0200
Andrzej Hajda <andrzej.hajda at intel.com> wrote:

> > +sub generate_report()
> > +{
> > +	my $percent;
> > +	my $prolog = "";
> > +	my $epilog = "";
> > +	my @info_files = sort(keys %report);
> > +
> > +	$title = "Code coverage results" if ($title eq "");
> > +
> > +	if ($html_prolog) {
> > +		open IN, $html_prolog or die "Can't open prolog file";
> > +		$prolog .= $_ while (<IN>);
> > +		close IN;
> > +	}
> > +
> > +	if ($html_prolog) {  
> 
> $html_epilog

OK.

> Lots of code, I have always mixed feelings about code generating html. 
> It's maintainability is quite difficult.
> I am not UI/presentation expert, so it is hard to decide, but if there 
> are no better options (XML/XSLT, perl frameworks to generate reports, 
> ....), lets try it.

I would prefer to avoid using perl frameworks, as this makes harder
to package it, as it would add more dependencies to igt. Also, not
sure if this would actually affect the size, as we still need to store
the results per .info input file, and have the loops there to calculate
percentages.

As the idea here is not to have anything fancier than tables, I
guess the current code won't require too much maintenance. I could 
have opted to output ReST directly (or github-flavored markdown), 
or something as complex as docbook or LaTeX, but html seems more portable
and converting from html to either ReST (or any other markup language) is
as easy as calling pandoc.

Btw, using a text markup language would lose colors, as most markdown
languages don't allow changing font colors (I guess the only text markup
that supports color is asciidoc - which is a little bit odd). The colors
are helpful when trying to analyze the resulting data.

Also, I'm imagining a scenario in the future where CI would place the
output of those reports on some web page. so, producing html sounded
an interesting choice.

Regards,
Mauro


More information about the igt-dev mailing list