Skip to content

Commit bac9aee

Browse files
committed
KVM: selftests: Convert debug-exceptions to printf style GUEST_ASSERT
Convert ARM's debug exceptions test to use printf-based GUEST_ASSERT(). Opportunistically Use GUEST_ASSERT_EQ() in guest_code_ss() so that the expected vs. actual values get printed out. Link: https://lore.kernel.org/r/20230729003643.1053367-12-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent db44e1c commit bac9aee

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tools/testing/selftests/kvm/aarch64/debug-exceptions.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
2+
#define USE_GUEST_ASSERT_PRINTF 1
3+
24
#include <test_util.h>
35
#include <kvm_util.h>
46
#include <processor.h>
@@ -365,7 +367,7 @@ static void guest_wp_handler(struct ex_regs *regs)
365367

366368
static void guest_ss_handler(struct ex_regs *regs)
367369
{
368-
GUEST_ASSERT_1(ss_idx < 4, ss_idx);
370+
__GUEST_ASSERT(ss_idx < 4, "Expected index < 4, got '%u'", ss_idx);
369371
ss_addr[ss_idx++] = regs->pc;
370372
regs->pstate |= SPSR_SS;
371373
}
@@ -410,8 +412,8 @@ static void guest_code_ss(int test_cnt)
410412
/* Userspace disables Single Step when the end is nigh. */
411413
asm volatile("iter_ss_end:\n");
412414

413-
GUEST_ASSERT(bvr == w_bvr);
414-
GUEST_ASSERT(wvr == w_wvr);
415+
GUEST_ASSERT_EQ(bvr, w_bvr);
416+
GUEST_ASSERT_EQ(wvr, w_wvr);
415417
}
416418
GUEST_DONE();
417419
}
@@ -450,7 +452,7 @@ static void test_guest_debug_exceptions(uint8_t bpn, uint8_t wpn, uint8_t ctx_bp
450452
vcpu_run(vcpu);
451453
switch (get_ucall(vcpu, &uc)) {
452454
case UCALL_ABORT:
453-
REPORT_GUEST_ASSERT_2(uc, "values: %#lx, %#lx");
455+
REPORT_GUEST_ASSERT(uc);
454456
break;
455457
case UCALL_DONE:
456458
goto done;

0 commit comments

Comments
 (0)