Adda test for build-max-log-size

This commit is contained in:
Eelco Dolstra 2013-09-02 12:44:30 +02:00
parent b29d3f4aee
commit 6ec8dab06a
2 changed files with 11 additions and 14 deletions

View file

@ -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

View file

@ -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