Print fail messages before callbacks in test suite

Reorder operations in _endlog so failure messages get
printed prior to performing callbacks and cleanup. This
helps clarify why a test failed and places the message
closer to the point of incident in the resulting logs.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Closes #6281
This commit is contained in:
Giuseppe Di Natale 2017-06-30 11:12:29 -07:00 committed by Brian Behlendorf
parent aa6e82a6a5
commit b81a1c61ec
1 changed files with 6 additions and 4 deletions

View File

@ -418,7 +418,11 @@ function _endlog
typeset logfile="/tmp/log.$$"
_recursive_output $logfile
if [[ $1 == $STF_FAIL ]] ; then
typeset exitcode=$1
shift
(( ${#@} > 0 )) && _printline "$@"
if [[ $exitcode == $STF_FAIL ]] ; then
_execute_testfail_callbacks
fi
@ -428,9 +432,7 @@ function _endlog
log_note "Performing local cleanup via log_onexit ($cleanup)"
$cleanup
fi
typeset exitcode=$1
shift
(( ${#@} > 0 )) && _printline "$@"
exit $exitcode
}