naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
Blob Blame History Raw
From 895cc5ef78f91ed542d8be6a057033b7992ad91e Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 17 Jun 2022 17:28:13 +0200
Subject: [PATCH] test: run the custom check hooks before common checks

since we delete the guest journals as part of the save_journal() step in
check_result_common(), making journal inaccessible from the custom check
hooks.

(cherry picked from commit 35d2d2e61c7695b87a4ee3dc54d065f4de95f260)

Related: #2087652
---
 test/test-functions | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/test/test-functions b/test/test-functions
index 93ab32b68d..1306dcf260 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -1433,10 +1433,7 @@ check_result_nspawn() {
     local workspace="${1:?}"
     local ret
 
-    check_result_common "${workspace}"
-    ret=$?
-
-    # Run additional test-specific checks if defined by check_result_nspawn_hook()
+    # Run a test-specific checks if defined by check_result_nspawn_hook()
     if declare -F check_result_nspawn_hook >/dev/null; then
         if ! check_result_nspawn_hook "${workspace}"; then
             derror "check_result_nspawn_hook() returned with EC > 0"
@@ -1444,6 +1441,9 @@ check_result_nspawn() {
         fi
     fi
 
+    check_result_common "${workspace}"
+    ret=$?
+
     _umount_dir "${initdir:?}"
 
     return $ret
@@ -1454,10 +1454,7 @@ check_result_qemu() {
     local ret
     mount_initdir
 
-    check_result_common "${initdir:?}"
-    ret=$?
-
-    # Run additional test-specific checks if defined by check_result_qemu_hook()
+    # Run a test-specific checks if defined by check_result_qemu_hook()
     if declare -F check_result_qemu_hook >/dev/null; then
         if ! check_result_qemu_hook "${initdir:?}"; then
             derror "check_result_qemu_hook() returned with EC > 0"
@@ -1465,6 +1462,9 @@ check_result_qemu() {
         fi
     fi
 
+    check_result_common "${initdir:?}"
+    ret=$?
+
     _umount_dir "${initdir:?}"
 
     return $ret