| ... | ... | @@ -182,20 +182,21 @@ fn testWithPathTypeIfSupported(comptime path_type: PathType, comptime path_sep: |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | // For use in test setup. If the symlink creation fails on Windows with |
| 185 | | // AccessDenied, then make the test failure silent (it is not a Zig failure). |
| 185 | // AccessDenied/PermissionDenied/FileSystem, then make the test failure silent (it is not a Zig failure). |
| 186 | 186 | fn setupSymlink(io: Io, dir: Dir, target: []const u8, link: []const u8, flags: SymLinkFlags) !void { |
| 187 | 187 | return dir.symLink(io, target, link, flags) catch |err| switch (err) { |
| 188 | | // Symlink requires admin privileges on windows, so this test can legitimately fail. |
| 189 | | error.AccessDenied => if (native_os == .windows) return error.SkipZigTest else return err, |
| 188 | // On Windows, symlinks require admin privileges and the underlying filesystem must support symlinks |
| 189 | error.AccessDenied, error.PermissionDenied, error.FileSystem => if (native_os == .windows) return error.SkipZigTest else return err, |
| 190 | 190 | else => return err, |
| 191 | 191 | }; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | // For use in test setup. If the symlink creation fails on Windows with |
| 195 | | // AccessDenied, then make the test failure silent (it is not a Zig failure). |
| 195 | // AccessDeniedPermissionDenied/FileSystem, then make the test failure silent (it is not a Zig failure). |
| 196 | 196 | fn setupSymlinkAbsolute(io: Io, target: []const u8, link: []const u8, flags: SymLinkFlags) !void { |
| 197 | 197 | return Dir.symLinkAbsolute(io, target, link, flags) catch |err| switch (err) { |
| 198 | | error.AccessDenied => if (native_os == .windows) return error.SkipZigTest else return err, |
| 198 | // On Windows, symlinks require admin privileges and the underlying filesystem must support symlinks |
| 199 | error.AccessDenied, error.PermissionDenied, error.FileSystem => if (native_os == .windows) return error.SkipZigTest else return err, |
| 199 | 200 | else => return err, |
| 200 | 201 | }; |
| 201 | 202 | } |
| ... | ... | @@ -2373,13 +2374,7 @@ test "readlinkat" { |
| 2373 | 2374 | try tmp.dir.writeFile(io, .{ .sub_path = "file.txt", .data = "nonsense" }); |
| 2374 | 2375 | |
| 2375 | 2376 | // create a symbolic link |
| 2376 | | tmp.dir.symLink(io, "file.txt", "link", .{}) catch |err| switch (err) { |
| 2377 | | error.AccessDenied => { |
| 2378 | | // Symlink requires admin privileges on windows, so this test can legitimately fail. |
| 2379 | | if (native_os == .windows) return error.SkipZigTest; |
| 2380 | | }, |
| 2381 | | else => |e| return e, |
| 2382 | | }; |
| 2377 | try setupSymlink(io, tmp.dir, "file.txt", "link", .{}); |
| 2383 | 2378 | |
| 2384 | 2379 | // read the link |
| 2385 | 2380 | var buffer: [Dir.max_path_bytes]u8 = undefined; |