Skip to contentSkip to conversation

t1400: have fifo test clean after itself

PATCH In review Junio C Hamano 2 participants 2 messages Jun 10 – Jun 11

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t1400: have fifo test clean after itself

One test in this script creates a pair of FIFOs, "in" and "out", that are named so generically that later tests may be tempted to use them. By the time those later tests run a command with its output redirected to the file (e.g., "git foobar >out"), however, nobody is reading from the lingering FIFO, and the test gets blocked forever.

Clean them up when the test finishes.

---
 t/t1400-update-ref.sh | 1 +
 1 file changed, 1 insertion(+)
t/t1400-update-ref.sh +1 -0
index db7f5444da..477af544bc 100755
@@ -1610,6 +1610,7 @@ test_expect_success 'transaction cannot restart ongoing transaction' '
 '
 
 test_expect_success PIPE 'transaction flushes status updates' '
+	test_when_finished "rm -f in out" &&
 	mkfifo in out &&
 	(git update-ref --stdin <in >out &) &&
 
Signature · 1 line
2.54.0-615-g639a4a7340
#1 lore raw
Quoted 18 lines · Junio C Hamano

One test in this script creates a pair of FIFOs, "in" and "out", that are named so generically that later tests may be tempted to use them. By the time those later tests run a command with its output redirected to the file (e.g., "git foobar >out"), however, nobody is reading from the lingering FIFO, and the test gets blocked forever.

Clean them up when the test finishes.

---
 t/t1400-update-ref.sh | 1 +
 1 file changed, 1 insertion(+)
t/t1400-update-ref.sh +0 -0
index db7f5444da..477af544bc 100755

t/t1400-update-ref.sh test_expect_success 'transaction cannot restart ongoing transaction' ' · line 1615

Quoted 6 lines
t/t1400-update-ref.sh +1 -0
@@ -1610,6 +1610,7 @@ test_expect_success 'transaction cannot restart ongoing transaction' '
 '
 
 test_expect_success PIPE 'transaction flushes status updates' '
+	test_when_finished "rm -f in out" &&
 	mkfifo in out &&
 	(git update-ref --stdin <in >out &) &&

I'd expect that such a test that tried to reuse the sockets would probably break quite obviously, but I guess you never really know. In any case, it doesn't hurt to clean up after the test.

Thanks!

Patrick