Skip to content

Commit fb6211c

Browse files
committed
mingw: try to work around issues with the test cleanup
It seems that every once in a while in the Git for Windows SDK, there are some transient file locking issues preventing the test clean up to delete the trash directory. Let's be gentle and try again five seconds later, and only error out if it still fails the second time. This change helps Windows, and does not hurt any other platform (normally, it is highly unlikely that said deletion fails, and if it does, normally it will fail again even 5 seconds later). Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6f50726 commit fb6211c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

t/test-lib.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,11 @@ test_done () {
971971
error "Tests passed but trash directory already removed before test cleanup; aborting"
972972

973973
cd "$TRASH_DIRECTORY/.." &&
974-
rm -fr "$TRASH_DIRECTORY" ||
974+
rm -fr "$TRASH_DIRECTORY" || {
975+
# try again in a bit
976+
sleep 5;
977+
rm -fr "$TRASH_DIRECTORY"
978+
} ||
975979
error "Tests passed but test cleanup failed; aborting"
976980
fi
977981
test_at_end_hook_

0 commit comments

Comments
 (0)