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 <[email protected]> --- tests/regression/apparmor/prologue.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/regression/apparmor/prologue.inc b/tests/regression/apparmor/prologue.inc index b50d3d5..6536417 100755 --- a/tests/regression/apparmor/prologue.inc +++ b/tests/regression/apparmor/prologue.inc @@ -76,9 +76,6 @@ testfailed() error_handler() { - #invoke exit_handler to cleanup - exit_handler - fatalerror "Unexpected shell error. Run with -x to debug" } -- 1.9.1 -- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
