Re: [PATCH] t/lib-git-daemon: ksh portability workaround
- From
Jeff King <peff@peff.net>
- Date
- May 31, 2016, 23:05 UTC
- Message-ID
- <20160531230547.GC4585@sigill.intra.peff.net>
- In-Reply-To
- <xmqq60tt3k4f.fsf@gitster.mtv.corp.google.com>
On Tue, May 31, 2016 at 04:04:00PM -0700, Junio C Hamano wrote:
Show 20 quoted lines
> The "git daemon" test checks with what status the daemon exits when
> we terminate it, and we expect that we can observe death by SIGTERM.
>
> We forgot that ksh adds 256, unlike 128 that are used by other POSIX
> shells, to the signal number that caused the process to die when
> coming up with the exit status.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> diff --git a/t/lib-git-daemon.sh b/t/lib-git-daemon.sh
> index 340534c..623b3ae 100644
> --- a/t/lib-git-daemon.sh
> +++ b/t/lib-git-daemon.sh
> @@ -83,7 +83,8 @@ stop_git_daemon() {
> wait "$GIT_DAEMON_PID" >&3 2>&4
> ret=$?
> # expect exit with status 143 = 128+15 for signal TERM=15
> - if test $ret -ne 143
> + # or 271 = 256+15 on ksh
> + if test $ret -ne 143 && test $ret -ne 271The presence of this patch (on top of the other one) makes me think we should go with something like:
test_exit_code_is
or something, and make it available via test-lib-functions.sh.
-Peff