Skip to content

Commit

Permalink
tests: auto-set LIB_HTTPD_PORT from test name
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Feb 10, 2014
1 parent be961c2 commit 3bb486e
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion t/lib-httpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ case $(uname) in
esac

LIB_HTTPD_PATH=${LIB_HTTPD_PATH-"$DEFAULT_HTTPD_PATH"}
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'}
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-${this_test#t}}

TEST_PATH="$TEST_DIRECTORY"/lib-httpd
HTTPD_ROOT_PATH="$PWD"/httpd
Expand Down
1 change: 0 additions & 1 deletion t/t5537-fetch-shallow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then
test_done
fi

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

Expand Down
1 change: 0 additions & 1 deletion t/t5538-push-shallow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ if test -n "$NO_CURL" -o -z "$GIT_TEST_HTTPD"; then
test_done
fi

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

Expand Down
1 change: 0 additions & 1 deletion t/t5540-http-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ then
fi

LIB_HTTPD_DAV=t
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5540'}
. "$TEST_DIRECTORY"/lib-httpd.sh
ROOT_PATH="$PWD"
start_httpd
Expand Down
1 change: 0 additions & 1 deletion t/t5541-http-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ if test -n "$NO_CURL"; then
fi

ROOT_PATH="$PWD"
LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5541'}
. "$TEST_DIRECTORY"/lib-httpd.sh
. "$TEST_DIRECTORY"/lib-terminal.sh
start_httpd
Expand Down
1 change: 0 additions & 1 deletion t/t5550-http-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then
test_done
fi

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

Expand Down
1 change: 0 additions & 1 deletion t/t5551-http-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then
test_done
fi

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

Expand Down
1 change: 0 additions & 1 deletion t/t5561-http-backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ if test -n "$NO_CURL"; then
test_done
fi

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

Expand Down

0 comments on commit 3bb486e

Please sign in to comment.