Skip to content

Commit 1453a3e

Browse files
committed
Add "genhtml --no-html ..." option to suppress the HTML report - and just
execute the various side effects - serialized DB, criteria check, text summary, etc. Signed-off-by: Henry Cox <[email protected]>
1 parent 9105349 commit 1453a3e

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

bin/genhtml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5828,7 +5828,7 @@ sub _segment_worklist
58285828
}
58295829

58305830
my $p = File::Spec->catdir($main::output_directory, $rel_dir);
5831-
File::Path::make_path($p) unless -d $p;
5831+
File::Path::make_path($p) unless -d $p || $main::no_html;
58325832
my $base_dir = main::get_relative_base_path($rel_dir);
58335833
my $trunc_dir = ($rel_dir eq '') ? 'root' : $rel_dir;
58345834

@@ -6196,6 +6196,7 @@ our $suppress_function_aliases; # if set, don't show list of collapsed
61966196
# function aliases
61976197
our $merge_function_aliases;
61986198
our $no_sourceview; # If set, do not create a source code view for each file
6199+
our $no_html; # don't generate HTML if set
61996200
our $legend; # If set, include legend in output
62006201
our $tab_size = 8; # Number of spaces to use in place of tab
62016202
our $html_prolog_file; # Custom HTML prolog file (up to and including <body>)
@@ -6321,6 +6322,7 @@ my %genhtml_options = ("output-directory|o=s" => \$output_directory,
63216322
"num-spaces=i" => \$tab_size,
63226323
"no-prefix" => \$no_prefix,
63236324
"no-sourceview" => \$no_sourceview,
6325+
'no-html' => \$no_html,
63246326
"show-details|s" => \$show_details,
63256327
"frames|f" => \$frames,
63266328
"highlight" => \$deprecated_highlight,
@@ -6357,6 +6359,7 @@ lcovutil::ignorable_error($lcovutil::ERROR_DEPRECATED,
63576359
"option '--highlight' has been removed.")
63586360
if ($deprecated_highlight);
63596361
$buildSerializableDatabase = 1 if $serialize;
6362+
$no_sourceview = 1 if $no_html;
63606363

63616364
# Copy related values if not specified
63626365
$ln_hi_limit = $hi_limit if (!defined($ln_hi_limit));
@@ -6967,10 +6970,11 @@ sub gen_html()
69676970
}
69686971
}
69696972

6970-
info(1, "Writing .css and .png files.\n");
6971-
write_css_file();
6972-
write_png_files();
6973-
6973+
unless ($no_html) {
6974+
info(1, "Writing .css and .png files.\n");
6975+
write_css_file();
6976+
write_png_files();
6977+
}
69746978
if ($html_gzip) {
69756979
info(1, "Writing .htaccess file.\n");
69766980
write_htaccess_file();
@@ -7072,6 +7076,7 @@ sub write_summary_pages($$$$$$$$)
70727076
$summary->remove_source($c);
70737077
}
70747078
}
7079+
return if $main::no_html;
70757080
if (0 == $summary->sources() && $summaryType == 1) {
70767081
# remove empty directory
70777082
push(@cleanDirectoryList, $rel_dir);

man/genhtml.1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ genhtml \- Generate HTML view from LCOV coverage data files
5454
.IR dirname ]
5555
.br
5656
.RB [ \-\-no\-source ]
57+
.RB [ \-\-no\-html ]
58+
.br
5759
.RB [ \-\-num\-spaces
5860
.IR num ]
5961
.RB [ \-\-highlight ]
@@ -2445,6 +2447,18 @@ This option can also be configured permanently using the configuration file
24452447
option
24462448
.IR genhtml_no_source .
24472449

2450+
.RE
2451+
.B \-\-no\-html
2452+
.RS
2453+
Do not create HTML report.
2454+
2455+
Use this switch if you want some artifact of coverage report generation -
2456+
.I e.g.,
2457+
the coverage criteria check or the serialized coverage DB,
2458+
.B etc.
2459+
- but do not need teh coverage report HTML itself.
2460+
2461+
24482462
.RE
24492463
.BI "\-\-num\-spaces " spaces
24502464
.RS

0 commit comments

Comments
 (0)