diff options
author | Sean Christopherson <seanjc@google.com> | 2023-07-29 02:36:38 +0200 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-08-02 23:43:14 +0200 |
commit | 417bfd0c820f17f40572aca37e5134ed329b791f (patch) | |
tree | fead6b827c46802973af919c21190447b745f3dc /tools/testing/selftests/kvm | |
parent | KVM: selftests: Convert x86's TSC MSRs test to use printf guest asserts (diff) | |
download | linux-417bfd0c820f17f40572aca37e5134ed329b791f.tar.xz linux-417bfd0c820f17f40572aca37e5134ed329b791f.zip |
KVM: selftests: Convert the x86 userspace I/O test to printf guest assert
Convert x86's userspace I/O test to use printf-based guest asserts.
Link: https://lore.kernel.org/r/20230729003643.1053367-30-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm')
-rw-r--r-- | tools/testing/selftests/kvm/x86_64/userspace_io_test.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/userspace_io_test.c b/tools/testing/selftests/kvm/x86_64/userspace_io_test.c index 0cb51fa42773..2c5d2a18d184 100644 --- a/tools/testing/selftests/kvm/x86_64/userspace_io_test.c +++ b/tools/testing/selftests/kvm/x86_64/userspace_io_test.c @@ -1,4 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 +#define USE_GUEST_ASSERT_PRINTF 1 + #include <fcntl.h> #include <stdio.h> #include <stdlib.h> @@ -20,8 +22,8 @@ static void guest_ins_port80(uint8_t *buffer, unsigned int count) end = (unsigned long)buffer + 8192; asm volatile("cld; rep; insb" : "+D"(buffer), "+c"(count) : "d"(0x80) : "memory"); - GUEST_ASSERT_1(count == 0, count); - GUEST_ASSERT_2((unsigned long)buffer == end, buffer, end); + GUEST_ASSERT_EQ(count, 0); + GUEST_ASSERT_EQ((unsigned long)buffer, end); } static void guest_code(void) @@ -43,7 +45,9 @@ static void guest_code(void) memset(buffer, 0, sizeof(buffer)); guest_ins_port80(buffer, 8192); for (i = 0; i < 8192; i++) - GUEST_ASSERT_2(buffer[i] == 0xaa, i, buffer[i]); + __GUEST_ASSERT(buffer[i] == 0xaa, + "Expected '0xaa', got '0x%x' at buffer[%u]", + buffer[i], i); GUEST_DONE(); } @@ -91,7 +95,7 @@ int main(int argc, char *argv[]) case UCALL_DONE: break; case UCALL_ABORT: - REPORT_GUEST_ASSERT_2(uc, "argN+1 = 0x%lx, argN+2 = 0x%lx"); + REPORT_GUEST_ASSERT(uc); default: TEST_FAIL("Unknown ucall %lu", uc.cmd); } |