about summary refs log tree commit diff
path: root/tests/timeout.sh
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2011-06-30T15·19+0000
committerLudovic Courtès <ludo@gnu.org>2011-06-30T15·19+0000
commit5c9e9f732df6d95d712f25de9880b7461c53d6ca (patch)
treed4e562f7048f57d0ec87461bce441dfd450374f7 /tests/timeout.sh
parent9c99aa2620b8f86c0e7f99ebfe868e8ccb306f71 (diff)
Add support for the `build-timeout' and `--timeout' options.
Diffstat (limited to 'tests/timeout.sh')
-rw-r--r--tests/timeout.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/timeout.sh b/tests/timeout.sh
new file mode 100644
index 000000000000..f27739fb2b52
--- /dev/null
+++ b/tests/timeout.sh
@@ -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