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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Feb 10, 2014 at 09:39 UTC
3bb486e4397415e1855e5edbf28d8e50c3d45265
8 files changed
+1
-8
t/lib-httpd.sh
+1
-1
@@ -64,7 +64,7 @@ case $(uname) in
64
esac
65
66
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}}
68
69
TEST_PATH="$TEST_DIRECTORY"/lib-httpd
70
HTTPD_ROOT_PATH="$PWD"/httpd
t/t5537-fetch-shallow.sh
-1
@@ -178,7 +178,6 @@ if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then
178
test_done
179
fi
180
181
-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5537'}
181
. "$TEST_DIRECTORY"/lib-httpd.sh
182
start_httpd
183
t/t5538-push-shallow.sh
-1
@@ -126,7 +126,6 @@ if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then
126
test_done
127
fi
128
129
-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5537'}
129
. "$TEST_DIRECTORY"/lib-httpd.sh
130
start_httpd
131
t/t5540-http-push.sh
-1
@@ -16,7 +16,6 @@ then
16
fi
17
18
LIB_HTTPD_DAV=t
19
-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'}
19
. "$TEST_DIRECTORY"/lib-httpd.sh
20
ROOT_PATH="$PWD"
21
start_httpd
t/t5541-http-push.sh
-1
@@ -12,7 +12,6 @@ if test -n "$NO_CURL"; then
12
fi
13
14
ROOT_PATH="$PWD"
15
-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5541'}
15
. "$TEST_DIRECTORY"/lib-httpd.sh
16
. "$TEST_DIRECTORY"/lib-terminal.sh
17
start_httpd
t/t5550-http-fetch.sh
-1
@@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then
8
test_done
9
fi
10
11
-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5550'}
11
. "$TEST_DIRECTORY"/lib-httpd.sh
12
start_httpd
13
t/t5551-http-fetch.sh
-1
@@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then
8
test_done
9
fi
10
11
-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5551'}
11
. "$TEST_DIRECTORY"/lib-httpd.sh
12
start_httpd
13
t/t5561-http-backend.sh
-1
@@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then
8
test_done
9
fi
10
11
-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5561'}
11
. "$TEST_DIRECTORY"/lib-httpd.sh
12
start_httpd
13