On 01/03/2020 20:59, Bruno Haible wrote:
On Solaris 11 OpenIndiana, I also see a test failure:
FAIL: tests/misc/timeout-parameters
===================================
timeout: invalid time interval 'invalid'
Try 'timeout --help' for more information.
timeout: invalid time interval 'invalid'
Try 'timeout --help' for more information.
timeout: invalid time interval '42D'
Try 'timeout --help' for more information.
timeout: invalid time interval '-1.189731495357231765e+4932'
Try 'timeout --help' for more information.
timeout: 'invalid': invalid signal
Try 'timeout --help' for more information.
timeout: failed to run command '.': Permission denied
timeout: failed to run command 'no_such': No such file or directory
FAIL tests/misc/timeout-parameters.sh (exit status: 1)
In order to understand which of the particular tests fails, I added
'echo FAILnn' statements, and found that
- sometimes the 5th test, the command
timeout 9223372036854775808d sleep 0
fails,
- sometimes the 7th test, the command
timeout 1.189731495357231765e+4932 sleep 0
fails,
- sometimes both of these tests fail.
That looks like an OpenIndiana 11 bug,
where a timer set with max value returns immediately.
A similar thing was seen with 32 bit Linux/HPPA.
I presume the attached avoids the kernel bug.
cheers,
Pádraig
>From 9413ff686affcb16ebf7619f4033687c8b5e0a6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Sun, 1 Mar 2020 22:28:29 +0000
Subject: [PATCH] tests: avoid a false failure on OpenIndiana 11
* tests/misc/timeout-parameters.sh: Detect the case
where the kernel timer fires immediately when presented
with a very large timeout.
Reported by Bruno Haible.
---
tests/misc/timeout-parameters.sh | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/tests/misc/timeout-parameters.sh b/tests/misc/timeout-parameters.sh
index aa0599c9e..cceb09950 100755
--- a/tests/misc/timeout-parameters.sh
+++ b/tests/misc/timeout-parameters.sh
@@ -32,12 +32,11 @@ returns_ 125 timeout --kill-after=invalid 1 sleep 0 || fail=1
# invalid timeout suffix
returns_ 125 timeout 42D sleep 0 || fail=1
-# It was seen on 32 bit Linux/HPPA that a kernel time_t overflowed,
-# thus causing the timer to fire immediately.
-# So verify that doesn't happen before checking large timeouts
-KERNEL_OVERFLOW_LIMIT=$(expr $TIME_T_MAX - $(date +%s) + 100) ||
- skip_ "failed to adjust TIME_T_MAX $TIME_T_MAX"
-timeout $KERNEL_OVERFLOW_LIMIT sleep 0
+# It was seen on 32 bit Linux/HPPA and OpenIndiana 11
+# that a kernel time_t overflowing cause the timer to fire immediately.
+# This is still racy, but unlikely to cause an issue unless
+# timeout can't process the timer firing within 2 seconds.
+timeout $TIME_T_OFLOW sleep 2
if test $? != 124; then
# timeout overflow
timeout $UINT_OFLOW sleep 0 || fail=1
--
2.24.1