Test::Unit exit status

The version of testunit that I’m using doesn’t appear to return
a non-zero exit status when it finds failures or errors.

Does a newer version set this, or does anyone have a patch
to do this? (I haven’t browsed the source yet…)

Thanks,

···

–
Bil Kleb
NASA Langley Research Center
Hampton, Virginia, USA

The version of testunit that I’m using doesn’t appear to
return a non-zero exit status when it finds failures or errors.

Does a newer version set this, or does anyone have a patch
to do this? (I haven’t browsed the source yet…)

Is there a way to set the exit status besides Kernel#exit()? The
difficulty is that the runners do not (and should not) explicitly exit.
One way around this is to do the following in the test you’re running:

exit(1)
unless(Test::Unit::UI::Console::TestRunner.start(MyTestSuite).passed?)

The other facet of this is automatic running via #at_exit, and I don’t
think I can do anything there, either. The problem is that calling #exit
from an #at_exit block doesn’t set the exit status (I guess because
#at_exit blocks happen after the official exit of the program).

I’d love to hear about other possibilities…

Nathaniel

<:((><

···

Bil Kleb [mailto:William.L.Kleb@NASA.Gov] wrote:

RoleModel Software, Inc.
EQUIP VI

How about not using at_exit, and instead using oh, say,
zentestrunner.rb…

···

nathaniel@NOSPAMtalbott.ws (nathaniel@NOSPAMtalbott.ws) wrote:

Bil Kleb [mailto:William.L.Kleb@NASA.Gov] wrote:

The version of testunit that I’m using doesn’t appear to
return a non-zero exit status when it finds failures or errors.

Does a newer version set this, or does anyone have a patch
to do this? (I haven’t browsed the source yet…)

Is there a way to set the exit status besides Kernel#exit()? The
difficulty is that the runners do not (and should not) explicitly exit.
One way around this is to do the following in the test you’re running:

exit(1)
unless(Test::Unit::UI::Console::TestRunner.start(MyTestSuite).passed?)

The other facet of this is automatic running via #at_exit, and I don’t
think I can do anything there, either. The problem is that calling #exit
from an #at_exit block doesn’t set the exit status (I guess because
#at_exit blocks happen after the official exit of the program).

I’d love to hear about other possibilities…

–
Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04