KVM: selftests: x86: Use TAP interface in the sync_regs test
authorThomas Huth <thuth@redhat.com>
Thu, 8 Feb 2024 20:48:41 +0000 (21:48 +0100)
committerSean Christopherson <seanjc@google.com>
Wed, 28 Feb 2024 20:58:12 +0000 (20:58 +0000)
commitba97ed0af6fe22dd718535ce663297ccd0ff52c5
treefdd036a3fca3560d2030e950e72f6b23b0e436ad
parent55f2cf88486cdc504176d4c5ebccdb65ea4be161
KVM: selftests: x86: Use TAP interface in the sync_regs test

The sync_regs test currently does not have any output (unless one
of the TEST_ASSERT statement fails), so it's hard to say for a user
whether a certain new sub-test has been included in the binary or
not. Let's make this a little bit more user-friendly and include
some TAP output via the kselftest_harness.h / kvm_test_harness.h
interface.
To be able to use the interface, we have to break up the huge main()
function here in more fine grained parts - then we can use the new
KVM_ONE_VCPU_TEST() macro to define the individual tests. Since these
are run with a separate VM now, we have also to make sure to create
the expected state at the beginning of each test, so some parts grow
a little bit - which should be OK considering that the individual
tests are more self-contained now.

Suggested-by: David Matlack <dmatlack@google.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Link: https://lore.kernel.org/r/20240208204844.119326-6-thuth@redhat.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/x86_64/sync_regs_test.c