Re: [PATCH v2 1/8] t7300: add testcase showing unnecessary traversal into ignored directory

2 messages, 2 authors, 2021-05-08 · open the first message on its own page

Re: [PATCH v2 1/8] t7300: add testcase showing unnecessary traversal into ignored directory

From: Junio C Hamano <hidden>
Date: 2021-05-08 10:19:21

"Elijah Newren via GitGitGadget" [off-list ref] writes:
+		# alpine-linux-musl fails to "rm -rf" a directory with such
+		# a deeply nested hierarchy.  Help it out by deleting the
+		# leading directories ourselves.  Super slow, but, what else
+		# can we do?  Without this, we will hit a
+		#     error: Tests passed but test cleanup failed; aborting
+		# so do this ugly manual cleanup...
+		while test ! -f directory-random-file.txt; do
+			name=$(ls -d directory*) &&
+			mv $name/* . &&
+			rmdir $name
+		done
Another thing: this not being a test_when_finished handler means it
would not help after a test failure.

Perhaps wrap it in a helper

    clean_deep_hierarchy () {
	rm -fr directory* ||
	while test ! -f directory-random-file.txt
	do
		...
	done
    }

and call it from test_when_finished?

Re: [PATCH v2 1/8] t7300: add testcase showing unnecessary traversal into ignored directory

From: Elijah Newren <hidden>
Date: 2021-05-08 17:41:27

On Sat, May 8, 2021 at 3:19 AM Junio C Hamano [off-list ref] wrote:
"Elijah Newren via GitGitGadget" [off-list ref] writes:
quoted
+             # alpine-linux-musl fails to "rm -rf" a directory with such
+             # a deeply nested hierarchy.  Help it out by deleting the
+             # leading directories ourselves.  Super slow, but, what else
+             # can we do?  Without this, we will hit a
+             #     error: Tests passed but test cleanup failed; aborting
+             # so do this ugly manual cleanup...
+             while test ! -f directory-random-file.txt; do
+                     name=$(ls -d directory*) &&
+                     mv $name/* . &&
+                     rmdir $name
+             done
Another thing: this not being a test_when_finished handler means it
would not help after a test failure.
test failures are irrelevant here; this code is here to help
test_done's directory cleanup, which only fires when all tests pass.


But if I restructure the series, this whole section of code
disappears.  I'll do that...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help