From b81a1c61ec6c70586e56d29b66b261dadf1d4fe8 Mon Sep 17 00:00:00 2001 From: Giuseppe Di Natale Date: Fri, 30 Jun 2017 11:12:29 -0700 Subject: 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 Reviewed-by: George Melikov Signed-off-by: Giuseppe Di Natale Closes #6281 --- tests/test-runner/include/logapi.shlib | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/test-runner/include') diff --git a/tests/test-runner/include/logapi.shlib b/tests/test-runner/include/logapi.shlib index d9f276e0e..fabfc42b1 100644 --- a/tests/test-runner/include/logapi.shlib +++ b/tests/test-runner/include/logapi.shlib @@ -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 } -- cgit v1.2.3