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

Message ID 20230712075910.22480-5-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>
---
 .../kvm/x86_64/userspace_msr_exit_test.c      | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)
  

Comments

Philippe Mathieu-Daudé July 18, 2023, 12:26 p.m. UTC | #1
On 12/7/23 09:59, Thomas Huth wrote:
> 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>
> ---
>   .../kvm/x86_64/userspace_msr_exit_test.c      | 19 ++++++-------------
>   1 file changed, 6 insertions(+), 13 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
  

Patch

diff --git a/tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c b/tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c
index 3533dc2fbfeeb..9843528bba0c6 100644
--- a/tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c
+++ b/tools/testing/selftests/kvm/x86_64/userspace_msr_exit_test.c
@@ -8,6 +8,7 @@ 
 #define _GNU_SOURCE /* for program_invocation_short_name */
 #include <sys/ioctl.h>
 
+#include "kselftest_harness.h"
 #include "test_util.h"
 #include "kvm_util.h"
 #include "vmx.h"
@@ -527,7 +528,7 @@  static void run_guest_then_process_ucall_done(struct kvm_vcpu *vcpu)
 	process_ucall_done(vcpu);
 }
 
-static void test_msr_filter_allow(void)
+TEST(msr_filter_allow)
 {
 	struct kvm_vcpu *vcpu;
 	struct kvm_vm *vm;
@@ -646,7 +647,7 @@  static void handle_wrmsr(struct kvm_run *run)
 	}
 }
 
-static void test_msr_filter_deny(void)
+TEST(msr_filter_deny)
 {
 	struct kvm_vcpu *vcpu;
 	struct kvm_vm *vm;
@@ -693,7 +694,7 @@  static void test_msr_filter_deny(void)
 	kvm_vm_free(vm);
 }
 
-static void test_msr_permission_bitmap(void)
+TEST(msr_permission_bitmap)
 {
 	struct kvm_vcpu *vcpu;
 	struct kvm_vm *vm;
@@ -786,7 +787,7 @@  static void run_msr_filter_flag_test(struct kvm_vm *vm)
 }
 
 /* Test that attempts to write to the unused bits in a flag fails. */
-static void test_user_exit_msr_flags(void)
+TEST(user_exit_msr_flags)
 {
 	struct kvm_vcpu *vcpu;
 	struct kvm_vm *vm;
@@ -804,13 +805,5 @@  static void test_user_exit_msr_flags(void)
 
 int main(int argc, char *argv[])
 {
-	test_msr_filter_allow();
-
-	test_msr_filter_deny();
-
-	test_msr_permission_bitmap();
-
-	test_user_exit_msr_flags();
-
-	return 0;
+	return test_harness_run(argc, argv);
 }