Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2023-08-10 17:33:13 +0300
committerJunio C Hamano <gitster@pobox.com>2023-08-10 19:16:27 +0300
commit231e86c10c674235cf28447a8486f7955d5f4dd9 (patch)
tree29a698f58cb2e00a6d0192bb56826082a104b9b6 /t/t4053-diff-no-index.sh
parent1e3f26542a6ecd3006c2c0d5ccc0bae4a700f7e5 (diff)
t4053: avoid race when killing background processes
The test 'diff --no-index reads from pipes' starts a couple of background processes that write to the pipes that are passed to "diff --no-index". If the test passes then we expect these processes to exit as all their output will have been read. However if the test fails then we want to make sure they do not hang about on the users machine and the test remembers they should be killed by calling test_when_finished "! kill $!" after each background process is created. Unfortunately there is a race where test_when_finished may run before the background process exits even when all its output has been read resulting in the kill command succeeding which causes the test to fail. Fix this by ignoring the exit status of the kill command. If the diff is successful we could instead wait for the background process to exit and check their status but that feels like it is testing the platform's printf implementation rather than git's code. Reported-by: Jeff King <peff@peff.net> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4053-diff-no-index.sh')
-rwxr-xr-xt/t4053-diff-no-index.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t4053-diff-no-index.sh b/t/t4053-diff-no-index.sh
index a28b9ff243..1fb7d33462 100755
--- a/t/t4053-diff-no-index.sh
+++ b/t/t4053-diff-no-index.sh
@@ -248,11 +248,11 @@ test_expect_success PIPE,SYMLINKS 'diff --no-index reads from pipes' '
{
(test_write_lines a b c >old) &
} &&
- test_when_finished "! kill $!" &&
+ test_when_finished "kill $! || :" &&
{
(test_write_lines a x c >new) &
} &&
- test_when_finished "! kill $!" &&
+ test_when_finished "kill $! || :" &&
cat >expect <<-EOF &&
diff --git a/old b/new-link