Re: [Perlunit-users] getting the exit status "right"
Status: Beta
Brought to you by:
mca1001
From: Robert S. <rsc...@no...> - 2011-05-25 19:47:27
|
Hi Matt, On 05/19/2011 03:50 PM, Matthew Astley wrote: > On Wed, May 18, 2011 at 09:39:44AM -0400, Robert Schweikert wrote: > >> Using the unit test framework for some Perl work and am running into >> a bit of trouble. > > Hi Robert, > > I'm glad to hear it's still useful. > >> When a test fails [...] I get an appropriate error message such as >> "not ok ERROR test_...." the exit status of the test is still 0. > > I agree that Perlunit has this all "wrong" in v0.25 - test runners > should exit with a non-zero return code. None of them do. > > Unfortunately this used to be implemented in the T:U:TestRunner module > but was downgraded from exit to die, then again to just return, > because it was causing trouble for other code. I assume this was the > GUI runner, which expects to continue running after the tests have > finished. > > There's no test for the text-mode runners' exit code... > > I added a bug for this, > https://sourceforge.net/tracker/?func=detail&aid=3304750&group_id=2653&atid=102653 > Thanks for filing the bug. > >> -> perl myTest.t >> ..... >> ERROR >> .... >> -> echo $? >> 0 > > While there are no test runners in v0.25 which will return the correct > exit code, you may be able to get the result you need by having one > t/run_tests.t execute all your test classes under HarnessUnit, and run > prove(1) to call this in the usual way. > > This way you will be able to use prove's exit code, which *is* correct. Thanks for this tip. I was not aware of prove. I tested this and changed my test setup to use prove to run the tests. > > Your invocation "perl myTest.t" above suggests you have started down > this road. Does that myTest.t emit TAP (test anything protocol)? No, I am not using TAP. Robert -- Robert Schweikert MAY THE SOURCE BE WITH YOU SUSE-IBM Software Integration Center LINUX Tech Lead rsc...@no... rsc...@ca... 781-464-8147 |