Skip to content

Commit 1af3bf2

Browse files
committed
KVM: selftests: Fix MWAIT error message when guest assertion fails
Print out the test and vector as intended when a guest assert fails an assertion regarding MONITOR/MWAIT faulting. Unfortunately, the guest printf support doesn't detect such issues at compile-time, so the bug manifests as a confusing error message, e.g. in the most confusing case, the test complains that it got vector "0" instead of expected vector "0". Fixes: 0f52e4a ("KVM: selftests: Convert the MONITOR/MWAIT test to use printf guest asserts") Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Link: https://lore.kernel.org/r/20231107182159.404770-1-seanjc@google.com Link: https://lore.kernel.org/r/20231129224916.532431-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent e29f5d0 commit 1af3bf2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ do { \
2727
\
2828
if (fault_wanted) \
2929
__GUEST_ASSERT((vector) == UD_VECTOR, \
30-
"Expected #UD on " insn " for testcase '0x%x', got '0x%x'", vector); \
30+
"Expected #UD on " insn " for testcase '0x%x', got '0x%x'", \
31+
testcase, vector); \
3132
else \
3233
__GUEST_ASSERT(!(vector), \
33-
"Expected success on " insn " for testcase '0x%x', got '0x%x'", vector); \
34+
"Expected success on " insn " for testcase '0x%x', got '0x%x'", \
35+
testcase, vector); \
3436
} while (0)
3537

3638
static void guest_monitor_wait(int testcase)

0 commit comments

Comments
 (0)