Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip eacces spec for superuser #13227

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion spec/std/file_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,15 @@ describe "File" do
pending_win32 "raises when reading a file with no permission" do
with_tempfile("file.txt") do |path|
File.touch(path)
File.chmod(path, 0)
File.chmod(path, File::Permissions::None)
{% if flag?(:unix) %}
# TODO: Find a better way to execute this spec when running as privileged
# user. Compiling a program and running a separate process would be a
# lot of overhead.
if LibC.getuid == 0
pending! "Spec cannot run as superuser"
end
{% end %}
expect_raises(File::AccessDeniedError) { File.read(path) }
end
end
Expand Down