@@ -79,6 +79,9 @@ our $lcov_version = 'LCOV version '.`$tool_dir/get_version.sh --version`;
79
79
our $lcov_url = " http://ltp.sourceforge.net/coverage/lcov.php" ;
80
80
our $tool_name = basename($0 );
81
81
82
+ # Specify coverage rate default precision
83
+ our $default_precision = 1;
84
+
82
85
# Specify coverage rate limits (in %) for classifying file entries
83
86
# HI: $hi_limit <= rate <= 100 graph color: green
84
87
# MED: $med_limit <= rate < $hi_limit graph color: orange
@@ -355,6 +358,7 @@ if ($config || %opt_rc)
355
358
" genhtml_html_epilog" => \$html_epilog_file ,
356
359
" genhtml_html_extension" => \$html_ext ,
357
360
" genhtml_html_gzip" => \$html_gzip ,
361
+ " genhtml_precision" => \$default_precision ,
358
362
" genhtml_function_hi_limit" => \$fn_hi_limit ,
359
363
" genhtml_function_med_limit" => \$fn_med_limit ,
360
364
" genhtml_function_coverage" => \$func_coverage ,
@@ -410,6 +414,7 @@ if (!GetOptions("output-directory|o=s" => \$output_directory,
410
414
" ignore-errors=s" => \@opt_ignore_errors ,
411
415
" config-file=s" => \$opt_config_file ,
412
416
" rc=s%" => \%opt_rc ,
417
+ " precision=i" => \$default_precision ,
413
418
))
414
419
{
415
420
print (STDERR " Use $tool_name --help to get usage information\n " );
@@ -533,6 +538,13 @@ if ($demangle_cpp)
533
538
}
534
539
}
535
540
541
+ # Make sure precision is within valid range
542
+ if ($default_precision < 1 || $default_precision > 4)
543
+ {
544
+ die (" ERROR: specified precision is out of range (1 to 4)\n " );
545
+ }
546
+
547
+
536
548
# Make sure output_directory exists, create it if necessary
537
549
if ($output_directory )
538
550
{
@@ -600,6 +612,7 @@ HTML output:
600
612
--html-gzip Use gzip to compress HTML
601
613
--(no-)sort Enable (disable) sorted coverage views
602
614
--demangle-cpp Demangle C++ function names
615
+ --precision NUM Set precision of coverage rate
603
616
604
617
For more information see: $lcov_url
605
618
END_OF_USAGE
@@ -5963,7 +5976,7 @@ sub rate($$;$$$)
5963
5976
my $rate ;
5964
5977
5965
5978
# Assign defaults if necessary
5966
- $precision = 1 if (!defined ($precision ));
5979
+ $precision = $default_precision if (!defined ($precision ));
5967
5980
$suffix = " " if (!defined ($suffix ));
5968
5981
$width = 0 if (!defined ($width ));
5969
5982
0 commit comments