* Add a test to check whether concurrent garbage collection (i.e.,
running the collector while builds are in progress) works correctly. The test currently fails.
This commit is contained in:
parent
22cfdfa246
commit
a7668411a1
|
@ -34,10 +34,11 @@ fallback.sh: fallback.nix
|
||||||
nix-push.sh: dependencies.nix
|
nix-push.sh: dependencies.nix
|
||||||
nix-pull.sh: dependencies.nix
|
nix-pull.sh: dependencies.nix
|
||||||
gc.sh: dependencies.nix
|
gc.sh: dependencies.nix
|
||||||
|
gc-concurrent.sh: gc-concurrent.nix
|
||||||
|
|
||||||
TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \
|
TESTS = init.sh hash.sh lang.sh simple.sh dependencies.sh locking.sh parallel.sh \
|
||||||
build-hook.sh substitutes.sh substitutes2.sh fallback.sh nix-push.sh gc.sh \
|
build-hook.sh substitutes.sh substitutes2.sh fallback.sh nix-push.sh gc.sh \
|
||||||
verify.sh nix-pull.sh
|
gc-concurrent.sh verify.sh nix-pull.sh
|
||||||
|
|
||||||
XFAIL_TESTS =
|
XFAIL_TESTS =
|
||||||
|
|
||||||
|
@ -54,5 +55,6 @@ EXTRA_DIST = $(TESTS) \
|
||||||
build-hook.nix.in build-hook.hook.sh \
|
build-hook.nix.in build-hook.hook.sh \
|
||||||
substitutes.nix.in substituter.sh \
|
substitutes.nix.in substituter.sh \
|
||||||
substitutes2.nix.in substituter2.sh \
|
substitutes2.nix.in substituter2.sh \
|
||||||
|
gc-concurrent.nix.in gc-concurrent.builder.sh \
|
||||||
fallback.nix.in \
|
fallback.nix.in \
|
||||||
$(wildcard lang/*.nix) $(wildcard lang/*.exp)
|
$(wildcard lang/*.nix) $(wildcard lang/*.exp)
|
||||||
|
|
9
tests/gc-concurrent.builder.sh
Normal file
9
tests/gc-concurrent.builder.sh
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
export PATH=/bin:/usr/bin:$PATH
|
||||||
|
|
||||||
|
mkdir $out
|
||||||
|
echo $(cat $input1/foo)$(cat $input2/bar) > $out/foobar
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
mkdir $out || true
|
||||||
|
|
||||||
|
ln -s $input2 $out/input-2
|
25
tests/gc-concurrent.nix.in
Normal file
25
tests/gc-concurrent.nix.in
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
let {
|
||||||
|
|
||||||
|
input1 = derivation {
|
||||||
|
name = "dependencies-input-1";
|
||||||
|
system = "@system@";
|
||||||
|
builder = "@shell@";
|
||||||
|
args = ["-e" "-x" ./dependencies.builder1.sh];
|
||||||
|
};
|
||||||
|
|
||||||
|
input2 = derivation {
|
||||||
|
name = "dependencies-input-2";
|
||||||
|
system = "@system@";
|
||||||
|
builder = "@shell@";
|
||||||
|
args = ["-e" "-x" ./dependencies.builder2.sh];
|
||||||
|
};
|
||||||
|
|
||||||
|
body = derivation {
|
||||||
|
name = "gc-concurrent";
|
||||||
|
system = "@system@";
|
||||||
|
builder = "@shell@";
|
||||||
|
args = ["-e" "-x" ./gc-concurrent.builder.sh];
|
||||||
|
inherit input1 input2;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
19
tests/gc-concurrent.sh
Normal file
19
tests/gc-concurrent.sh
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
storeExpr=$($TOP/src/nix-instantiate/nix-instantiate gc-concurrent.nix)
|
||||||
|
outPath=$($TOP/src/nix-store/nix-store -q $storeExpr)
|
||||||
|
|
||||||
|
|
||||||
|
# Start a build in the background.
|
||||||
|
$TOP/src/nix-store/nix-store -rvv "$storeExpr" &
|
||||||
|
pid=$!
|
||||||
|
|
||||||
|
# Run the garbage collector while the build is running.
|
||||||
|
sleep 2
|
||||||
|
$NIX_BIN_DIR/nix-collect-garbage
|
||||||
|
|
||||||
|
# Wait for the build to finish.
|
||||||
|
echo waiting for pid $pid to finish...
|
||||||
|
wait $pid
|
||||||
|
|
||||||
|
# Check that the root and its dependencies haven't been deleted.
|
||||||
|
cat $outPath/foobar
|
||||||
|
cat $outPath/input-2/bar
|
Loading…
Reference in a new issue