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

fs tests: Skip UNC path types in Dir.rename tests #17147

Merged
merged 1 commit into from
Sep 14, 2023
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
18 changes: 12 additions & 6 deletions lib/std/fs/test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,12 @@ test "deleteDir" {
test "Dir.rename files" {
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
// Rename on Windows can hit intermittent AccessDenied errors
// when certain conditions are true about the host system.
// For now, skip this test when the path type is UNC to avoid them.
// See https://github.com/ziglang/zig/issues/17134
if (ctx.path_type == .unc) return;

const missing_file_path = try ctx.transformPath("missing_file_name");
const something_else_path = try ctx.transformPath("something_else");

Expand Down Expand Up @@ -711,6 +717,12 @@ test "Dir.rename files" {
test "Dir.rename directories" {
try testWithAllSupportedPathTypes(struct {
fn impl(ctx: *TestContext) !void {
// Rename on Windows can hit intermittent AccessDenied errors
// when certain conditions are true about the host system.
// For now, skip this test when the path type is UNC to avoid them.
// See https://github.com/ziglang/zig/issues/17134
if (ctx.path_type == .unc) return;

const test_dir_path = try ctx.transformPath("test_dir");
const test_dir_renamed_path = try ctx.transformPath("test_dir_renamed");

Expand All @@ -722,12 +734,6 @@ test "Dir.rename directories" {
try testing.expectError(error.FileNotFound, ctx.dir.openDir(test_dir_path, .{}));
var dir = try ctx.dir.openDir(test_dir_renamed_path, .{});

// The next rename in this test can hit intermittent AccessDenied
// errors when certain conditions are true about the host system.
// For now, return early when the path type is UNC to avoid them.
// See https://github.com/ziglang/zig/issues/17134
if (ctx.path_type == .unc) return;

// Put a file in the directory
var file = try dir.createFile("test_file", .{ .read = true });
file.close();
Expand Down