mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
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).
This commit is contained in:
parent
338f271058
commit
5716345adf
5 changed files with 20 additions and 5 deletions
|
@ -150,6 +150,11 @@
|
||||||
# 'nix.perl-bindings' packages.
|
# 'nix.perl-bindings' packages.
|
||||||
overlay = final: prev: {
|
overlay = final: prev: {
|
||||||
|
|
||||||
|
# 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;
|
||||||
|
|
||||||
nix = with final; with commonDeps pkgs; stdenv.mkDerivation {
|
nix = with final; with commonDeps pkgs; stdenv.mkDerivation {
|
||||||
name = "nix-${version}";
|
name = "nix-${version}";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
@ -158,6 +163,8 @@
|
||||||
|
|
||||||
VERSION_SUFFIX = versionSuffix;
|
VERSION_SUFFIX = versionSuffix;
|
||||||
|
|
||||||
|
OUTER_NIX = mainstream-nix;
|
||||||
|
|
||||||
outputs = [ "out" "dev" "doc" ];
|
outputs = [ "out" "dev" "doc" ];
|
||||||
|
|
||||||
nativeBuildInputs = nativeBuildDeps;
|
nativeBuildInputs = nativeBuildDeps;
|
||||||
|
@ -486,6 +493,8 @@
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "nix";
|
name = "nix";
|
||||||
|
|
||||||
|
OUTER_NIX = mainstream-nix;
|
||||||
|
|
||||||
outputs = [ "out" "dev" "doc" ];
|
outputs = [ "out" "dev" "doc" ];
|
||||||
|
|
||||||
nativeBuildInputs = nativeBuildDeps;
|
nativeBuildInputs = nativeBuildDeps;
|
||||||
|
|
|
@ -57,7 +57,6 @@ clearStore() {
|
||||||
mkdir "$NIX_STORE_DIR"
|
mkdir "$NIX_STORE_DIR"
|
||||||
rm -rf "$NIX_STATE_DIR"
|
rm -rf "$NIX_STATE_DIR"
|
||||||
mkdir "$NIX_STATE_DIR"
|
mkdir "$NIX_STATE_DIR"
|
||||||
nix-store --init
|
|
||||||
clearProfiles
|
clearProfiles
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@ startDaemon() {
|
||||||
# Start the daemon, wait for the socket to appear. !!!
|
# Start the daemon, wait for the socket to appear. !!!
|
||||||
# ‘nix-daemon’ should have an option to fork into the background.
|
# ‘nix-daemon’ should have an option to fork into the background.
|
||||||
rm -f $NIX_STATE_DIR/daemon-socket/socket
|
rm -f $NIX_STATE_DIR/daemon-socket/socket
|
||||||
nix daemon &
|
${NIX_DAEMON_COMMAND:-nix daemon} &
|
||||||
for ((i = 0; i < 30; i++)); do
|
for ((i = 0; i < 30; i++)); do
|
||||||
if [ -e $NIX_DAEMON_SOCKET_PATH ]; then break; fi
|
if [ -e $NIX_DAEMON_SOCKET_PATH ]; then break; fi
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
|
@ -6,7 +6,7 @@ nix_tests = \
|
||||||
gc-auto.sh \
|
gc-auto.sh \
|
||||||
referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \
|
referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \
|
||||||
gc-runtime.sh check-refs.sh filter-source.sh \
|
gc-runtime.sh check-refs.sh filter-source.sh \
|
||||||
local-store.sh remote-store.sh export.sh export-graph.sh \
|
local-store.sh remote-store.sh remote-store-old-daemon.sh export.sh export-graph.sh \
|
||||||
timeout.sh secure-drv-outputs.sh nix-channel.sh \
|
timeout.sh secure-drv-outputs.sh nix-channel.sh \
|
||||||
multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \
|
multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \
|
||||||
binary-cache.sh \
|
binary-cache.sh \
|
||||||
|
|
7
tests/remote-store-old-daemon.sh
Normal file
7
tests/remote-store-old-daemon.sh
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Test that the new Nix can properly talk to an old daemon.
|
||||||
|
# If `$OUTER_NIX` isn't set (e.g. when bootsraping), just skip this test
|
||||||
|
|
||||||
|
if [[ -n "$OUTER_NIX" ]]; then
|
||||||
|
export NIX_DAEMON_COMMAND=$OUTER_NIX/bin/nix-daemon
|
||||||
|
source remote-store.sh
|
||||||
|
fi
|
|
@ -23,12 +23,12 @@ startDaemon
|
||||||
|
|
||||||
storeCleared=1 NIX_REMOTE_=$NIX_REMOTE $SHELL ./user-envs.sh
|
storeCleared=1 NIX_REMOTE_=$NIX_REMOTE $SHELL ./user-envs.sh
|
||||||
|
|
||||||
|
nix-store --gc --max-freed 1K
|
||||||
|
|
||||||
nix-store --dump-db > $TEST_ROOT/d1
|
nix-store --dump-db > $TEST_ROOT/d1
|
||||||
NIX_REMOTE= nix-store --dump-db > $TEST_ROOT/d2
|
NIX_REMOTE= nix-store --dump-db > $TEST_ROOT/d2
|
||||||
cmp $TEST_ROOT/d1 $TEST_ROOT/d2
|
cmp $TEST_ROOT/d1 $TEST_ROOT/d2
|
||||||
|
|
||||||
nix-store --gc --max-freed 1K
|
|
||||||
|
|
||||||
killDaemon
|
killDaemon
|
||||||
|
|
||||||
user=$(whoami)
|
user=$(whoami)
|
||||||
|
|
Loading…
Reference in a new issue