[igt-dev] [PATCH] code_cov_parse_info: output filters at the html report
Kamil Konieczny
kamil.konieczny at linux.intel.com
Wed Jun 1 16:11:41 UTC 2022
On 2022-05-20 at 10:36:15 +0200, Mauro Carvalho Chehab wrote:
> From: Mauro Carvalho Chehab <mchehab at kernel.org>
>
> Add a line after the code coverage summary printing the filters
> that were used to produce the results, if any.
>
> This is important specially when multiple filters could be used
> to produce different reports.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
> ---
> scripts/code_cov_parse_info | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/code_cov_parse_info b/scripts/code_cov_parse_info
> index 77291eb69405..09f9aba5760b 100755
> --- a/scripts/code_cov_parse_info
> +++ b/scripts/code_cov_parse_info
> @@ -538,8 +538,9 @@ my $html_prolog;
> my $html_epilog;
> my %report;
>
> -sub generate_report()
> +sub generate_report($)
> {
> + my $filter_str = shift;
> my $percent;
> my $prolog = "";
> my $epilog = "";
> @@ -715,6 +716,12 @@ sub generate_report()
> }
> print OUT " </tr>\n</table><p/>\n\n";
>
> + if ($filter_str ne "") {
> + printf OUT "<p>Filters: %s.</p>\n", $filter_str;
> + } else {
> + print OUT "<p>(unfiltered results)</p>";
> + }
> +
> if ($total > 1) {
> print OUT "<h2>Tests coverage</h2>\n";
>
> @@ -904,8 +911,10 @@ foreach my $f (@ARGV) {
> }
> }
>
> +$filter_str =~ s/(.*),/$1 and/ if ($filter_str ne "");
> +
> if ($gen_report) {
> - generate_report();
> + generate_report($filter_str);
> exit 0;
> }
>
> @@ -920,7 +929,6 @@ print_summary() if ($stat);
> if ($has_filter) {
> my $percent = 100. * $stats{"used_files"} / $stats{"all_files"};
>
> - $filter_str =~ s/(.*),/$1 and/;
> printf "Filters......:%s.\n", $filter_str;
> printf "Source files.: %.2f%% (%d of %d total)",
> $percent, $stats{"used_files"}, $stats{"all_files"};
> --
> 2.36.1
>
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
More information about the igt-dev
mailing list