Prompted by the continuous integration build failure at:
  http://hydra.nixos.org/build/277485
The attached sets all expected timeouts to 1s and all
unexpected timeouts to 10s. In this way, tests normally proceed
quickly, but may delay up to 10s before reporting failures.

cheers,
Pádraig.
>From b3529641ee5c339069a70f3b23046bce2d2160e0 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Tue, 2 Feb 2010 10:47:48 +0000
Subject: [PATCH] tests: fixes various timeout races

Prompted by the continuous integration build failure at:
http://hydra.nixos.org/build/277485

* tests/misc/timeout: Set all expected timeouts to 1s and all
unexpected timeouts to 10s. In this way, tests normally proceed
quickly, but may delay up to 10s before reporting failures.
* tests/ls/infloop: Likewise.
* tests/tail-2/pid: Likewise.
* tests/tail-2/pipe-f: Likewise.
* tests/tail-2/wait: Likewise.
* tests/dd/skip-seek-past-dev: Likewise.
---
 tests/dd/skip-seek-past-dev |    6 +++---
 tests/ls/infloop            |    2 +-
 tests/misc/timeout          |    9 ++++-----
 tests/tail-2/pid            |    4 ++--
 tests/tail-2/pipe-f         |    2 +-
 tests/tail-2/wait           |    4 ++--
 6 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/tests/dd/skip-seek-past-dev b/tests/dd/skip-seek-past-dev
index 6f6fbd2..e3eef9b 100755
--- a/tests/dd/skip-seek-past-dev
+++ b/tests/dd/skip-seek-past-dev
@@ -42,17 +42,17 @@ device=$(df -P --local . | tail -n1 | cut -d' ' -f1) ||
 dev_size=$(get_device_size "$device") ||
   skip_test_ "failed to determine size of $device"
 
-# Don't use shell arithimetic as older version of dash use longs
+# Don't use shell arithimetic as older versions of dash use longs
 DEV_OFLOW=$(expr $dev_size + 1)
 
-timeout 1 dd bs=1 skip=$DEV_OFLOW count=0 status=noxfer < "$device" 2> err
+timeout 10 dd bs=1 skip=$DEV_OFLOW count=0 status=noxfer < "$device" 2> err
 test "$?" = "1" || fail=1
 echo "dd: \`standard input': cannot skip: Invalid argument
 0+0 records in
 0+0 records out" > err_ok || framework_failure
 compare err_ok err || fail=1
 
-timeout 1 dd bs=1 seek=$DEV_OFLOW count=0 status=noxfer > "$device" 2> err
+timeout 10 dd bs=1 seek=$DEV_OFLOW count=0 status=noxfer > "$device" 2> err
 test "$?" = "1" || fail=1
 echo "dd: \`standard output': cannot seek: Invalid argument
 0+0 records in
diff --git a/tests/ls/infloop b/tests/ls/infloop
index 2ab486d..b237adc 100755
--- a/tests/ls/infloop
+++ b/tests/ls/infloop
@@ -36,7 +36,7 @@ cat <<\EOF > exp-err || framework_failure
 ls: loop/sub: not listing already-listed directory
 EOF
 
-timeout 1 ls -RL loop >out 2>err
+timeout 10 ls -RL loop >out 2>err
 # Ensure that ls exits with status 2 upon detecting a cycle
 test $? = 2 || fail=1
 
diff --git a/tests/misc/timeout b/tests/misc/timeout
index b61420e..3bd3af3 100755
--- a/tests/misc/timeout
+++ b/tests/misc/timeout
@@ -24,7 +24,7 @@ fi
 . $srcdir/test-lib.sh
 
 # no timeout
-timeout 1 true || fail=1
+timeout 10 true || fail=1
 
 # no timeout (suffix check)
 timeout 1d true || fail=1
@@ -33,12 +33,11 @@ timeout 1d true || fail=1
 timeout 0 true || fail=1
 
 # exit status propagation
-timeout 1 false && fail=1
-timeout 1 sh -c 'exit 2'
+timeout 10 sh -c 'exit 2'
 test $? = 2 || fail=1
 
 # timeout
-timeout 1 sleep 2
+timeout 1 sleep 10
 test $? = 124 || fail=1
 
 # Ensure `timeout` is immune to parent's SIGCHLD handler
@@ -47,7 +46,7 @@ test $? = 124 || fail=1
   # ash doesn't support "trap '' CHLD"; it knows only signal numbers.
   sig=`"$abs_top_builddir/src/kill" -l CHLD 2>/dev/null` && trap '' $sig
 
-  exec timeout 1 true
+  exec timeout 10 true
 ) || fail=1
 
 Exit $fail
diff --git a/tests/tail-2/pid b/tests/tail-2/pid
index 53f9191..b1286df 100755
--- a/tests/tail-2/pid
+++ b/tests/tail-2/pid
@@ -42,13 +42,13 @@ for inotify in ---disable-inotify ''; do
 
   # Ensure that tail --pid=PID exits with success status when PID is dead.
   # Use an unlikely-to-be-live PID
-  timeout 3 tail -f -s.1 --pid=$PID_T_MAX $inotify empty
+  timeout 10 tail -f -s.1 --pid=$PID_T_MAX $inotify empty
   ret=$?
   test $ret = 124 && skip_test_ "pid $PID_T_MAX present or tail too slow"
   test $ret = 0 || fail=1
 
   # Ensure tail doesn't wait for data when PID is dead
-  timeout 3 tail -f -s10 --pid=$PID_T_MAX $inotify empty
+  timeout 10 tail -f -s10 --pid=$PID_T_MAX $inotify empty
   test $? = 124 && fail=1
 done
 
diff --git a/tests/tail-2/pipe-f b/tests/tail-2/pipe-f
index d557f97..bf38c18 100755
--- a/tests/tail-2/pipe-f
+++ b/tests/tail-2/pipe-f
@@ -23,7 +23,7 @@ fi
 
 . $srcdir/test-lib.sh
 
-echo foo | timeout 2 tail -f -c3 > out || fail=1
+echo foo | timeout 10 tail -f -c3 > out || fail=1
 echo oo > exp || fail=1
 
 compare out exp || fail=1
diff --git a/tests/tail-2/wait b/tests/tail-2/wait
index 7b3fa82..5c9eff0 100755
--- a/tests/tail-2/wait
+++ b/tests/tail-2/wait
@@ -30,11 +30,11 @@ touch k || framework_failure
 
 
 for inotify in ---disable-inotify ''; do
-  timeout 1 tail -s0.1 -f $inotify not_here
+  timeout 10 tail -s0.1 -f $inotify not_here
   test $? = 124 && fail=1
 
   if test ! -r unreadable; then # can't test this when root
-    timeout 1 tail -s0.1 -f $inotify unreadable
+    timeout 10 tail -s0.1 -f $inotify unreadable
     test $? = 124 && fail=1
   fi
 
-- 
1.6.2.5

Reply via email to