diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-02-05 14:11:21 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-02-05 19:18:33 +0100 |
commit | 80647127a3e7e3eaf84dc6ff0af13ff4aaad2e0b (patch) | |
tree | e23432117b0cdfdec490c68e80da1d8e181f7b61 /pkgs/build-support/release | |
parent | bea2b3c5177a9fae5df5598574bd25bca8f6cb09 (diff) |
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 ];
Diffstat (limited to 'pkgs/build-support/release')
-rw-r--r-- | pkgs/build-support/release/default.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/release/nix-build.nix | 29 |
2 files changed, 4 insertions, 27 deletions
diff --git a/pkgs/build-support/release/default.nix b/pkgs/build-support/release/default.nix index 3d593f0b6bb7..acad3487dad2 100644 --- a/pkgs/build-support/release/default.nix +++ b/pkgs/build-support/release/default.nix @@ -27,7 +27,7 @@ rec { } // args); coverageAnalysis = args: nixBuild ( - { inherit lcov; + { inherit lcov enableCoverageInstrumentation makeCoverageAnalysisReport; doCoverageAnalysis = true; } // args); diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix index 88bafd84faa3..42533b0094aa 100644 --- a/pkgs/build-support/release/nix-build.nix +++ b/pkgs/build-support/release/nix-build.nix @@ -15,6 +15,7 @@ , failureHook ? null , prePhases ? [] , postPhases ? [] +, buildInputs ? [] , ... } @ args: stdenv.mkDerivation ( @@ -61,13 +62,6 @@ stdenv.mkDerivation ( . ${./functions.sh} origSrc=$src src=$(findTarballs $src | head -1) - - # Set GCC flags for coverage analysis, if desired. - if test -n "${toString doCoverageAnalysis}"; then - export NIX_CFLAGS_COMPILE="-O0 --coverage $NIX_CFLAGS_COMPILE" - export CFLAGS="-O0" - export CXXFLAGS="-O0" - fi ''; initPhase = '' @@ -85,30 +79,13 @@ stdenv.mkDerivation ( prePhases = ["initPhase"] ++ prePhases; - # In the report phase, create a coverage analysis report. - coverageReportPhase = if doCoverageAnalysis then '' - ${args.lcov}/bin/lcov --directory . --capture --output-file app.info - set -o noglob - ${args.lcov}/bin/lcov --remove app.info $lcovFilter > app2.info - set +o noglob - mv app2.info app.info - - mkdir $out/coverage - ${args.lcov}/bin/genhtml app.info $lcovExtraTraceFiles -o $out/coverage > log - - # Grab the overall coverage percentage for use in release overviews. - grep "Overall coverage rate" log | sed 's/^.*(\(.*\)%).*$/\1/' > $out/nix-support/coverage-rate - - echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products - '' else ""; - + buildInputs = buildInputs ++ [ args.makeCoverageAnalysisReport ]; lcovFilter = ["/nix/store/*"] ++ lcovFilter; inherit lcovExtraTraceFiles; - postPhases = postPhases ++ - (stdenv.lib.optional doCoverageAnalysis "coverageReportPhase") ++ ["finalPhase"]; + postPhases = postPhases ++ ["finalPhase"]; meta = (if args ? meta then args.meta else {}) // { description = if doCoverageAnalysis then "Coverage analysis" else "Nix package for ${stdenv.system}"; |