|
From: Peter O. <obe...@us...> - 2012-10-05 11:49:32
|
Update of /cvsroot/ltp/utils/analysis/lcov/bin
In directory vz-cvs-4.sog:/tmp/cvs-serv26619/bin
Modified Files:
geninfo
Log Message:
geninfo: fix problems with adjust_src_path option
Fix the following problems with adjust_src_path:
* specifying --compat libtool=on and geninfo_adjust_src_path
unexpectedly sets --compat libtool=off
* path components that are assembled from sub-directory names are
not correctly adjusted
Index: geninfo
===================================================================
RCS file: /cvsroot/ltp/utils/analysis/lcov/bin/geninfo,v
retrieving revision 1.108
retrieving revision 1.109
diff -C2 -d -r1.108 -r1.109
*** geninfo 5 Oct 2012 08:23:06 -0000 1.108
--- geninfo 5 Oct 2012 11:49:30 -0000 1.109
***************
*** 875,888 ****
($da_dir, $da_basename) = split_filename($da_filename);
! if (defined($adjust_src_pattern)) {
! # Apply transformation as specified by user
! $source_dir = $da_dir;
! $source_dir =~ s/$adjust_src_pattern/$adjust_src_replace/g;
! } elsif (is_compat($COMPAT_MODE_LIBTOOL) &&
! $da_dir =~ m/(.*)\/\.libs$/) {
# Avoid files from .libs dirs
! $source_dir = $1;
! } else {
! $source_dir = $da_dir;
}
--- 875,882 ----
($da_dir, $da_basename) = split_filename($da_filename);
! $source_dir = $da_dir;
! if (is_compat($COMPAT_MODE_LIBTOOL)) {
# Avoid files from .libs dirs
! $source_dir =~ s/\.libs$//;
}
***************
*** 1073,1076 ****
--- 1067,1075 ----
$source = solve_relative_path($base_dir, $source);
+ if (defined($adjust_src_pattern)) {
+ # Apply transformation as specified by user
+ $source =~ s/$adjust_src_pattern/$adjust_src_replace/g;
+ }
+
# gcov will happily create output even if there's no source code
# available - this interferes with checksum creation so we need
***************
*** 2207,2220 ****
($graph_dir, $graph_basename) = split_filename($graph_filename);
! if (defined($adjust_src_pattern)) {
! # Apply transformation as specified by user
! $source_dir = $graph_dir;
! $source_dir =~ s/$adjust_src_pattern/$adjust_src_replace/g;
! } elsif (is_compat($COMPAT_MODE_LIBTOOL) &&
! $graph_dir =~ m/(.*)\/\.libs$/) {
# Avoid files from .libs dirs
! $source_dir = $1;
! } else {
! $source_dir = $graph_dir;
}
--- 2206,2213 ----
($graph_dir, $graph_basename) = split_filename($graph_filename);
! $source_dir = $graph_dir;
! if (is_compat($COMPAT_MODE_LIBTOOL)) {
# Avoid files from .libs dirs
! $source_dir =~ s/\.libs$//;
}
***************
*** 2491,2494 ****
--- 2484,2520 ----
#
+ # adjust_graph_filenames(instr, graph)
+ #
+ # Apply geninfo_adjust_src_path setting to graph file data.
+ #
+
+ sub adjust_graph_filenames($$)
+ {
+ my ($instr, $graph) = @_;
+
+ return ($instr, $graph) if (!defined($adjust_src_pattern));
+
+ foreach my $filename (keys(%{$instr})) {
+ my $old_filename = $filename;
+
+ next if ($filename !~
+ s/$adjust_src_pattern/$adjust_src_replace/g);
+
+ $instr->{$filename} = delete($instr->{$old_filename});
+ }
+
+ foreach my $filename (keys(%{$graph})) {
+ my $old_filename = $filename;
+
+ next if ($filename !~
+ s/$adjust_src_pattern/$adjust_src_replace/g);
+
+ $graph->{$filename} = delete($graph->{$old_filename});
+ }
+
+ return ($instr, $graph);
+ }
+
+ #
# graph_cleanup(graph)
#
***************
*** 2782,2786 ****
graph_cleanup($graph);
! return ($instr, $graph);
open_error:
--- 2808,2812 ----
graph_cleanup($graph);
! return adjust_graph_filenames($instr, $graph);
open_error:
***************
*** 2969,2973 ****
graph_cleanup($graph);
! return ($instr, $graph);
open_error:
--- 2995,2999 ----
graph_cleanup($graph);
! return adjust_graph_filenames($instr, $graph);
open_error:
***************
*** 3277,3281 ****
graph_cleanup($graph);
! return ($instr, $graph);
open_error:
--- 3303,3307 ----
graph_cleanup($graph);
! return adjust_graph_filenames($instr, $graph);
open_error:
|