]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: correctly propagate return code from check_result hooks
authorFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 11 Aug 2023 14:39:30 +0000 (16:39 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 11 Aug 2023 14:57:06 +0000 (16:57 +0200)
test/test-functions

index 7092276b8e2da90e9aa10623d8ca789f56c67483..4b4587aca761afcf39fc2a1bf98ef52275bd6cd9 100644 (file)
@@ -1768,7 +1768,7 @@ check_result_common() {
 
 check_result_nspawn() {
     local workspace="${1:?}"
-    local ret
+    local ret=0
 
     # Run a test-specific checks if defined by check_result_nspawn_hook()
     if declare -F check_result_nspawn_hook >/dev/null; then
@@ -1778,7 +1778,7 @@ check_result_nspawn() {
         fi
     fi
 
-    check_result_common "${workspace}" && ret=0 || ret=$?
+    check_result_common "${workspace}" || ret=$?
 
     _umount_dir "${initdir:?}"
 
@@ -1787,7 +1787,7 @@ check_result_nspawn() {
 
 # can be overridden in specific test
 check_result_qemu() {
-    local ret
+    local ret=0
     mount_initdir
 
     # Run a test-specific checks if defined by check_result_qemu_hook()
@@ -1798,7 +1798,7 @@ check_result_qemu() {
         fi
     fi
 
-    check_result_common "${initdir:?}" && ret=0 || ret=$?
+    check_result_common "${initdir:?}" || ret=$?
 
     _umount_dir "${initdir:?}"