Skip to content

Commit 40b319d

Browse files
committed
KVM: selftests: Convert x86's set BSP ID test to printf style guest asserts
Convert the set_boot_cpu_id test to use printf-based guest asserts, specifically the EQ and NE variants. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent b13a307 commit 40b319d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*
55
* Copyright (C) 2020, Red Hat, Inc.
66
*/
7+
#define USE_GUEST_ASSERT_PRINTF 1
8+
79
#define _GNU_SOURCE /* for program_invocation_name */
810
#include <fcntl.h>
911
#include <stdio.h>
@@ -20,7 +22,7 @@ static void guest_bsp_vcpu(void *arg)
2022
{
2123
GUEST_SYNC(1);
2224

23-
GUEST_ASSERT(get_bsp_flag() != 0);
25+
GUEST_ASSERT_NE(get_bsp_flag(), 0);
2426

2527
GUEST_DONE();
2628
}
@@ -29,7 +31,7 @@ static void guest_not_bsp_vcpu(void *arg)
2931
{
3032
GUEST_SYNC(1);
3133

32-
GUEST_ASSERT(get_bsp_flag() == 0);
34+
GUEST_ASSERT_EQ(get_bsp_flag(), 0);
3335

3436
GUEST_DONE();
3537
}
@@ -65,7 +67,7 @@ static void run_vcpu(struct kvm_vcpu *vcpu)
6567
stage);
6668
break;
6769
case UCALL_ABORT:
68-
REPORT_GUEST_ASSERT_2(uc, "values: %#lx, %#lx");
70+
REPORT_GUEST_ASSERT(uc);
6971
default:
7072
TEST_ASSERT(false, "Unexpected exit: %s",
7173
exit_reason_str(vcpu->run->exit_reason));

0 commit comments

Comments
 (0)