diff options
| author | Sean Christopherson <seanjc@google.com> | 2025-05-16 14:59:08 -0700 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2025-06-20 13:39:10 -0700 |
| commit | ba300a728f6f764828d735f01f314900fb6a8315 (patch) | |
| tree | 1405aebd9350b1cf5e54a0ddff484f6ab90c6712 /tools/testing/selftests/kvm/lib/kvm_util.c | |
| parent | 6e1cce7cda1b69e455f89dbc0eeec128506fe969 (diff) | |
KVM: selftests: Play nice with EACCES errors in open_path_or_exit()
Expand the SKIP conditions of the open_path_or_exit() helper to skip on
EACCES as well as ENOENT. Most often, lack of permissions to a file
needed by a KVM selftests is due to a file being root-only by default,
not because of any bug/misconfiguration that warrants failing a test.
Link: https://lore.kernel.org/r/20250516215909.2551628-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing/selftests/kvm/lib/kvm_util.c')
| -rw-r--r-- | tools/testing/selftests/kvm/lib/kvm_util.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 41c7d04d32bd..f3a80057816e 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -37,9 +37,10 @@ int __open_path_or_exit(const char *path, int flags, const char *enoent_help) return fd; error: - if (errno == ENOENT) + if (errno == EACCES || errno == ENOENT) ksft_exit_skip("- Cannot open '%s': %s. %s\n", - path, strerror(errno), enoent_help); + path, strerror(errno), + errno == EACCES ? "Root required?" : enoent_help); TEST_FAIL("Failed to open '%s'", path); } |