* Updated the coverage analysis handling for Linux 2.6.32. Gcov is

now merged in the kernel, and the gcda files are exported through
  debugfs in /sys/kernel/debug/gcov.

svn path=/nixos/trunk/; revision=19207
This commit is contained in:
Eelco Dolstra 2010-01-04 13:22:43 +00:00
parent 13878cb78d
commit 9aa0a336bc
3 changed files with 14 additions and 9 deletions

View File

@ -26,7 +26,9 @@ sub runTests {
# Copy the kernel coverage data for each machine, if the kernel
# has been compiled with coverage instrumentation.
foreach my $vm (values %vms) {
my ($status, $out) = $vm->execute("test -e /proc/gcov");
my $gcovDir = "/sys/kernel/debug/gcov";
my ($status, $out) = $vm->execute("test -e $gcovDir");
next if $status != 0;
# Figure out where to put the *.gcda files so that the report
@ -35,13 +37,8 @@ sub runTests {
chomp $kernelDir;
my $coverageDir = "/hostfs" . $vm->stateDir() . "/coverage-data/$kernelDir";
# Copy all the *.gcda files. The ones under
# /proc/gcov/module/nix/store are the kernel modules in the
# initrd to which we have applied nuke-refs in
# makeModuleClosure. This confuses the gcov module a bit.
$vm->execute("for i in \$(cd /proc/gcov && find -name module -prune -o -name '*.gcda'); do echo \$i; mkdir -p $coverageDir/\$(dirname \$i); cp -v /proc/gcov/\$i $coverageDir/\$i; done");
$vm->execute("for i in \$(cd /proc/gcov/module/nix/store/*/.build/* && find -name module -prune -o -name '*.gcda'); do mkdir -p $coverageDir/\$(dirname \$i); cp /proc/gcov/module/nix/store/*/.build/*/\$i $coverageDir/\$i; done");
# Copy all the *.gcda files.
$vm->execute("for d in $gcovDir/nix/store/*/.build/linux-*; do for i in \$(cd \$d && find -name '*.gcda'); do echo \$i; mkdir -p $coverageDir/\$(dirname \$i); cp -v \$d/\$i $coverageDir/\$i; done; done");
}
}

View File

@ -36,6 +36,10 @@ with pkgs.lib;
mkdir /hostfs/$hostTmpDir/coverage-data
ln -s /hostfs/$hostTmpDir/coverage-data /tmp/coverage-data
)
# Mount debugfs to gain access to the kernel coverage data (if
# available).
mount -t debugfs none /sys/kernel/debug || true
'';
# If the kernel has been built with coverage instrumentation, make

View File

@ -27,7 +27,11 @@ let
# special patch to make coverage data available under /proc.
kernel = pkgs.kernel.override (orig: {
stdenv = cleanupBuildTree (keepBuildTree orig.stdenv);
kernelPatches = orig.kernelPatches ++ pkgs.lib.singleton pkgs.kernelPatches.gcov_2_6_28;
extraConfig =
''
GCOV_KERNEL y
GCOV_PROFILE_ALL y
'';
});
};