* Clean up the coverage report in the case where absolute paths are

used in the *.gcno files.

svn path=/nixpkgs/trunk/; revision=16925
This commit is contained in:
Eelco Dolstra 2009-09-02 09:37:52 +00:00
parent f782f14e58
commit 4c89d4f833

View File

@ -1,6 +1,6 @@
diff -x '*~' -rc lcov-1.7-orig/bin/geninfo lcov-1.7/bin/geninfo diff --exclude '*~' -rc lcov-1.7-orig/bin/geninfo lcov-1.7/bin/geninfo
*** lcov-1.7-orig/bin/geninfo 2008-11-17 14:50:26.000000000 +0100 *** lcov-1.7-orig/bin/geninfo 2008-11-17 14:50:26.000000000 +0100
--- lcov-1.7/bin/geninfo 2009-08-28 18:33:21.000000000 +0200 --- lcov-1.7/bin/geninfo 2009-09-02 10:55:25.000000000 +0200
*************** ***************
*** 51,56 **** *** 51,56 ****
--- 51,57 ---- --- 51,57 ----
@ -83,7 +83,7 @@ diff -x '*~' -rc lcov-1.7-orig/bin/geninfo lcov-1.7/bin/geninfo
@result = read_gcov_file($gcov_file); @result = read_gcov_file($gcov_file);
*************** ***************
*** 949,954 **** *** 949,954 ****
--- 955,974 ---- --- 955,979 ----
} }
@ -91,6 +91,11 @@ diff -x '*~' -rc lcov-1.7-orig/bin/geninfo lcov-1.7/bin/geninfo
+ { + {
+ my ($base_dir, $source) = @_; + my ($base_dir, $source) = @_;
+ my $dir = $base_dir; + my $dir = $base_dir;
+
+ # Hack to make absolute paths work on Nixpkgs coverage
+ # reports. The source is in /nix/store/<bla>/.build/<bla>.
+ $source = $1 if $source =~ /^\/.*\/\.build\/(.*)$/;
+
+ while (!-e "$dir/$source") { + while (!-e "$dir/$source") {
+ $dir = $dir . "/.."; + $dir = $dir . "/..";
+ if (length $dir > 1000) { + if (length $dir > 1000) {
@ -113,7 +118,7 @@ diff -x '*~' -rc lcov-1.7-orig/bin/geninfo lcov-1.7/bin/geninfo
read(INPUT, $packed_word, 4); read(INPUT, $packed_word, 4);
$lineno = unpack_int32($packed_word, $endianness); $lineno = unpack_int32($packed_word, $endianness);
--- 1498,1504 ---- --- 1503,1509 ----
$function_name =~ s/\W/_/g; $function_name =~ s/\W/_/g;
(undef, $filename) = (undef, $filename) =
read_gcno_string(*INPUT, $endianness); read_gcno_string(*INPUT, $endianness);
@ -130,7 +135,7 @@ diff -x '*~' -rc lcov-1.7-orig/bin/geninfo lcov-1.7/bin/geninfo
$base_dir, $filename); $base_dir, $filename);
if (!defined($result{$filename})) if (!defined($result{$filename}))
{ {
--- 1550,1556 ---- --- 1555,1561 ----
} }
if ($blocks > 1) if ($blocks > 1)
{ {