[PATCH blktests 1/4] check: fix exit status code handling

Shin'ichiro Kawasaki <[email protected]>
Newsgroups org.infradead.lists.linux-nvme,org.kernel.vger.linux-block
Message-ID <[email protected]>
Commit e50a5ff644f3 ("check: call _unload_module() after
fallback_device_cleanup()") added a _unload_module() call to
_check_and_call(). However, after this commit, _check_and_call() no
longer returns the exit status of _call_test(). Then, the check script
does not return non-zero exit status even when any test case fails. Fix
this by adding a local variable to keep the exit status of _call_test().

Fixes: e50a5ff644f3 ("check: call _unload_module() after fallback_device_cleanup()")
Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
---
 check | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/check b/check
index bc2dde9..61524a5 100755
--- a/check
+++ b/check
@@ -701,7 +701,7 @@ _unload_modules() {
 }
 
 _check_and_call_test() {
-	local postfix
+	local postfix ret
 
 	if declare -fF requires >/dev/null; then
 		requires
@@ -710,7 +710,9 @@ _check_and_call_test() {
 	[[ -n $COND_DESC ]] && postfix=_${COND_DESC//[ =]/_}
 	RESULTS_DIR="$OUTPUT/nodev${postfix}"
 	_call_test test
+	ret=$?
 	_unload_modules
+	return $ret
 }
 
 _check_and_call_test_device() {
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.