summaryrefslogtreecommitdiffstats
path: root/tests/timeout
AgeCommit message (Collapse)AuthorLines
2026-02-24tests: fix "Hangup" termination of non-interactive runsPádraig Brady-3/+8
This avoids the test harness being terminated like: make[1]: *** [Makefile:24419: check-recursive] Hangup make[3]: *** [Makefile:24668: check-TESTS] Hangup make: *** [Makefile:24922: check] Hangup make[2]: *** [Makefile:24920: check-am] Hangup make[4]: *** [Makefile:24685: tests/misc/usage_vs_refs.log] Error 129 ... This happened sometimes when the tests were being run non interactively. For example when run like: setsid make TESTS="tests/timeout/timeout.sh \ tests/tail/overlay-headers.sh" SUBDIRS=. -j2 check Note the race window can be made bigger by adding a sleep after tail is stopped in overlay-headers.sh The race can trigger the kernel to induce its job control mechanism to prevent stuck processes. I.e. where it sends SIGHUP + SIGCONT to a process group when it determines that group may become orphaned, and there are stopped processes in that group. * tests/tail/overlay-headers.sh: Use setsid(1) to keep the stopped tail process in a separate process group, thus avoiding any kernel job control protection mechanism. * tests/timeout/timeout.sh: Use setsid(1) to avoid the kernel checking the main process group when sleep(1) is reparented. Fixes https://bugs.gnu.org/80477
2026-01-01maint: run 'make update-copyright'Collin Funk-5/+5
2025-12-02timeout: print the signal number 0 instead of EXITCollin Funk-1/+1
POSIX.1-2024 added sig2str but leaves the behavior when called with signal 0 unspecified. FreeBSD 15.0 does not return the signal name EXIT like Gnulib's version causing a test failure. This fixes that and changes the behavior to print 0 instead of EXIT, to avoid confusion when the program does not exit. * NEWS: Mention the change. * src/timeout.c (cleanup): Use snprintf instead of sig2str if the signal is 0. * tests/timeout/timeout.sh: Updated the expected output.
2025-12-02timeout: prioritize "timed out" exit statusPádraig Brady-1/+1
* src/timeout.c (cleanup): Reset the default exit status to EXIT_TIMEDOUT, if we have in fact received an ALARM. Otherwise we would exit with status EXIT_CANCELED if there was an issue writing --verbose output for example. This also ensures a consistent exit status with ASAN enabled, as with ASAN stderr is not explicitly closed by gnulib's close_stdout handler.
2025-11-29test: re-enable tests that had a false requirement on coreutils' killPádraig Brady-1/+1
Recently we've not built our kill command by default, so reduce test dependence on that. * tests/sort/sort-compress-proc.sh: `kill -l [exit_status]` is well supported, and is a POSIX requirement. * tests/timeout/timeout.sh: There were actually no kill invocations in this test at all.
2025-11-29timeout: ensure we terminate command upon abnormal exitPádraig Brady-1/+19
* src/timeout.c (main): Use PR_SET_PDEATHSIG to ensure the child is terminated even if the parent terminates abnormally. * tests/timeout/timeout-group.sh: Add a case to ensure sending SIGKILL results in the termination of the monitored command. * NEWS: Mention the improvement.
2025-11-22timeout: honor ignored signal dispositionsPádraig Brady-13/+33
This behavior was depended on in our trap_sigpipe_or_skip_ helper, and now that we're handling all terminating signals, we should consistently honor their ignored signal dispositions. * NEWS: Mention the change in behavior, especially in regard to shell background jobs. * src/timeout.c (sig_needs_handling): A new helper that return TRUE, for --signal, SIG_ALRM, or non ignored signals. (cleanup_install): Filter handled signals with the helper. (block_cleanup_and_chld): Likewise. * tests/timeout/timeout-group.sh: Adjust to use the now required `env --default-signal=...` wrapper to reset (auto) ignored signals. Also change the termination signal from SIGINT to SIGUSR1 to generalize the test signals not specially handled by the shell, and newly handled by timeout(1). * tests/timeout/timeout.sh: Add a test case for SIGPIPE to ensure the ignored signal disposition is honored.
2025-11-21timeout: handle all terminating signalsPádraig Brady-1/+9
* src/timeout.c (term_sig): A new global list of all signals whose default disposition is to terminate the process. (install_cleanup): Iterate over the TERM_SIG list, rather than installing the handler for a specific subset. (block_cleanup_and_chld): Likewise. * tests/timeout/timeout.sh: Add a test case for SIGPIPE. * NEWS: Mention the bug fix.
2025-04-05maint: adjustments to recent timeout changePádraig Brady-4/+1
* .gitignore: Add /lib/fenv.h to ignore list. * tests/timeout/timeout-parameters.sh: Use a sleep length of 10s to be consistent with the pattern where we use this larger time when it does not slow down a test, but also provides protection against a hung test, and better avoidance of false failures due to races on very loaded systems. Also fix the setting of FAIL. * tests/timeout/timeout-large-parameters.sh: Remove duplicated test.
2025-04-05timeout: round timeouts upPaul Eggert-1/+6
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.
2025-04-04timeout: ensure infinitesimal timeouts timeout quicklyPádraig Brady-0/+3
* src/timeout.c (parse_duration): Clamp infinitesimal values to 1ns. * tests/timeout/timeout-large-parameters.sh: Add a test case. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/77535
2025-01-01maint: update all copyright year number rangesPádraig Brady-5/+5
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2024-11-01doc: fix timeout --help for -pPádraig Brady-6/+2
* src/timeout.c (usage): Fix typo of period with comma. * tests/timeout/timeout.sh: Only test a single option variant, as tests/misc/usage_vs_getopt.sh suffices for basic option validation.
2024-10-30timeout: add -f and -p short options as per POSIX 2024Pádraig Brady-2/+6
* src/timeout.c: Support -f and -p short options, corresponding to --foreground and --preserve-status respectively. This adds compatability with POSIX 2024 and OpenBSD. (usage): Separate translations, and reorder the option descriptions. * doc/coreutils.texi (timeout invocation): Adjust accordingly, and also reorder the option descriptions alphabetically. * tests/timeout/timeout.sh: Also test short option variants.
2024-01-01maint: update all copyright year number rangesPádraig Brady-5/+5
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Manually update copyright year, until we fully sync with gnulib at a later stage. * tests/sample-test: Adjust to use the single most recent year.
2023-06-19tests: move tests to a directory per utilitySylvestre Ledru-0/+321
* cfg.mk: Adjust syntax check exclusion paths. * tests/local.mk: Adjust for renamed tests.