Skip to content
Snippets Groups Projects
Commit a0866c8e authored by regnat's avatar regnat
Browse files

Make the tests (optionnally) run in another derivation

That way we can run them without rebuilding Nix
parent eab9cdbd
No related branches found
No related tags found
No related merge requests found
......@@ -144,6 +144,32 @@
echo "file installer $out/install" >> $out/nix-support/hydra-build-products
'';
testNixVersions = pkgs: client: daemon: with commonDeps pkgs; pkgs.stdenv.mkDerivation {
NIX_DAEMON_PACKAGE = daemon;
NIX_CLIENT_PACKAGE = client;
name = "nix-tests-${client.version}-against-${daemon.version}";
inherit version;
src = self;
VERSION_SUFFIX = versionSuffix;
nativeBuildInputs = nativeBuildDeps;
buildInputs = buildDeps ++ awsDeps;
propagatedBuildInputs = propagatedDeps;
enableParallelBuilding = true;
dontBuild = true;
doInstallCheck = true;
installPhase = ''
mkdir -p $out
'';
installCheckPhase = "make installcheck";
};
in {
# A Nixpkgs overlay that overrides the 'nix' and
......@@ -153,7 +179,7 @@
# An older version of Nix to test against when using the daemon.
# Currently using `nixUnstable` as the stable one doesn't respect
# `NIX_DAEMON_SOCKET_PATH` which is needed for the tests.
mainstream-nix = prev.nixUnstable;
nixStable = prev.nix;
nix = with final; with commonDeps pkgs; stdenv.mkDerivation {
name = "nix-${version}";
......@@ -163,8 +189,6 @@
VERSION_SUFFIX = versionSuffix;
OUTER_NIX = mainstream-nix;
outputs = [ "out" "dev" "doc" ];
nativeBuildInputs = nativeBuildDeps;
......@@ -441,6 +465,15 @@
checks = forAllSystems (system: {
binaryTarball = self.hydraJobs.binaryTarball.${system};
perlBindings = self.hydraJobs.perlBindings.${system};
installTests =
let pkgs = nixpkgsFor.${system}; in
pkgs.runCommand "install-tests" {
againstSelf = testNixVersions pkgs pkgs.nix pkgs.pkgs.nix;
againstCurrentUnstable = testNixVersions pkgs pkgs.nix pkgs.nixUnstable;
# Disabled because the latest stable version doesn't handle
# `NIX_DAEMON_SOCKET_PATH` which is required for the tests to work
# againstLatestStable = testNixVersions pkgs pkgs.nix pkgs.nixStable;
} "touch $out";
});
packages = forAllSystems (system: {
......@@ -493,8 +526,6 @@
stdenv.mkDerivation {
name = "nix";
OUTER_NIX = mainstream-nix;
outputs = [ "out" "dev" "doc" ];
nativeBuildInputs = nativeBuildDeps;
......
......@@ -29,6 +29,12 @@ unset XDG_CACHE_HOME
mkdir -p $TEST_HOME
export PATH=@bindir@:$PATH
if [[ -n "${NIX_CLIENT_PACKAGE:-}" ]]; then
export PATH="$NIX_CLIENT_PACKAGE/bin":$PATH
fi
if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
export NIX_DAEMON_COMMAND="$NIX_DAEMON_PACKAGE/bin/nix-daemon"
fi
coreutils=@coreutils@
export dot=@dot@
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment