commit 742030a8f27190ce36fd7b240c2def6774dfdb63 (tree)
parent 8fb4a4efbabbe3fe98521201eac41feee5a9a50a
Author: Ryan Liptak <squeek502@hotmail.com>
Date: Wed, 13 Sep 2023 19:11:35 -0700
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
Diffstat:
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/lib/std/fs/test.zig b/lib/std/fs/test.zig
@@ -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");
@@ -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");
@@ -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();