authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-09-13 19:11:35-07:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-09-14 16:30:41+03:00
log742030a8f27190ce36fd7b240c2def6774dfdb63
tree33df62ed20b7f86c7e48771f9f7743519977ddc3
parent8fb4a4efbabbe3fe98521201eac41feee5a9a50a

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

Follow up to https://github.com/ziglang/zig/pull/17136. The `Dir.rename files` test has now also been seen to fail in CI, so now all rename tests are skipped for the UNC path type. This is a heavy handed approach to hopefully get rid of any flakiness related to rename & UNC paths. See https://github.com/ziglang/zig/issues/17134

1 files changed, 12 insertions(+), 6 deletions(-)

lib/std/fs/test.zig+12-6
......@@ -675,6 +675,12 @@ test "deleteDir" {
675675test "Dir.rename files" {
676676 try testWithAllSupportedPathTypes(struct {
677677 fn impl(ctx: *TestContext) !void {
678 // Rename on Windows can hit intermittent AccessDenied errors
679 // when certain conditions are true about the host system.
680 // For now, skip this test when the path type is UNC to avoid them.
681 // See https://github.com/ziglang/zig/issues/17134
682 if (ctx.path_type == .unc) return;
683
678684 const missing_file_path = try ctx.transformPath("missing_file_name");
679685 const something_else_path = try ctx.transformPath("something_else");
680686
......@@ -711,6 +717,12 @@ test "Dir.rename files" {
711717test "Dir.rename directories" {
712718 try testWithAllSupportedPathTypes(struct {
713719 fn impl(ctx: *TestContext) !void {
720 // Rename on Windows can hit intermittent AccessDenied errors
721 // when certain conditions are true about the host system.
722 // For now, skip this test when the path type is UNC to avoid them.
723 // See https://github.com/ziglang/zig/issues/17134
724 if (ctx.path_type == .unc) return;
725
714726 const test_dir_path = try ctx.transformPath("test_dir");
715727 const test_dir_renamed_path = try ctx.transformPath("test_dir_renamed");
716728
......@@ -722,12 +734,6 @@ test "Dir.rename directories" {
722734 try testing.expectError(error.FileNotFound, ctx.dir.openDir(test_dir_path, .{}));
723735 var dir = try ctx.dir.openDir(test_dir_renamed_path, .{});
724736
725 // The next rename in this test can hit intermittent AccessDenied
726 // errors when certain conditions are true about the host system.
727 // For now, return early when the path type is UNC to avoid them.
728 // See https://github.com/ziglang/zig/issues/17134
729 if (ctx.path_type == .unc) return;
730
731737 // Put a file in the directory
732738 var file = try dir.createFile("test_file", .{ .read = true });
733739 file.close();