Thread (25 messages) flat view 25 messages, 5 authors, 2018-03-01

Re: [Problem] test_must_fail makes possibly questionable assumptions about exit_code.

From: demerphq <hidden>
Date: 2018-03-01 15:30:54

On 1 March 2018 at 16:08, Jeff King [off-list ref] wrote:
On Thu, Mar 01, 2018 at 09:28:31AM -0500, Randall S. Becker wrote:
quoted
quoted
It's not clear to me though if we just want to tweak the programs run in the
test scripts in order to get test_must_fail to stop complaining, or if we
consider the unusual exit codes from our perl-based Git programs to be an
error that should be fixed for real use, too.
I'm living unusual exit code IRL all the time. So "fixed for real", is
what I'm looking for. So if we were to do that, where is the best
place to insert a fix - my original question - that would be permanent
in the main git test code. Or perhaps this needs to be in the main
code itself.
If it's fixed in the real world, then it needs to be in the main code
itself. It looks like git-svn already does this to some degree itself
(most of the work happens in an eval, and it calls the "fatal" function
if that throws an exception via 'die').

So I think git-send-email.perl (and maybe others) needs to learn the
same trick (by pushing the main bits of the script into an eval). Or it
needs to include the SIG{__DIE__} trickery at the beginning of the
script.

I think the SIG{__DIE__} stuff could go into Git/PredictableDie.pm or
something, and then any scripts that need it could just "use
Git::PredictableDie".

Does that make sense?
To me yes. By putting it in a module and 'use'ing it early you
guarantee it will be set up before any code following it is even
compiled.

If there is an existing module that the git perl code always uses then
it could go in there in a BEGIN{} block instead of adding the new
module.

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help