On 19/05/21 23:49, Ben Gardon wrote:
On Wed, May 19, 2021 at 1:03 PM Axel Rasmussen <axelrasmussen@xxxxxxxxxx> wrote:
Previously, if this check failed, we'd just exit quietly with no output.
This can be confusing, so print out a short message indicating why the
test is being skipped.
Signed-off-by: Axel Rasmussen <axelrasmussen@xxxxxxxxxx>
Reviewed-by: Ben Gardon <bgardon@xxxxxxxxxx>
---
tools/testing/selftests/kvm/lib/kvm_util.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index f05ca919cccb..0d6ddee429b9 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -53,8 +53,10 @@ int kvm_check_cap(long cap)
int kvm_fd;
kvm_fd = open(KVM_DEV_PATH, O_RDONLY);
- if (kvm_fd < 0)
+ if (kvm_fd < 0) {
+ print_skip("KVM not available, errno: %d", errno);
exit(KSFT_SKIP);
+ }
This is a wonderful change. I believe this will only be hit if KVM is
built as a module and that module has not yet been loaded, so this
message could also suggest that the user check if the KVM / KVM
arch/vendor specific module has been loaded.
Let's make it
print_skip("%s not available, is KVM loaded? (errno: %d)",
KVM_DEV_PATH, errno);
Paolo