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

wine is failing some std lib file system tests #5988

Open
andrewrk opened this issue Aug 5, 2020 · 1 comment
Open

wine is failing some std lib file system tests #5988

andrewrk opened this issue Aug 5, 2020 · 1 comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. downstream An issue with a third party project that uses Zig. os-windows
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Aug 5, 2020

In order for the std lib tests to all pass using Wine, the following tests must be disabled:

diff --git a/lib/std/fs/test.zig b/lib/std/fs/test.zig
index b3cc1fe56..dc43c416e 100644
--- a/lib/std/fs/test.zig
+++ b/lib/std/fs/test.zig
@@ -16,6 +16,8 @@ const File = std.fs.File;
 const tmpDir = testing.tmpDir;
 
 test "Dir.readLink" {
+    if (builtin.os.tag == .windows) return error.SkipZigTest;
+
     var tmp = tmpDir(.{});
     defer tmp.cleanup();
 
@@ -51,6 +53,7 @@ fn testReadLink(dir: Dir, target_path: []const u8, symlink_path: []const u8) !vo
 
 test "readLinkAbsolute" {
     if (builtin.os.tag == .wasi) return error.SkipZigTest;
+    if (builtin.os.tag == .windows) return error.SkipZigTest;
 
     var tmp = tmpDir(.{});
     defer tmp.cleanup();
@@ -142,6 +145,8 @@ fn contains(entries: *const std.ArrayList(Dir.Entry), el: Dir.Entry) bool {
 }
 
 test "Dir.realpath smoke test" {
+    if (builtin.os.tag == .windows) return error.SkipZigTest;
+
     switch (builtin.os.tag) {
         .linux, .windows, .macosx, .ios, .watchos, .tvos => {},
         else => return error.SkipZigTest,
@@ -215,6 +220,8 @@ test "readAllAlloc" {
 }
 
 test "directory operations on files" {
+    if (builtin.os.tag == .windows) return error.SkipZigTest;
+
     var tmp_dir = tmpDir(.{});
     defer tmp_dir.cleanup();
 
@@ -243,6 +250,8 @@ test "directory operations on files" {
 }
 
 test "file operations on directories" {
+    if (builtin.os.tag == .windows) return error.SkipZigTest;
+
     var tmp_dir = tmpDir(.{});
     defer tmp_dir.cleanup();
 
@@ -275,6 +284,8 @@ test "file operations on directories" {
 }
 
 test "Dir.rename files" {
+    if (builtin.os.tag == .windows and builtin.arch == .i386) return error.SkipZigTest;
+
     var tmp_dir = tmpDir(.{});
     defer tmp_dir.cleanup();
 
@@ -384,6 +395,7 @@ test "rename" {
 
 test "renameAbsolute" {
     if (builtin.os.tag == .wasi) return error.SkipZigTest;
+    if (builtin.os.tag == .windows and builtin.arch == .i386) return error.SkipZigTest;
 
     var tmp_dir = tmpDir(.{});
     defer tmp_dir.cleanup();
@@ -459,6 +471,7 @@ test "makePath, put some files in it, deleteTree" {
 
 test "access file" {
     if (builtin.os.tag == .wasi) return error.SkipZigTest;
+    if (builtin.os.tag == .windows) return error.SkipZigTest;
 
     var tmp = tmpDir(.{});
     defer tmp.cleanup();
diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig
index 0a453d8b2..7b8b73ccb 100644
--- a/lib/std/os/test.zig
+++ b/lib/std/os/test.zig
@@ -27,6 +27,7 @@ const ArenaAllocator = std.heap.ArenaAllocator;
 
 test "open smoke test" {
     if (builtin.os.tag == .wasi) return error.SkipZigTest;
+    if (builtin.os.tag == .windows) return error.SkipZigTest;
 
     // TODO verify file attributes using `fstat`
 
@@ -116,6 +117,7 @@ test "openat smoke test" {
 
 test "symlink with relative paths" {
     if (builtin.os.tag == .wasi) return error.SkipZigTest;
+    if (builtin.os.tag == .windows) return error.SkipZigTest;
 
     const cwd = fs.cwd();
     cwd.deleteFile("file.txt") catch {};
@@ -153,6 +155,7 @@ test "symlink with relative paths" {
 
 test "readlink on Windows" {
     if (builtin.os.tag != .windows) return error.SkipZigTest;
+    if (builtin.os.tag == .windows) return error.SkipZigTest;
 
     try testReadlink("C:\\ProgramData", "C:\\Users\\All Users");
     try testReadlink("C:\\Users\\Default", "C:\\Users\\Default User");
@@ -188,6 +191,8 @@ test "fstatat" {
 }
 
 test "readlinkat" {
+    if (builtin.os.tag == .windows) return error.SkipZigTest;
+
     var tmp = tmpDir(.{});
     defer tmp.cleanup();
 

As responsible open source citizens, it is our duty to file helpful bug reports to the Wine project and potentially also submit fixes. This is an issue to track that progress.

@andrewrk andrewrk added contributor friendly This issue is limited in scope and/or knowledge of Zig internals. os-windows downstream An issue with a third party project that uses Zig. labels Aug 5, 2020
@andrewrk andrewrk added this to the 1.1.0 milestone Aug 5, 2020
@rootbeer
Copy link
Contributor

I've spent a little time trying to get Zig's "test-std" to pass under Wine. Here are a couple issues I've run into:

  • GetFinalPathNameByHandle does not handle the kinds of paths QueryObjectName returns in Wine. The Zig fix in Windows: Deal with NT namespaced paths in GetFinalPathNameByHandle #17541 addresses this.

  • https://bugs.winehq.org/show_bug.cgi?id=12401: Wine doesn't support FSCTL_SET_REPARSE_POINT. This DeviceIoControl command is used in Zig to implement Windows symlink support. From what I can tell there are some preliminary patches for Wine (from 2012), but they're incomplete because there are a lot of corner cases.

  • https://bugs.winehq.org/show_bug.cgi?id=56175: Wine uses up-to-date Unicode tables, and Windows does not. So the upcaseW test in std/os/windows/nls.zig will fail when the Wine runtime successfully upcases characters that are newly upcasable (e.g., Greek Letter Yot U+3f3). The Wine folks consider this not a bug on their side, which is reasonable.

There are definitely other failures that I did not investigate, too. I was mostly interested in using Wine to run Zig's filesystem symlink-related tests, but given the underlying issue in Wine, I don't see that getting fixed soon. So I won't dig into the other Wine-related failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. downstream An issue with a third party project that uses Zig. os-windows
Projects
None yet
Development

No branches or pull requests

2 participants