64 Commits
Author SHA1 Message Date
Wolfgang Hoschek e7d188ac65 fix: avoid EOF hang on unread pipe output (#189)
At EOF, pv waits for bytes already written to an output pipe to be consumed before finishing. If the downstream reader exits without reading those bytes, the pipe can keep reporting unread data forever. Since pv has no more input, there is no later write that would fail with EPIPE and break the wait.

Detect this EOF drain-wait case with a non-blocking poll() on the output pipe. When the pipe reports that its readers are gone, mark the pipe closed and stop waiting for bytes that can no longer be consumed. While a reader is still present, keep the existing behaviour and continue waiting for the pipe buffer to drain.

Add regression coverage for both ways pv can reach this state: direct input that leaves unread output bytes behind, and a pipeline where the original producer fails but an intermediate filter such as gzip still emits a valid empty stream. The latter matters because pv can still have pending output at EOF even when the command at the start of the pipeline failed immediately.

Signed-off-by: Wolfgang Hoschek <wolfgang.hoschek@mac.com>
2026-04-30 04:47:09 -04:00
Andrew Wood c0e530eefd Use awk instead of the non-portable "~" sed command. 2026-04-20 22:55:24 +01:00
Andrew Wood 1d28da18ce Add a basic test for monitoring, each of the "in" and "out" sides. 2026-04-19 23:12:10 +01:00
Andrew Wood c19d16b3c8 Loosen the limits on this test slightly. 2026-04-19 17:47:52 +01:00
Andrew Wood b3410cf8c0 Adjust the lower boundary to make failure less likely on a heavily loaded system. 2026-04-19 00:19:29 +01:00
Andrew Wood e17f64fce7 Allow "--size @dir" to read the size of all files under "dir" (#179). 2026-03-07 22:23:10 +00:00
Andrew Wood 10bc46af6e Suppress by source file name rather than function name, since in an LTO build the function name is optimised out (#174). 2025-11-21 23:26:52 +00:00
Andrew Wood ac13765fa5 Test --watchfd with more than one argument (#170). 2025-11-12 14:31:57 +00:00
Andrew Wood 2efe598855 Add a test for --sparse (#45). 2025-10-14 21:46:16 +01:00
Andrew Wood 80b68a73ee Include -C in the test, since splice can have an effect (#166). 2025-10-05 21:50:09 +01:00
Andrew Wood 771b61db30 Add test for over-read when using stop-at-size (#166). 2025-10-05 21:33:32 +01:00
Andrew Wood 3f597e59e0 Adjust the installer test to retry with both "gmake" and "make", to work around strange behaviour on NetBSD. 2025-01-28 22:10:49 +00:00
Andrew Wood a62051e5ff Adjust the sensitivity of the test. 2025-01-28 21:35:42 +00:00
Andrew Wood 896ff890d8 Adjustments to reduce false positives on slow systems. 2025-01-12 13:14:38 +00:00
Andrew Wood c8ad7eb0e2 Bypass valgrind checks on ARM by default due to false positives. 2025-01-11 20:57:26 +00:00
Andrew Wood f3e98da13b Prevent the background test components from waiting forever for the following PV process to start. 2024-12-15 15:00:51 +00:00
Andrew Wood 4f58a3d751 Make background test processes wait for their subsequent foreground PV to start, to make a race condition less likely to trigger test failures on slower systems. 2024-12-15 13:36:14 +00:00
Andrew Wood 18c76175b2 Read the PID from the correct work file when testing remote control of the extra display. 2024-12-14 16:28:51 +00:00
Andrew Wood 2d7d854a97 Allow all tests to be skipped if SKIP_ALL_TESTS is 1. 2024-12-07 14:23:03 +00:00
Andrew Wood 97c48c8901 Allow valgrind tests to be skipped with an environment variable. 2024-12-07 02:20:04 +00:00
Andrew Wood 02e6d0e04c Skip this test if environment file XCFILE is set to 1. 2024-12-05 21:52:57 +00:00
Andrew Wood ebb209a371 Add support for --extra-display to --remote (#123). 2024-12-03 23:48:44 +00:00
Andrew Wood dccc7345ab New option "--extra-display" (#3, #4). 2024-12-01 19:39:59 +00:00
Andrew Wood 94e496c77e Raise an error if variables are not defined. 2024-12-01 14:01:10 +00:00
Andrew Wood 869a4e68a4 Memory safety check for --watchfd. 2024-11-30 23:39:32 +00:00
Andrew Wood fa745f2cfe Test "--watchfd PID". 2024-11-30 22:55:00 +00:00
Andrew Wood 97fc6a10a4 Work around issues with valgrind 3.23.0 treating inherited open file descriptors as an error with --track-fds=yes (#97). 2024-11-30 22:26:20 +00:00
Andrew Wood d0218bfe54 Skip this test where "-d" is not available. 2024-11-30 22:25:20 +00:00
Andrew Wood 2b489bae26 Correction to the file and descriptor handling. 2024-11-30 17:32:42 +00:00
Andrew Wood 0d618efd0d Remove pointless EOF lines from all sources. 2024-11-30 16:40:50 +00:00
Andrew Wood 5b0697b68c Add a test for --watchfd with a single file descriptor. 2024-11-30 16:35:30 +00:00
Andrew Wood 21e65b8742 Relax the strictness of this check a little, to avoid false failures on heavily loaded systems. 2024-06-15 23:11:53 +01:00
Andrew Wood a9737ca05e Correct the test skip reason message, if "--remote" is not supported. 2023-10-01 01:50:52 +01:00
Andrew Wood 455f819ec0 Corrected error report messages. 2023-09-13 23:04:31 +01:00
Andrew Wood 2942c312a7 Removed "-" argument to "cksum" for FreeBSD compatibility. 2023-09-13 23:04:00 +01:00
Andrew Wood c6315365e2 Comment correction. 2023-09-13 22:47:29 +01:00
Andrew Wood 7b6a91422d Added size parsing test. 2023-09-13 22:46:53 +01:00
Andrew Wood 4c71e96cba Skip valgrind tests if the tool is present but does not support the options we use. 2023-08-28 19:37:49 +01:00
Andrew Wood e99548ea8a Major restructuring to switch build system from old scripts to GNU Automake. 2023-08-28 10:04:39 +01:00
Andrew Wood 9ab690b7c0 Added some memory safety tests using valgrind. 2023-08-15 22:50:25 +01:00
Andrew Wood 6560137233 Do not fail the test if msgfmt was not available, as that would prevent localisation files being installed. 2023-08-06 20:50:48 +01:00
Andrew Wood 8e3b47bf89 Added test to check that "make install" installs the expected set of files. 2023-08-01 21:42:59 +01:00
Andrew Wood e7e7649d2f Deal with the various tmux versions out there. 2023-08-01 21:18:05 +01:00
Andrew Wood 14fb0e7832 Terminal width detection test. 2023-07-31 23:22:51 +01:00
Andrew Wood ae81f83e9b New option "--direct-io". 2023-07-27 21:44:30 +01:00
Andrew Wood 60913618be Adjust lower threshold in case of heavy load during testing. 2023-07-27 20:49:14 +01:00
Andrew Wood 43dc9d6469 Added test for "--sync" 2023-07-26 22:43:00 +01:00
Andrew Wood ecaa5ce6cd Added test 2023-07-25 22:19:15 +01:00
Andrew Wood e5b5e67e57 Added test 2023-07-25 22:06:31 +01:00
Andrew Wood 1efe1d60b5 Added test 2023-07-25 21:43:29 +01:00