Re: [PATCH v2 1/8] t7300: add testcase showing unnecessary traversal into ignored directory
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 8, 2021, 10:19 UTC
- Message-ID
- <xmqq8s4pv87t.fsf@gitster.g>
- In-Reply-To
- <a3bd253fa8e8ae47d19beb35327d8283ffa49289.1620432500.git.gitgitgadget@gmail.com>
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 11 quoted lines
> + # 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?