diff options
Diffstat (limited to 'tests/timeout.sh')
-rw-r--r-- | tests/timeout.sh | 23 |
1 files changed, 10 insertions, 13 deletions
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 |