From: Peter O. <obe...@us...> - 2009-10-27 16:19:14
|
Update of /cvsroot/ltp/utils/analysis/lcov/bin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15104 Modified Files: geninfo Log Message: lcov: fix problem with matching filename - used correct source for filenames - converted match_filenames to portable version Index: geninfo =================================================================== RCS file: /cvsroot/ltp/utils/analysis/lcov/bin/geninfo,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** geninfo 27 Oct 2009 15:29:41 -0000 1.57 --- geninfo 27 Oct 2009 16:19:05 -0000 1.58 *************** *** 653,656 **** --- 653,657 ---- my $bb_basename; # Basename of the original graph file my $graph; # Contents of graph file + my $instr; # Contents of graph file part 2 my $gcov_error; # Error code of gcov tool my $object_dir; # Directory containing all object files *************** *** 746,759 **** if (defined($compatibility) && $compatibility eq $COMPAT_HAMMER) { ! $graph = read_bbg($bb_filename, $base_dir); } else { ! $graph = read_bb($bb_filename, $base_dir); } } else { ! $graph = read_gcno($bb_filename, $base_dir); } --- 747,760 ---- if (defined($compatibility) && $compatibility eq $COMPAT_HAMMER) { ! ($instr, $graph) = read_bbg($bb_filename, $base_dir); } else { ! ($instr, $graph) = read_bb($bb_filename, $base_dir); } } else { ! ($instr, $graph) = read_gcno($bb_filename, $base_dir); } *************** *** 894,898 **** @matches = match_filename(defined($source) ? $source : ! $gcov_file, keys(%{$graph})); # Skip files that are not mentioned in the graph file --- 895,899 ---- @matches = match_filename(defined($source) ? $source : ! $gcov_file, keys(%{$instr})); # Skip files that are not mentioned in the graph file *************** *** 1146,1171 **** sub match_filename($@) { ! my $filename = shift; ! my @list = @_; my @result; ! $filename =~ s/^(.*).gcov$/$1/; ! ! if ($filename =~ /^\/(.*)$/) ! { ! $filename = "$1"; ! } ! foreach (@list) ! { ! if (/\/\Q$filename\E(.*)$/ && $1 eq "") ! { ! @result = (@result, $_); } } return @result; } - # # solve_ambiguous_match(rel_filename, matches_ref, gcov_content_ref) --- 1147,1186 ---- sub match_filename($@) { ! my ($filename, @list) = @_; ! my ($vol, $dir, $file) = splitpath($filename); ! my @comp = splitdir($dir); ! my $comps = scalar(@comp); ! my $entry; my @result; ! entry: ! foreach $entry (@list) { ! my ($evol, $edir, $efile) = splitpath($entry); ! my @ecomp; ! my $ecomps; ! my $i; ! # Filename component must match ! if ($efile ne $file) { ! next; } + # Check directory components last to first for match + @ecomp = splitdir($edir); + $ecomps = scalar(@ecomp); + if ($ecomps < $comps) { + next; + } + for ($i = 0; $i < $comps; $i++) { + if ($comp[$comps - $i - 1] ne + $ecomp[$ecomps - $i - 1]) { + next entry; + } + } + push(@result, $entry), } + return @result; } # # solve_ambiguous_match(rel_filename, matches_ref, gcov_content_ref) |