biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / build-support / setup-hooks / make-coverage-analysis-report.sh
blobd6a03019dc51a6836eee2611f78f6a7dc8581cf5
1 appendToVar postPhases coverageReportPhase
3 coverageReportPhase() {
4 lcov --directory . --capture --output-file app.info
5 set -o noglob
6 lcov --remove app.info ${lcovFilter:-"/nix/store/*"} > app2.info
7 set +o noglob
8 mv app2.info app.info
10 mkdir -p $out/coverage
11 genhtml app.info $lcovExtraTraceFiles -o $out/coverage > log
13 # Grab the overall coverage percentage so that Hydra can plot it over time.
14 mkdir -p $out/nix-support
15 lineCoverage="$(sed 's/.*lines\.*: \([0-9\.]\+\)%.*/\1/; t ; d' log)"
16 functionCoverage="$(sed 's/.*functions\.*: \([0-9\.]\+\)%.*/\1/; t ; d' log)"
17 if [ -z "$lineCoverage" -o -z "$functionCoverage" ]; then
18 echo "failed to get coverage statistics"
19 exit 1
21 echo "lineCoverage $lineCoverage %" >> $out/nix-support/hydra-metrics
22 echo "functionCoverage $functionCoverage %" >> $out/nix-support/hydra-metrics
24 echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products