OSDN Git Service

KVM: selftests: Print expected and actual exit reason in KVM exit reason assert
authorVipin Sharma <vipinsh@google.com>
Sat, 4 Feb 2023 01:45:45 +0000 (17:45 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Mar 2023 14:20:09 +0000 (10:20 -0400)
Print what KVM exit reason a test was expecting and what it actually
got int TEST_ASSERT_KVM_EXIT_REASON().

Signed-off-by: Vipin Sharma <vipinsh@google.com>
Message-Id: <20230204014547.583711-3-vipinsh@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/include/test_util.h

index a136635..a6e9f21 100644 (file)
@@ -67,7 +67,8 @@ void test_assert(bool exp, const char *exp_str,
        __u32 exit_reason = (vcpu)->run->exit_reason;                   \
                                                                        \
        TEST_ASSERT(exit_reason == (expected),                          \
-                   "Unexpected exit reason: %u (%s)",                  \
+                   "Wanted KVM exit reason: %u (%s), got: %u (%s)",    \
+                   (expected), exit_reason_str((expected)),            \
                    exit_reason, exit_reason_str(exit_reason));         \
 } while (0)