From 02a186883bdbbdf52523e0ef868d8cbeaed5aa9b Mon Sep 17 00:00:00 2001 From: regnat Date: Tue, 10 Nov 2020 10:43:33 +0100 Subject: [PATCH] Add a test ensuring compatibility with an old daemon This requires adding `nix` to its own closure which is a bit unfortunate, but as it is optional (the test will be disabled if `OUTER_NIX` is unset) it shouldn't be too much of an issue. (Ideally this should go in another derivation so that we can build Nix and run the test independently, but as the tests are running in the same derivation as the build it's a bit complicated to do so). (cherry picked from commit 5716345adf2e794fd62229ea52352e74e92e8e63) --- tests/common.sh.in | 3 +-- tests/remote-store.sh | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/common.sh.in b/tests/common.sh.in index e8233bf72..09f0c1c32 100644 --- a/tests/common.sh.in +++ b/tests/common.sh.in @@ -55,7 +55,6 @@ clearStore() { mkdir "$NIX_STORE_DIR" rm -rf "$NIX_STATE_DIR" mkdir "$NIX_STATE_DIR" - nix-store --init clearProfiles } @@ -71,7 +70,7 @@ startDaemon() { # Start the daemon, wait for the socket to appear. !!! # ‘nix-daemon’ should have an option to fork into the background. rm -f $NIX_STATE_DIR/daemon-socket/socket - nix-daemon & + ${NIX_DAEMON_COMMAND:-nix-daemon} & for ((i = 0; i < 30; i++)); do if [ -e $NIX_DAEMON_SOCKET_PATH ]; then break; fi sleep 1 diff --git a/tests/remote-store.sh b/tests/remote-store.sh index 4cc73465a..78353c959 100644 --- a/tests/remote-store.sh +++ b/tests/remote-store.sh @@ -6,12 +6,12 @@ startDaemon storeCleared=1 NIX_REMOTE_=$NIX_REMOTE $SHELL ./user-envs.sh +nix-store --gc --max-freed 1K + nix-store --dump-db > $TEST_ROOT/d1 NIX_REMOTE= nix-store --dump-db > $TEST_ROOT/d2 cmp $TEST_ROOT/d1 $TEST_ROOT/d2 -nix-store --gc --max-freed 1K - killDaemon user=$(whoami)