Turn the coverage analysis stdenv adapters into setup hooks
Stdenv adapters are kinda weird and un-idiomatic (especially when they don't actually change stdenv). It's more idiomatic to say buildInputs = [ makeCoverageAnalysisReport ];
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# Force GCC to build with coverage instrumentation. Also disable
|
||||
# optimisation, since it may confuse things.
|
||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -O0 --coverage"
|
||||
|
||||
# FIXME: Handle the case where postUnpack is already set.
|
||||
postUnpack() {
|
||||
# This is an uberhack to prevent libtool from remoaving gcno
|
||||
# files. This has been fixed in libtool, but there are packages
|
||||
# out there with old ltmain.sh scripts. See
|
||||
# http://www.mail-archive.com/libtool@gnu.org/msg10725.html
|
||||
for i in $(find -name ltmain.sh); do
|
||||
substituteInPlace $i --replace '*.$objext)' '*.$objext | *.gcno)'
|
||||
done
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
postPhases+=" coverageReportPhase"
|
||||
|
||||
coverageReportPhase() {
|
||||
lcov --directory . --capture --output-file app.info
|
||||
set -o noglob
|
||||
lcov --remove app.info $lcovFilter > app2.info
|
||||
set +o noglob
|
||||
mv app2.info app.info
|
||||
|
||||
mkdir -p $out/coverage
|
||||
genhtml app.info $lcovExtraTraceFiles -o $out/coverage > log
|
||||
|
||||
# Grab the overall coverage percentage for use in release overviews.
|
||||
mkdir -p $out/nix-support
|
||||
grep "Overall coverage rate" log | sed 's/^.*(\(.*\)%).*$/\1/' > $out/nix-support/coverage-rate
|
||||
|
||||
echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products
|
||||
}
|
||||
Reference in New Issue
Block a user