diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2025-04-05 00:58:22 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2025-04-05 00:58:58 -0700 |
| commit | a3b862ece2aa04d5c0b5e93fec8e66e45b9b3560 (patch) | |
| tree | ca54b588084c0a893dc68d42fefe751b4d0d537a /tests | |
| parent | maint: ensure that new "make syntax-check"-run sc_codespell passes (diff) | |
| download | coreutils-a3b862ece2aa04d5c0b5e93fec8e66e45b9b3560.tar.gz coreutils-a3b862ece2aa04d5c0b5e93fec8e66e45b9b3560.zip | |
timeout: round timeouts up
This handles timeouts like 16777216.000000001 correctly;
formerly the subsecond part of that timeout was ignored.
* bootstrap.conf (gnulib_modules): Add fenv-rounding, signbit.
* src/local.mk (src_timeout_LDADD): Append $(FENV_ROUNDING_LIBM).
* src/timeout.c: Include fenv.h, math.h.
Don’t include xstrtod.h, as xstrtod’s checking now gets in the way.
(parse_duration): Round up when calling cl_strtod.
Check for -1e-1000. Don’t double-round 1e-9.
* tests/timeout/timeout-parameters.sh: Test for -0.1,
-1e-1000, 1e-1000.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/timeout/timeout-parameters.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/timeout/timeout-parameters.sh b/tests/timeout/timeout-parameters.sh index 84b450e90..408846262 100755 --- a/tests/timeout/timeout-parameters.sh +++ b/tests/timeout/timeout-parameters.sh @@ -23,8 +23,10 @@ getlimits_ # internal errors are 125, distinct from execution failure -# invalid timeout +# invalid timeouts returns_ 125 timeout invalid sleep 0 || fail=1 +returns_ 125 timeout ' -0.1' sleep 0 || fail=1 +returns_ 125 timeout ' -1e-10000' sleep 0 || fail=1 # invalid kill delay returns_ 125 timeout --kill-after=invalid 1 sleep 0 || fail=1 @@ -38,6 +40,9 @@ timeout 10.34 sleep 0 || fail=1 # nanoseconds potentially supported timeout 9.999999999 sleep 0 || fail=1 +# round underflow up to 1 ns +returns_ 124 timeout 1e-10000 sleep 1 || fail + # invalid signal spec returns_ 125 timeout --signal=invalid 1 sleep 0 || fail=1 |
