git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 2/4] t/test-lib: silence EBUSY errors on Windows during test cleanup

From
Patrick Steinhardt <ps@pks.im>
Date
Jun 3, 2026, 05:39 UTC
Message-ID
<20260603-pks-t7527-fix-tap-output-v2-2-cf3af5694e20@pks.im>
In-Reply-To
<20260603-pks-t7527-fix-tap-output-v2-0-cf3af5694e20@pks.im>

When tests have finished we clean up the trash directory via `rm -rf`. On Windows this can fail with EBUSY in cases where a process still holds some of the files open, for example when we have spawned a daemonized process that wasn't properly terminated. We thus retry several times, but every failure will result in error messages being printed, and that in turn breaks the TAP output format.

One such case where this is causing issues is in t921x, which contains tests related to Scalar. Some tests spawn the fsmonitor daemon, and we never properly terminate it.

The obvious fix would be to ensure that we never leak any processes, but that gets ugly fast. Instead, let's work around the issue by silencing error messages printed by the `rm -rf` calls. We already know to print an error when the retry loop fails, so we don't loose much.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/test-lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4a7357b547..d1d24c4124 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1299,10 +1299,10 @@ test_done () {
 			error "Tests passed but trash directory already removed before test cleanup; aborting"
 
 			cd "$TRASH_DIRECTORY/.." &&
-			rm -fr "$TRASH_DIRECTORY" || {
+			rm -fr "$TRASH_DIRECTORY" 2>/dev/null || {
 				# try again in a bit
 				sleep 5;
-				rm -fr "$TRASH_DIRECTORY"
+				rm -fr "$TRASH_DIRECTORY" 2>/dev/null
 			} ||
 			error "Tests passed but test cleanup failed; aborting"
 		fi
-- 
2.54.0.1064.gd145956f57.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 3 of 5 in “t: fix broken TAP output”
  1. 0/4 t: fix broken TAP outputPatrick Steinhardt, Jun 3, 2026
  2. 1/4 t7527: fix broken TAP outputPatrick Steinhardt, Jun 3, 2026
  3. 2/4 t/test-lib: silence EBUSY errors on Windows during test cleanupPatrick Steinhardt, Jun 3, 2026
  4. 3/4 t/lib-git-p4: silence output when killing p4d and its watchdogPatrick Steinhardt, Jun 3, 2026
  5. 4/4 t: let prove fail when parsing invalid TAP outputPatrick Steinhardt, Jun 3, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.