OSDN Git Service

KVM: selftests: Convert s390's tprot test to printf style GUEST_ASSERT
authorSean Christopherson <seanjc@google.com>
Sat, 29 Jul 2023 00:36:26 +0000 (17:36 -0700)
committerSean Christopherson <seanjc@google.com>
Wed, 2 Aug 2023 21:43:07 +0000 (14:43 -0700)
Convert s390's tprot test to printf-based GUEST_ASSERT.

Link: https://lore.kernel.org/r/20230729003643.1053367-18-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/s390x/tprot.c

index 40d3ea1..c12c682 100644 (file)
@@ -4,6 +4,7 @@
  *
  * Copyright IBM Corp. 2021
  */
+#define USE_GUEST_ASSERT_PRINTF 1
 
 #include <sys/mman.h>
 #include "test_util.h"
@@ -156,7 +157,9 @@ static enum stage perform_next_stage(int *i, bool mapped_0)
                       !mapped_0;
                if (!skip) {
                        result = test_protection(tests[*i].addr, tests[*i].key);
-                       GUEST_ASSERT_2(result == tests[*i].expected, *i, result);
+                       __GUEST_ASSERT(result == tests[*i].expected,
+                                      "Wanted %u, got %u, for i = %u",
+                                      tests[*i].expected, result, *i);
                }
        }
        return stage;
@@ -190,7 +193,7 @@ static void guest_code(void)
        vcpu_run(__vcpu);                                       \
        get_ucall(__vcpu, &uc);                                 \
        if (uc.cmd == UCALL_ABORT)                              \
-               REPORT_GUEST_ASSERT_2(uc, "hints: %lu, %lu");   \
+               REPORT_GUEST_ASSERT(uc);                        \
        TEST_ASSERT_EQ(uc.cmd, UCALL_SYNC);                     \
        TEST_ASSERT_EQ(uc.args[1], __stage);                    \
 })