From: Jonathan Nieder <jrnieder@gmail.com>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: git@vger.kernel.org, drizzd@aon.at, peff@peff.net,
Brandon Casey <drafnel@gmail.com>
Subject: Re: [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE
Date: Fri, 9 Oct 2009 14:28:12 -0500 [thread overview]
Message-ID: <20091009192812.GA4122@progeny.tock> (raw)
In-Reply-To: <1eweIwf5YoFwmLPWwEFN69a2f-EUnj_kgiagVJoVQYfNQeLjlpm12U84RKxhzjh0NJv36SqO12lAX2c_x0WSgA@cipher.nrlssc.navy.mil>
Brandon Casey wrote:
> So, rather than relying on the behavior of Bash in order to get the exit
> code from $? inside die(), change GIT_EXIT_OK into GIT_EXIT_CODE, and set
> it to the code that we want to exit with. This allows the test suite to
> be run with the Korn shell.
>
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Sounds like a good idea. A few thoughts:
start_httpd() from lib-httpd.sh uses a similar pattern:
lib-httpd.sh:96: trap 'code=$?; stop_httpd; (exit $code); die' EXIT
It is probably worth changing that, too, unless GIT_TEST_HTTPD would not
work on these platforms for some other reason.
"GIT_EXIT_CODE=1; exit 1" sounds repetitive to my ear. It’s probably just
me, but if not, it might be worth adding a function like
expected_exit() {
GIT_EXIT_CODE=$1
exit "$1"
}
I’m not sure.
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index f2ca536..64e793a 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
[...]
> @@ -183,16 +183,16 @@ test_success=0
>
> die () {
> code=$?
> - if test -n "$GIT_EXIT_OK"
> + if test -n "$GIT_EXIT_CODE"
> then
> - exit $code
> + exit $GIT_EXIT_CODE
> else
> echo >&5 "FATAL: Unexpected exit with code $code"
> exit 1
> fi
> }
$code can be removed now, right?
Jonathan
next prev parent reply other threads:[~2009-10-09 19:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-09 18:39 [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE Brandon Casey
2009-10-09 18:39 ` [PATCH 2/2] Makefile: use the native (Korn) shell on SunOS and IRIX/IRIX64 Brandon Casey
2009-10-09 19:28 ` Jonathan Nieder [this message]
2009-10-09 20:01 ` [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE Jonathan Nieder
2009-10-09 21:33 ` Junio C Hamano
2009-10-09 22:37 ` Brandon Casey
2009-10-10 0:57 ` Junio C Hamano
2009-10-10 12:01 ` Clemens Buchacher
2009-10-10 12:24 ` Andreas Schwab
2009-10-10 12:53 ` Ben Walton
2009-10-10 14:03 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091009192812.GA4122@progeny.tock \
--to=jrnieder@gmail.com \
--cc=casey@nrlssc.navy.mil \
--cc=drafnel@gmail.com \
--cc=drizzd@aon.at \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).