From: Junio C Hamano <gitster@pobox.com>
To: Brandon Casey <casey@nrlssc.navy.mil>
Cc: git@vger.kernel.org, Brandon Casey <drafnel@gmail.com>
Subject: Re: [PATCH] t0005: add test for trap handling from deeply nested function calls
Date: Fri, 26 Mar 2010 13:10:16 -0700 [thread overview]
Message-ID: <7v7hoykfo7.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <vm2zHZjrZOha7LnIM_9fAEAvwVZrJtZlAI9f2XI_VUsdqr51ihAMW68a5BT9tvMdRDSqk6GYlSE@cipher.nrlssc.navy.mil> (Brandon Casey's message of "Fri\, 26 Mar 2010 11\:34\:05 -0500")
Brandon Casey <casey@nrlssc.navy.mil> writes:
> From: Brandon Casey <drafnel@gmail.com>
>
> The /usr/xpg4/bin/sh shell on Solaris only executes a trap handler set
> within a function from the first-level function call made from within the
> function that set the trap. In other words, if func1 sets a trap, then
> calls func2 which triggers the trap, then the trap handler will be executed
> correctly. If instead of exiting, func2 calls func3, and func3 satisfies
> the conditions for triggering the trap, the trap handler will NOT be
> executed.
>
> This trap sequence exists in git-bisect.sh and is exercised by tests
> t6030.12 and t6030.13 which fail when the /usr/xpg4/bin/sh shell is used.
>
> Add a test that will fail sooner and more precisely than the t6030 tests.
That would be useful if you run all the tests in sequence.
It smells like the real solution is to fix git-bisect.sh not to do that
trap trick, if we can.
Or perhaps have this not as an individual test but as a code to set a test
prerequiste token (e.g. NESTED_TRAP) to run tests of bisect conditionally?
>
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
> ---
>
>
> Improvements to the commit message are welcome.
>
> -brandon
>
>
> t/t0005-signals.sh | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/t/t0005-signals.sh b/t/t0005-signals.sh
> index 09f855a..cb68d1f 100755
> --- a/t/t0005-signals.sh
> +++ b/t/t0005-signals.sh
> @@ -19,4 +19,12 @@ test_expect_success 'sigchain works' '
> test_cmp expect actual
> '
>
> +test_expect_success 'trap triggered in deeply nested function works correctly' '
> + (atrap () { exit 0; }
> + func3 () { exit 1; }
> + func2 () { func3; }
> + func1 () { trap atrap EXIT; func2; }
> + func1)
> +'
> +
> test_done
> --
> 1.6.6.2
next prev parent reply other threads:[~2010-03-26 20:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-26 16:34 [PATCH] t0005: add test for trap handling from deeply nested function calls Brandon Casey
2010-03-26 20:10 ` Junio C Hamano [this message]
2010-03-26 20:19 ` Johannes Sixt
2010-03-27 0:24 ` Brandon Casey
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=7v7hoykfo7.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=casey@nrlssc.navy.mil \
--cc=drafnel@gmail.com \
--cc=git@vger.kernel.org \
/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