[apparmor] [PATCH] tests: Don't silently ignore test errors
Steve Beattie
steve at nxnw.org
Wed Apr 23 23:04:45 UTC 2014
On Wed, Apr 23, 2014 at 05:16:00PM -0500, Tyler Hicks wrote:
> When there was a test error, such as a shell command failure, the
> function used for the ERR trap, error_handler(), was causing the error
> to be silently ignored by the test runner.
>
> It was calling exit_handler() directly, before calling fatalerror().
> This caused $_fatal to be left unset when exit_handler() was called.
> exit_handler() sources epilogue.inc and the last bit of epilogue.inc
> exits with $num_testfailures if $_fatal was unset. The fatalerror() call
> site in error_hanlder() was never reached. So, as long as there were no
> test failures, then an error in a test script would cause the test to
> exit early with 0.
>
> It is safe to simply call fatalerror() from error_handler() because
> fatalerror() sets $_fatal to true and exits. This causes exit_handler()
> to be called and since $_fatal is set to true, prologue.inc exits with
> 127.
>
> Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
Acked-by: Steve Beattie <steve at nxnw.org>
Nice catch, thanks!
--
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140423/1728647d/attachment.pgp>
More information about the AppArmor
mailing list