* [PATCH] selftests/kvm: Add error messages before skipping tests in vm_xsave_req_perm()
@ 2022-07-04 16:35 Gautam Menghani
2022-07-07 23:10 ` Sean Christopherson
0 siblings, 1 reply; 2+ messages in thread
From: Gautam Menghani @ 2022-07-04 16:35 UTC (permalink / raw)
To: pbonzini, shuah
Cc: Gautam Menghani, yang.zhong, jmattson, peterx, guang.zeng,
wei.w.wang, dmatlack, vkuznets, kvm, linux-kselftest,
linux-kernel-mentees, linux-kernel
Add messages in the checks that are performed before making a request
with ARCH_REQ_XCOMP_GUEST_PERM.
Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
---
tools/testing/selftests/kvm/lib/x86_64/processor.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index ead7011ee8f6..c74e846661b7 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -643,11 +643,15 @@ void vm_xsave_req_perm(int bit)
if (rc == -1 && (errno == ENXIO || errno == EINVAL))
exit(KSFT_SKIP);
TEST_ASSERT(rc == 0, "KVM_GET_DEVICE_ATTR(0, KVM_X86_XCOMP_GUEST_SUPP) error: %ld", rc);
- if (!(bitmask & (1ULL << bit)))
+ if (!(bitmask & (1ULL << bit))) {
+ print_skip("Userspace address of attr data is blank");
exit(KSFT_SKIP);
+ }
- if (!is_xfd_supported())
+ if (!is_xfd_supported()) {
+ print_skip("XFD is not supported");
exit(KSFT_SKIP);
+ }
rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM, bit);
--
2.36.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests/kvm: Add error messages before skipping tests in vm_xsave_req_perm()
2022-07-04 16:35 [PATCH] selftests/kvm: Add error messages before skipping tests in vm_xsave_req_perm() Gautam Menghani
@ 2022-07-07 23:10 ` Sean Christopherson
0 siblings, 0 replies; 2+ messages in thread
From: Sean Christopherson @ 2022-07-07 23:10 UTC (permalink / raw)
To: Gautam Menghani
Cc: pbonzini, shuah, yang.zhong, jmattson, peterx, guang.zeng,
wei.w.wang, dmatlack, vkuznets, kvm, linux-kselftest,
linux-kernel-mentees, linux-kernel
On Mon, Jul 04, 2022, Gautam Menghani wrote:
> Add messages in the checks that are performed before making a request
> with ARCH_REQ_XCOMP_GUEST_PERM.
>
> Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
> ---
> tools/testing/selftests/kvm/lib/x86_64/processor.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> index ead7011ee8f6..c74e846661b7 100644
> --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
> +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
> @@ -643,11 +643,15 @@ void vm_xsave_req_perm(int bit)
> if (rc == -1 && (errno == ENXIO || errno == EINVAL))
> exit(KSFT_SKIP);
> TEST_ASSERT(rc == 0, "KVM_GET_DEVICE_ATTR(0, KVM_X86_XCOMP_GUEST_SUPP) error: %ld", rc);
> - if (!(bitmask & (1ULL << bit)))
> + if (!(bitmask & (1ULL << bit))) {
> + print_skip("Userspace address of attr data is blank");
> exit(KSFT_SKIP);
> + }
>
> - if (!is_xfd_supported())
> + if (!is_xfd_supported()) {
> + print_skip("XFD is not supported");
> exit(KSFT_SKIP);
> + }
This is no longer necessary as of commit 7ed397d107d4 ("KVM: selftests: Add
TEST_REQUIRE macros to reduce skipping copy+paste"), which will automagically
print the missing requirement before calling exit().
Thanks much for the patch though!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-07 23:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-04 16:35 [PATCH] selftests/kvm: Add error messages before skipping tests in vm_xsave_req_perm() Gautam Menghani
2022-07-07 23:10 ` Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).