diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/timeout.builder.sh | 2 | ||||
-rw-r--r-- | tests/timeout.sh | 23 |
2 files changed, 11 insertions, 14 deletions
diff --git a/tests/timeout.builder.sh b/tests/timeout.builder.sh index 5a7e08861002..1ddb44e99c7f 100644 --- a/tests/timeout.builder.sh +++ b/tests/timeout.builder.sh @@ -1,2 +1,2 @@ echo "\`timeout' builder entering an infinite loop" -while true ; do echo foo; sleep 1; done +while true ; do echo -n .; done diff --git a/tests/timeout.sh b/tests/timeout.sh index 2101d13a7894..4a4769a165e8 100644 --- a/tests/timeout.sh +++ b/tests/timeout.sh @@ -2,23 +2,20 @@ source common.sh -drvPath=$(nix-instantiate timeout.nix) - -test "$(nix-store -q --binding system "$drvPath")" = "$system" - -echo "derivation is $drvPath" - failed=0 -messages="`nix-store -r --timeout 2 $drvPath 2>&1 || failed=1`" -if test $failed -ne 0; then - echo "error: \`nix-store' succeeded; should have timed out" >&2 +messages="`nix-build timeout.nix --timeout 2 2>&1 || failed=1`" +if [ $failed -ne 0 ]; then + echo "error: \`nix-store' succeeded; should have timed out" 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 +if ! echo "$messages" | grep -q "timed out"; then + echo "error: build may have failed for reasons other than timeout; output:" echo "$messages" >&2 exit 1 fi + +if nix-build timeout.nix --option build-max-log-size 100; then + echo "build should have failed" + exit 1 +fi |