Skip to content

Commit 3bb486e

Browse files
peffgitster
authored andcommitted
tests: auto-set LIB_HTTPD_PORT from test name
We set the default apache port for each of the httpd tests to the 4-digit test number of the test script. We want these to remain unique so that the tests do not conflict with each other when run in parallel. Instead of doing it manually in each test script, let's just set it from the test name at run time. This is simpler, and is one less thing to be updated when test scripts are renamed (e.g., when being re-rolled or when conflicting after being merged with another topic). Incidentally, this fixes a case where t5537 and t5538 used the same port number (5537), and could conflict with each other when run in parallel. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent be961c2 commit 3bb486e

8 files changed

+1
-8
lines changed

t/lib-httpd.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ case $(uname) in
6464
esac
6565

6666
LIB_HTTPD_PATH=${LIB_HTTPD_PATH-"$DEFAULT_HTTPD_PATH"}
67-
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'}
67+
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-${this_test#t}}
6868

6969
TEST_PATH="$TEST_DIRECTORY"/lib-httpd
7070
HTTPD_ROOT_PATH="$PWD"/httpd

t/t5537-fetch-shallow.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then
178178
test_done
179179
fi
180180

181-
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5537'}
182181
. "$TEST_DIRECTORY"/lib-httpd.sh
183182
start_httpd
184183

t/t5538-push-shallow.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then
126126
test_done
127127
fi
128128

129-
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5537'}
130129
. "$TEST_DIRECTORY"/lib-httpd.sh
131130
start_httpd
132131

t/t5540-http-push.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ then
1616
fi
1717

1818
LIB_HTTPD_DAV=t
19-
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'}
2019
. "$TEST_DIRECTORY"/lib-httpd.sh
2120
ROOT_PATH="$PWD"
2221
start_httpd

t/t5541-http-push.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ if test -n "$NO_CURL"; then
1212
fi
1313

1414
ROOT_PATH="$PWD"
15-
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5541'}
1615
. "$TEST_DIRECTORY"/lib-httpd.sh
1716
. "$TEST_DIRECTORY"/lib-terminal.sh
1817
start_httpd

t/t5550-http-fetch.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then
88
test_done
99
fi
1010

11-
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5550'}
1211
. "$TEST_DIRECTORY"/lib-httpd.sh
1312
start_httpd
1413

t/t5551-http-fetch.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then
88
test_done
99
fi
1010

11-
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5551'}
1211
. "$TEST_DIRECTORY"/lib-httpd.sh
1312
start_httpd
1413

t/t5561-http-backend.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then
88
test_done
99
fi
1010

11-
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5561'}
1211
. "$TEST_DIRECTORY"/lib-httpd.sh
1312
start_httpd
1413

0 commit comments

Comments
 (0)