From 8931db9f0b0ca57f3ceb8e7410a28085f7bdbe54 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Wed, 10 Jul 2019 11:45:52 +0200 Subject: [PATCH] make-tarball / lib-tests: reduce duplication The misc.nix and systems.nix tests were invoked at three different places. Let's not that. --- lib/tests/release.nix | 15 ++++----------- pkgs/top-level/make-tarball.nix | 17 ++--------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/lib/tests/release.nix b/lib/tests/release.nix index d9a8a0067253..737d142d2532 100644 --- a/lib/tests/release.nix +++ b/lib/tests/release.nix @@ -1,11 +1,9 @@ { pkgs ? import ((import ../.).cleanSource ../..) {} }: -pkgs.stdenv.mkDerivation { - name = "nixpkgs-lib-tests"; - buildInputs = [ pkgs.nix ]; +pkgs.runCommandNoCC "nixpkgs-lib-tests" { + buildInputs = [ pkgs.nix (import ./check-eval.nix) ]; NIX_PATH="nixpkgs=${pkgs.path}"; - - buildCommand = '' +} '' datadir="${pkgs.nix}/share" export TEST_ROOT=$(pwd)/test-tmp export NIX_BUILD_HOOK= @@ -22,10 +20,5 @@ pkgs.stdenv.mkDerivation { cd ${pkgs.path}/lib/tests bash ./modules.sh - [[ "$(nix-instantiate --eval --strict misc.nix)" == "[ ]" ]] - - [[ "$(nix-instantiate --eval --strict systems.nix)" == "[ ]" ]] - touch $out - ''; -} +'' diff --git a/pkgs/top-level/make-tarball.nix b/pkgs/top-level/make-tarball.nix index a0c99847274a..6f30bd06a81c 100644 --- a/pkgs/top-level/make-tarball.nix +++ b/pkgs/top-level/make-tarball.nix @@ -6,6 +6,7 @@ , officialRelease , pkgs ? import nixpkgs.outPath {} , nix ? pkgs.nix +, lib-tests ? import ../../lib/tests/release.nix { inherit pkgs; } }: with pkgs; @@ -18,7 +19,7 @@ releaseTools.sourceTarball rec { version = pkgs.lib.fileContents ../../.version; versionSuffix = "pre${toString nixpkgs.revCount}.${nixpkgs.shortRev}"; - buildInputs = [ nix.out jq ]; + buildInputs = [ nix.out jq lib-tests ]; configurePhase = '' eval "$preConfigure" @@ -60,20 +61,6 @@ releaseTools.sourceTarball rec { exit 1 fi - # Run the regression tests in `lib'. - if - # `set -e` doesn't work inside here, so need to && instead :( - res="$(nix-instantiate --eval --strict lib/tests/misc.nix --show-trace)" \ - && [[ "$res" == "[ ]" ]] \ - && res="$(nix-instantiate --eval --strict lib/tests/systems.nix --show-trace)" \ - && [[ "$res" == "[ ]" ]] - then - true - else - echo "regression tests for lib failed, got: $res" - exit 1 - fi - # Check that all-packages.nix evaluates on a number of platforms without any warnings. for platform in i686-linux x86_64-linux x86_64-darwin; do header "checking Nixpkgs on $platform"