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

Message ID 20230712075910.22480-4-thuth@redhat.com
State New
Headers
Series Use TAP in some more x86 KVM selftests |

Commit Message

Thomas Huth July 12, 2023, 7:59 a.m. UTC
  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(-)
  

Patch

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);
+}