Commit ba300a72 authored by Sean Christopherson's avatar Sean Christopherson
Browse files

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: default avatarSean Christopherson <seanjc@google.com>
parent 6e1cce7c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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);
}