mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 08:12:29 +00:00
Split the gc-external-daemon test
Improve parallelism a bit
This commit is contained in:
parent
d68268706e
commit
21efcb7b61
@ -19,6 +19,7 @@ export NIX_STATE_DIR=$TEST_ROOT/var/nix
|
||||
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||
export NIX_DAEMON_SOCKET_PATH=$TEST_ROOT/dSocket
|
||||
unset NIX_USER_CONF_FILES
|
||||
export NIX_GC_SOCKET_PATH=$TEST_ROOT/gc.socket
|
||||
export _NIX_TEST_SHARED=$TEST_ROOT/shared
|
||||
if [[ -n $NIX_STORE ]]; then
|
||||
export _NIX_TEST_NO_SANDBOX=1
|
||||
@ -152,6 +153,35 @@ restartDaemon() {
|
||||
startDaemon
|
||||
}
|
||||
|
||||
startGcDaemon() {
|
||||
# Start the daemon, wait for the socket to appear. !!!
|
||||
# ‘nix-daemon’ should have an option to fork into the background.
|
||||
rm -f $NIX_GC_SOCKET_PATH
|
||||
$(dirname $(command -v nix))/../libexec/nix/nix-find-roots \
|
||||
-l "$NIX_GC_SOCKET_PATH" \
|
||||
-d "$NIX_STATE_DIR" \
|
||||
-s "$NIX_STORE_DIR" \
|
||||
&
|
||||
for ((i = 0; i < 30; i++)); do
|
||||
if [[ -S $NIX_GC_SOCKET_PATH ]]; then break; fi
|
||||
sleep 1
|
||||
done
|
||||
pidGcDaemon=$!
|
||||
trapFunctions[killGcDaemon]=killGcDaemon
|
||||
}
|
||||
|
||||
killGcDaemon() {
|
||||
kill $pidGcDaemon
|
||||
for i in {0..10}; do
|
||||
kill -0 $pidGcDaemon || break
|
||||
sleep 1
|
||||
done
|
||||
kill -9 $pidGcDaemon || true
|
||||
wait $pidGcDaemon || true
|
||||
trapFunctions[killGcDaemon]=:
|
||||
}
|
||||
|
||||
|
||||
if [[ $(uname) == Linux ]] && [[ -L /proc/self/ns/user ]] && unshare --user true; then
|
||||
_canUseSandbox=1
|
||||
fi
|
||||
|
@ -18,7 +18,7 @@ nix_tests = \
|
||||
flakes/flake-in-submodule.sh \
|
||||
gc.sh \
|
||||
nix-collect-garbage-d.sh \
|
||||
gc-external-daemon.sh \
|
||||
gc-external-daemon/gc.sh \
|
||||
remote-store.sh \
|
||||
legacy-ssh-store.sh \
|
||||
lang.sh \
|
||||
@ -26,18 +26,21 @@ nix_tests = \
|
||||
experimental-features.sh \
|
||||
fetchMercurial.sh \
|
||||
gc-auto.sh \
|
||||
gc-external-daemon/gc-auto.sh \
|
||||
user-envs.sh \
|
||||
user-envs-migration.sh \
|
||||
binary-cache.sh \
|
||||
multiple-outputs.sh \
|
||||
nix-build.sh \
|
||||
gc-concurrent.sh \
|
||||
gc-external-daemon/gc-concurrent.sh \
|
||||
repair.sh \
|
||||
fixed.sh \
|
||||
export-graph.sh \
|
||||
timeout.sh \
|
||||
fetchGitRefs.sh \
|
||||
gc-runtime.sh \
|
||||
gc-external-daemon/gc-runtime.sh \
|
||||
tarball.sh \
|
||||
fetchGit.sh \
|
||||
fetchurl.sh \
|
||||
|
@ -1,39 +0,0 @@
|
||||
source common.sh
|
||||
|
||||
enableFeatures "external-gc-daemon"
|
||||
|
||||
export NIX_GC_SOCKET_PATH=$TEST_ROOT/gc.socket
|
||||
startGcDaemon() {
|
||||
# Start the daemon, wait for the socket to appear. !!!
|
||||
# ‘nix-daemon’ should have an option to fork into the background.
|
||||
rm -f $NIX_GC_SOCKET_PATH
|
||||
$(dirname $(command -v nix))/../libexec/nix/nix-find-roots \
|
||||
-l "$NIX_GC_SOCKET_PATH" \
|
||||
-d "$NIX_STATE_DIR" \
|
||||
-s "$NIX_STORE_DIR" \
|
||||
&
|
||||
for ((i = 0; i < 30; i++)); do
|
||||
if [[ -S $NIX_GC_SOCKET_PATH ]]; then break; fi
|
||||
sleep 1
|
||||
done
|
||||
pidGcDaemon=$!
|
||||
trapFunctions[killGcDaemon]=killGcDaemon
|
||||
}
|
||||
|
||||
killGcDaemon() {
|
||||
kill $pidGcDaemon
|
||||
for i in {0..10}; do
|
||||
kill -0 $pidGcDaemon || break
|
||||
sleep 1
|
||||
done
|
||||
kill -9 $pidGcDaemon || true
|
||||
wait $pidGcDaemon || true
|
||||
trapFunctions[killGcDaemon]=:
|
||||
}
|
||||
|
||||
startGcDaemon
|
||||
|
||||
source ./gc.sh
|
||||
source ./gc-concurrent.sh
|
||||
source ./gc-runtime.sh
|
||||
source ./gc-auto.sh
|
5
tests/gc-external-daemon/common.sh
Normal file
5
tests/gc-external-daemon/common.sh
Normal file
@ -0,0 +1,5 @@
|
||||
source ../common.sh
|
||||
|
||||
enableFeatures "external-gc-daemon"
|
||||
|
||||
startGcDaemon
|
5
tests/gc-external-daemon/gc-auto.sh
Normal file
5
tests/gc-external-daemon/gc-auto.sh
Normal file
@ -0,0 +1,5 @@
|
||||
source common.sh
|
||||
|
||||
cd ..
|
||||
source ./gc-auto.sh
|
||||
|
4
tests/gc-external-daemon/gc-concurrent.sh
Normal file
4
tests/gc-external-daemon/gc-concurrent.sh
Normal file
@ -0,0 +1,4 @@
|
||||
source common.sh
|
||||
|
||||
cd ..
|
||||
source ./gc-concurrent.sh
|
5
tests/gc-external-daemon/gc-runtime.sh
Normal file
5
tests/gc-external-daemon/gc-runtime.sh
Normal file
@ -0,0 +1,5 @@
|
||||
source common.sh
|
||||
|
||||
cd ..
|
||||
source ./gc-runtime.sh
|
||||
|
4
tests/gc-external-daemon/gc.sh
Normal file
4
tests/gc-external-daemon/gc.sh
Normal file
@ -0,0 +1,4 @@
|
||||
source common.sh
|
||||
|
||||
cd ..
|
||||
source ./gc.sh
|
Loading…
Reference in New Issue
Block a user