Changes in this patch: * Displays baseline filename in header * Added --missing-from-baseline flag * Added clarifying footnotes for differential coverage (only with --legend flag) Index: utils/analysis/lcov/bin/genhtml =================================================================== RCS file: /cvsroot/ltp/utils/analysis/lcov/bin/genhtml,v retrieving revision 1.8 diff -u -r1.8 genhtml --- utils/analysis/lcov/bin/genhtml 8 Mar 2005 14:22:56 -0000 1.8 +++ utils/analysis/lcov/bin/genhtml 10 Apr 2005 05:14:12 -0000 @@ -186,12 +186,17 @@ our $legend; # If set, include legend in output our $tab_size = 8; # Number of spaces to use in place of tab our $config; # Configuration file contents +our $missing_from_baseline; # Only mark lines as un-executed if they + # are executed in the normal run, but are missing + # (not executed) in the baseline. our $cwd = `pwd`; # Current working directory chomp($cwd); our $tool_dir = dirname($0); # Directory where genhtml tool is installed + + # # Code entry point # @@ -237,6 +242,7 @@ "keep-descriptions" => \$keep_descriptions, "css-file=s" => \$css_filename, "baseline-file=s" => \$base_filename, + "missing-from-baseline" => \$missing_from_baseline, "prefix=s" => \$dir_prefix, "num-spaces=i" => \$tab_size, "no-prefix" => \$no_prefix, @@ -368,6 +374,8 @@ -s, --show-details Generate detailed directory view -f, --frames Use HTML frames for source code view -b, --baseline-file BASEFILE Use BASEFILE as baseline file + -m, --missing-from-baseline Lines marked as unexecuted only if executed + in the normal run, but not the baseline -o, --output-directory OUTDIR Write HTML output to OUTDIR -t, --title TITLE Display TITLE in header of all pages -d, --description-file DESCFILE Read test case descriptions from DESCFILE @@ -1590,6 +1598,19 @@ } + /* All views: header footnote format */ + td.headerFootnote + { + text-align: center; + padding-top: 2px; + padding-bottom: 2px; + padding-right: 6px; + color: #000000; + font-family: sans-serif; + font-size: x-small + } + + /* All views: color of horizontal ruler */ td.ruler { @@ -2253,6 +2274,25 @@ # +# write_header_footnote(filehandle, footnote_symbol_1, footnote_text_1, +# footnote_symbol_2, footnote_text_2) +# +# Write a footnote for one of the header lines. +# + +sub write_header_footnote(*$$$$) +{ + write_html($_[0], < + $_[1] $_[2] + + $_[3] $_[4] + +END_OF_HTML + ; +} + +# # write_file_table_prolog(filehandle, left_heading, right_heading) # # Write heading for file table. @@ -2795,6 +2835,9 @@ my $test; my $rate; my $base_name; + my $add_footnotes = $base_filename && $legend; + my $footnote_sym1 = ""; + my $footnote_sym2 = ""; # Calculate coverage rate if ($lines_found>0) @@ -2880,10 +2923,44 @@ write_header_prolog(*HTML_HANDLE, $base_dir); write_header_line(*HTML_HANDLE, "Current view", $view); write_header_line(*HTML_HANDLE, "Test", $test); + if ($base_filename) + { + write_header_line(*HTML_HANDLE, "Baseline", $base_filename); + } write_header_line(*HTML_HANDLE, "Date", $date, "Instrumented lines", $lines_found); - write_header_line(*HTML_HANDLE, "Code covered", $rate, - "Executed lines", $lines_hit); + if ($add_footnotes) + { + # Make footnotes symbols + $footnote_sym1 = "*"; + $footnote_sym2 = ""; + } + write_header_line(*HTML_HANDLE, "Code covered".$footnote_sym1, + $rate, "Executed lines".$footnote_sym2, + $lines_hit); + if ($add_footnotes) + { + # Display body text of footnotes + if ($missing_from_baseline) + { + write_header_footnote(*HTML_HANDLE, $footnote_sym1, + "Percent of the code executed in Test but not ". + "in Baseline", + $footnote_sym2, + "Number of lines that were executed in Test ". + "but not executed in Baseline"); + } + else + { + write_header_footnote(*HTML_HANDLE, $footnote_sym1, + "Percent of the code executed more often in ". + "Test than in Baseline", + $footnote_sym2, + "Number of lines that were executed more often ". + "in Test than in Baseline"); + } + } + if ($legend) { write_header_legend(*HTML_HANDLE, $type); @@ -3162,6 +3239,10 @@ # # subtract_counts(data_ref, base_ref) # +# Subtract base hash from data hash. +# If --missing-from-baseline is used, then give a count of 0 if the +# data hash contains the line and the base hash did not, and 1 +# otherwise. sub subtract_counts($$) { @@ -3183,14 +3264,25 @@ { $data_count -= $base_count; - # Make sure we don't get negative numbers - if ($data_count<0) { $data_count = 0; } + if ($missing_from_baseline) + { + # Set data count (see above) + $data_count = ($base_count == 0 && + $data_count > 0) ? 0 : 1; + } } - - $data{$line} = $data_count; + elsif ($missing_from_baseline) + { + # Line is in data hash and not the base hash + $data_count = 0; + } + + # Make sure we don't get negative numbers + if ($data_count < 0) { $data_count = 0; } if ($data_count > 0) { $hit++; } + $data{$line} = $data_count; } - + return (\%data, $found, $hit); } Index: utils/analysis/lcov/man/genhtml.1 =================================================================== RCS file: /cvsroot/ltp/utils/analysis/lcov/man/genhtml.1,v retrieving revision 1.4 diff -u -r1.4 genhtml.1 --- utils/analysis/lcov/man/genhtml.1 8 Mar 2005 14:22:57 -0000 1.4 +++ utils/analysis/lcov/man/genhtml.1 10 Apr 2005 05:14:12 -0000 @@ -14,6 +14,8 @@ .RB [ \-b | \-\-baseline\-file ] .IR baseline\-file .br +.RB [ \-\-missing\-from\-baseline ] +.br .RB [ \-o | \-\-output\-directory .IR output-directory ] .br @@ -140,6 +142,33 @@ the result is zero. .RE +.BI "\-\-missing\-from\-baseline " +.RS +Lines are marked as unexecuted if and only if they are executed in the +normal run, but not the baseline. + +When the baseline is applied, this flag changes the counts on each +line in the following manner. If the line was run in the original +.IR tracefile , +but not in the +.I baseline\-file +then the line will output with an associated count of 0. Otherwise, +the line count will be 1. Essentially, everything not in the baseline +but still used in the normal run is bad. + +This option is useful for quickly determining what lines are run in +the original +.I tracefile +that are not run in the +.IR baseline\-file . +For example, one might use this to see if a user's usage of the code +is completely covered by an automated suite of tests. + +This option is ignored when not used in conjuction with +.BR \-\-baseline-file . + + +.RE .BI "\-o " output\-directory .br .BI "\-\-output\-directory " output\-directory