Skip to content

Test failures on Windows and Linux #4

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

Closed
Parzival-3141 opened this issue Mar 8, 2025 · 6 comments
Closed

Test failures on Windows and Linux #4

Parzival-3141 opened this issue Mar 8, 2025 · 6 comments

Comments

@Parzival-3141
Copy link
Collaborator

Parzival-3141 commented Mar 8, 2025

Windows:

$ zig build test
test
└─ offline failure
error: clone::local::standard_unc_paths_are_written_git_style: ...\AppData\\Local\\zig\\p\\N-V-__8AAJbmLwHHxHDWkz0i6WIR6FpNe6tXSLzaPuWtvBBg\\tests\\libgit2/clone/local.c:220
error: Function call failed: (git_clone(&repo, unc.ptr, "./clone.git", &opts))
error: error -1 - unsupported URL protocol
error:

error: clone::local::git_style_unc_paths: ...\AppData\\Local\\zig\\p\\N-V-__8AAJbmLwHHxHDWkz0i6WIR6FpNe6tXSLzaPuWtvBBg\\tests\\libgit2/clone/local.c:247
error: Function call failed: (git_clone(&repo, git_unc.ptr, "./clone.git", &opts))
error: error -1 - unsupported URL protocol
error:

error: config::include::absolute: ...\AppData\\Local\\zig\\p\\N-V-__8AAJbmLwHHxHDWkz0i6WIR6FpNe6tXSLzaPuWtvBBg\\tests\\libgit2/config/include.c:35
error: Function call failed: (git_config_open_ondisk(&cfg, "config-include-absolute"))
error: error -1 - invalid escape at ...\AppData\Local\zig\p\N-V-__8AAJbmLwHHxHDWkz0i6WIR6FpNe6tXSLzaPuWtvBBg\tests\resources/config/config-included
error:

error: the following command exited with error code 3:
.zig-cache\o\fd6e784e1d2a6f09d4380f9fc26c8df5\libgit2_tests.exe -t -xonline
Linux: (fixed by #6)

$ zig build test
test
└─ offline failure
error: status::worktree::filemode_changes: .../.cache/zig/p/N-V-__8AAJbmLwHHxHDWkz0i6WIR6FpNe6tXSLzaPuWtvBBg/tests/libgit2/status/worktree.c:607
error: 0 != counts.wrong_status_flags_count
error: 0 != 3
error: 

error: status::worktree::filemode_non755: .../.cache/zig/p/N-V-__8AAJbmLwHHxHDWkz0i6WIR6FpNe6tXSLzaPuWtvBBg/tests/libgit2/status/worktree.c:645
error: 0 != counts.wrong_status_flags_count
error: 0 != 2
error: 

error: the following command exited with error code 2:
.zig-cache/o/27f082871f46a86e37f8ab9588aa140e/libgit2_tests -t -xonline 

@blurrycat
Copy link
Contributor

blurrycat commented Mar 25, 2025

I'm currently working on porting this to macOS, and I encounter the exact same failing tests as your Linux output on my end. I have other issues with the port at the moment so I'm fixing those, but I'll try to have a look into this too.

@blurrycat
Copy link
Contributor

blurrycat commented Mar 25, 2025

After a bit of investigation, it seems like status::worktree test breakage is related to Zig not honoring the executable permission on files extracted from archives downloaded by the package manager (in build.zig.zon): ziglang/zig#17463
After running the upstream test binary and the one built by the Zig port, there are indeed differences in the fixtures that are used for the tests, and since those tests in particular depend on the executable permissions on the files, it breaks.

I'm not sure how to fix this in the Zig build apart from manually patching the permissions on a few test fixtures before compiling the test executable (and clar generation step), but that seems a bit hacky.
EDIT: this is what I have done in the PR, but please do tell me if you have a better solution!

@Parzival-3141
Copy link
Collaborator Author

Thanks for checking it out! I think modifying the permissions is the best bet -- we'll still run the test and Zig ignores them in the hash anyway. Also lmk if you need any help with the macOS port.

@Parzival-3141
Copy link
Collaborator Author

For the clone::local errors, the error seems to be coming from malformed urls passed to transport_find_fn()

transport_find_fn URL: //localhost/C:/Users/pocke/AppData/Local/zig/p/N-V-__8AAJbmLwHHxHDWkz0i6WIR6FpNe6tXSLzaPuWtvBBg/tests/resources/testrepo.git
transport_find_fn URL: //localhost/C:\Users\pocke\AppData\Local\zig\p\N-V-__8AAJbmLwHHxHDWkz0i6WIR6FpNe6tXSLzaPuWtvBBg\tests\resources/testrepo.git

@Parzival-3141
Copy link
Collaborator Author

Narrowed it down to a failing _waccess call from git_fs_path_exists() in posix_w32.c. Here's the path it's trying to open

\\\\\?\\UNC\\localhost\\C:\\Users\\pocke\\AppData\\Local\\zig\\p\\N-V-__8AAJbmLwHHxHDWkz0i6WIR6FpNe6tXSLzaPuWtvBBg\\tests\\resources\\testrepo.git

@Parzival-3141
Copy link
Collaborator Author

Parzival-3141 commented Mar 31, 2025

Turns out the UNC styling functions were the problem. They assume their inputs only have posix seperators (/), so if you pass a canonical windows path (\) it'll totally break. Normalizing the fixture path in the build script fixed it, but their test harness should really handle this sort of thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants