Re: [PATCH 2/6] t5538: fix default http port
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 8, 2014, 07:36 UTC
- Message-ID
- <CACsJy8CLR4qerWPWs+0TWxnTWidm_VLtYExjKqAOLOSNK0chaA@mail.gmail.com>
- In-Reply-To
- <20140207234727.GA17520@sigill.intra.peff.net>
On Sat, Feb 8, 2014 at 6:47 AM, Jeff King <peff@peff.net> wrote:
Show 26 quoted lines
> Thinking on this more, I wonder if we should just do something like
> this:
>
> diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
> index bfdff2a..c82b4ee 100644
> --- a/t/lib-httpd.sh
> +++ b/t/lib-httpd.sh
> @@ -64,7 +64,9 @@ case $(uname) in
> esac
>
> LIB_HTTPD_PATH=${LIB_HTTPD_PATH-"$DEFAULT_HTTPD_PATH"}
> -LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'}
> +if test -z "$LIB_HTTPD_PORT"; then
> + LIB_HTTPD_PORT=${this_test#t}
> +fi
>
> TEST_PATH="$TEST_DIRECTORY"/lib-httpd
> HTTPD_ROOT_PATH="$PWD"/httpd
>
> and drop the manual LIB_HTTPD_PORT setting in each of the test scripts.
> That would prevent this type of error in the future, and people can
> still override if they want to.
>
> Any test scripts that are not numbered would need to set it, but we
> should not have any of those (and if we did, the failure mode would be
> OK, as Apache would barf on the bogus port number).Yes! Next stop, attempt to start httpd at start_httpd regardless of GIT_TEST_HTTPD. If successful, test_set_prereq HTTPD or something that the following tests can use. If GIT_TEST_HTTPD is set and start_httpd fails, error out, not set prereq.
-- Duy