[PATCH 3/4] KVM: selftests: x86: Use TAP interface in the fix_hypercall test

Thomas Huth
2023-07-12T08:00:12Z

Use the kselftest_harness.h interface in this test to get TAP
output, so that it is easier for the user to see what the test
is doing.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
.../selftests/kvm/x86_64/fix_hypercall_test.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c b/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c
index 0f728f05ea82f..7621942a072ec 100644
--- a/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c
+++ b/tools/testing/selftests/kvm/x86_64/fix_hypercall_test.c
@@ -9,6 +9,7 @@
#include <linux/stringify.h>
#include <stdint.h>

+#include "kselftest_harness.h"
#include "apic.h"
#include "test_util.h"
#include "kvm_util.h"
@@ -126,10 +127,19 @@ static void test_fix_hypercall(bool disable_quirk)
enter_guest(vcpu);
}

-int main(void)
+TEST(fix_hypercall)
{
- TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) & KVM_X86_QUIRK_FIX_HYPERCALL_INSN);
-
test_fix_hypercall(false);
+}
+
+TEST(fix_hypercall_disable_quirk)
+{
test_fix_hypercall(true);
}
+
+int main(int argc, char *argv[])
+{
+ TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) & KVM_X86_QUIRK_FIX_HYPERCALL_INSN);
+
+ return test_harness_run(argc, argv);
+}
--
2.39.3