1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-08 02:43:54 +02:00

Add support for the build-timeout' and --timeout' options.

This commit is contained in:
Ludovic Courtès 2011-06-30 15:19:13 +00:00
parent 9c99aa2620
commit 5c9e9f732d
12 changed files with 115 additions and 5 deletions

View file

@ -8,7 +8,7 @@ TESTS = init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \
referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \
gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \
remote-store.sh export.sh export-graph.sh negative-caching.sh \
binary-patching.sh
binary-patching.sh timeout.sh
XFAIL_TESTS =
@ -33,5 +33,6 @@ EXTRA_DIST = $(TESTS) \
export-graph.nix \
negative-caching.nix \
binary-patching.nix \
timeout.nix timeout.builder.sh \
$(wildcard lang/*.nix) $(wildcard lang/*.exp) $(wildcard lang/*.exp.xml) $(wildcard lang/*.flags) \
common.sh.in

2
tests/timeout.builder.sh Normal file
View file

@ -0,0 +1,2 @@
echo "\`timeout' builder entering an infinite loop"
while true ; do : ; done

8
tests/timeout.nix Normal file
View file

@ -0,0 +1,8 @@
with import ./config.nix;
mkDerivation {
name = "timeout";
builder = ./timeout.builder.sh;
PATH = "";
goodPath = path;
}

24
tests/timeout.sh Normal file
View file

@ -0,0 +1,24 @@
# Test the `--timeout' option.
source common.sh
drvPath=$($nixinstantiate timeout.nix)
test "$($nixstore -q --binding system "$drvPath")" = "$system"
echo "derivation is $drvPath"
failed=0
messages="`$nixstore -r --timeout 2 $drvPath 2>&1 || failed=1`"
if test $failed -ne 0; then
echo "error: \`nix-store' succeeded; should have timed out" >&2
exit 1
fi
if ! echo "$messages" | grep "timed out"; then
echo "error: \`nix-store' may have failed for reasons other than timeout" >&2
echo >&2
echo "output of \`nix-store' follows:" >&2
echo "$messages" >&2
exit 1
fi