about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-01-19T13·17+0100
committerEelco Dolstra <edolstra@gmail.com>2017-01-19T16·06+0100
commit90ee1e3fe3b3f0cba8dd31ae161eac79ba249291 (patch)
tree0ac422456d01f287e94dd0f2e9784bab14967d0e /tests
parentcc3b93c991e04aff49a44dbced53f070a06f426e (diff)
Add a test for --max-silent-time
Diffstat (limited to 'tests')
-rw-r--r--tests/timeout.builder.sh2
-rw-r--r--tests/timeout.nix20
-rw-r--r--tests/timeout.sh9
3 files changed, 24 insertions, 7 deletions
diff --git a/tests/timeout.builder.sh b/tests/timeout.builder.sh
deleted file mode 100644
index 3fbdd57946ad..000000000000
--- a/tests/timeout.builder.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-echo "‘timeout’ builder entering an infinite loop"
-while true ; do echo -n .; done
diff --git a/tests/timeout.nix b/tests/timeout.nix
index b41368bb38e2..1f3f23f16a98 100644
--- a/tests/timeout.nix
+++ b/tests/timeout.nix
@@ -1,6 +1,20 @@
 with import ./config.nix;
 
-mkDerivation {
-  name = "timeout";
-  builder = ./timeout.builder.sh;
+{
+
+  infiniteLoop = mkDerivation {
+    name = "timeout";
+    buildCommand = ''
+      echo "‘timeout’ builder entering an infinite loop"
+      while true ; do echo -n .; done
+    '';
+  };
+
+  silent = mkDerivation {
+    name = "silent";
+    buildCommand = ''
+      sleep 60
+    '';
+  };
+
 }
diff --git a/tests/timeout.sh b/tests/timeout.sh
index 2ebd06b9330c..ba9a6c3df26e 100644
--- a/tests/timeout.sh
+++ b/tests/timeout.sh
@@ -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