Move generation of coverage reports from nixos/lib/testing to releaseTools

Also, turn some stdenv adapters into setup hooks.
This commit is contained in:
Eelco Dolstra
2014-03-03 13:57:08 +01:00
parent ad7c518e45
commit 497997cc38
11 changed files with 94 additions and 97 deletions
@@ -1,3 +1,5 @@
postPhases+=" cleanupBuildDir"
# Force GCC to build with coverage instrumentation. Also disable
# optimisation, since it may confuse things.
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -O0 --coverage"
@@ -12,3 +14,18 @@ postUnpack() {
substituteInPlace $i --replace '*.$objext)' '*.$objext | *.gcno)'
done
}
# Get rid of everything that isn't a gcno file or a C source file.
# Also strip the `.tmp_' prefix from gcno files. (The Linux kernel
# creates these.)
cleanupBuildDir() {
if ! [ -e $out/.build ]; then return; fi
find $out/.build/ -type f -a ! \
\( -name "*.c" -o -name "*.cc" -o -name "*.cpp" -o -name "*.h" -o -name "*.hh" -o -name "*.y" -o -name "*.l" -o -name "*.gcno" \) \
| xargs rm -f --
for i in $(find $out/.build/ -name ".tmp_*.gcno"); do
mv "$i" "$(echo $i | sed s/.tmp_//)"
done
}
@@ -0,0 +1,6 @@
prePhases+=" moveBuildDir"
moveBuildDir() {
mkdir -p $out/.build
cd $out/.build
}