Add a test for --max-silent-time

This commit is contained in:
Eelco Dolstra 2017-01-19 14:17:57 +01:00
parent cc3b93c991
commit 90ee1e3fe3
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 24 additions and 7 deletions

View file

@ -1,2 +0,0 @@
echo "timeout builder entering an infinite loop"
while true ; do echo -n .; done

View file

@ -1,6 +1,20 @@
with import ./config.nix;
mkDerivation {
{
infiniteLoop = mkDerivation {
name = "timeout";
builder = ./timeout.builder.sh;
buildCommand = ''
echo "timeout builder entering an infinite loop"
while true ; do echo -n .; done
'';
};
silent = mkDerivation {
name = "silent";
buildCommand = ''
sleep 60
'';
};
}

View file

@ -3,7 +3,7 @@
source common.sh
failed=0
messages="`nix-build -Q timeout.nix --timeout 2 2>&1 || failed=1`"
messages="`nix-build -Q timeout.nix -A infiniteLoop --timeout 2 2>&1 || failed=1`"
if [ $failed -ne 0 ]; then
echo "error: nix-store succeeded; should have timed out"
exit 1
@ -15,7 +15,12 @@ if ! echo "$messages" | grep -q "timed out"; then
exit 1
fi
if nix-build -Q timeout.nix --option build-max-log-size 100; then
if nix-build -Q timeout.nix -A infiniteLoop --option build-max-log-size 100; then
echo "build should have failed"
exit 1
fi
if nix-build timeout.nix -A silent --max-silent-time 2; then
echo "build should have failed"
exit 1
fi