t5562: do not reuse output files

Some expected failures of git-http-backend leaves running its children (receive-pack or upload-pack) which still hold opened descriptors to act.err and with some probability they live long enough to write there their failure messages after next test has already truncated the files. This causes occasional failures of the test script. Avoid the issue by using separated output and error file for each test, apprending the test number to their name. Reported-by: Carlo Arenas <carenas@gmail.com> Helped-by: Carlo Arenas <carenas@gmail.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Max Kirillov committed Nov 24, 2018 at 11:37 UTC 0539071b1e998248ba89cb5117a57cd13d83aefb
1 file changed +4 -4
t/t5562-http-backend-content-length.sh
+4 -4
@@ -8,12 +8,12 @@ test_lazy_prereq GZIP 'gzip --version'
8 verify_http_result() {
9 # some fatal errors still produce status 200
10 # so check if there is the error message
11 - if grep 'fatal:' act.err
11 + if grep 'fatal:' act.err.$test_count
12 then
13 return 1
14 fi
15
16 - if ! grep "Status" act.out >act
16 + if ! grep "Status" act.out.$test_count >act
17 then
18 printf "Status: 200 OK\r\n" >act
19 fi
@@ -33,7 +33,7 @@ test_http_env() {
33 REQUEST_METHOD=POST \
34 "$PERL_PATH" \
35 "$TEST_DIRECTORY"/t5562/invoke-with-content-length.pl \
36 - "$request_body" git http-backend >act.out 2>act.err
36 + "$request_body" git http-backend >act.out.$test_count 2>act.err.$test_count
37 }
38
39 ssize_b100dots() {
@@ -161,7 +161,7 @@ test_expect_success 'empty CONTENT_LENGTH' '
161 GIT_HTTP_EXPORT_ALL=TRUE \
162 REQUEST_METHOD=GET \
163 CONTENT_LENGTH="" \
164 - git http-backend <empty_body >act.out 2>act.err &&
164 + git http-backend <empty_body >act.out.$test_count 2>act.err.$test_count &&
165 verify_http_result "200 OK"
166 '
167