Skip to content

Add zig fmt to cli tests#5655

Merged
andrewrk merged 4 commits intoziglang:masterfrom
squeek502:zig-fmt-cli-test
Jun 21, 2020
Merged

Add zig fmt to cli tests#5655
andrewrk merged 4 commits intoziglang:masterfrom
squeek502:zig-fmt-cli-test

Conversation

@squeek502
Copy link
Member

Should help to reduce the number of regressions that have been happening with zig fmt.

This is failing for me locally on Windows with unexpected status 0xC0000056 (STATUS_DELETE_PENDING), but is working on Linux. zig fmt is misbehaving for me on Windows currently though (AccessDenied or unexpected 0xC0000103 (NOT_A_DIRECTORY)) when invoking it normally, so I think it's catching an actual regression.

@andrewrk
Copy link
Member

This is failing for me locally on Windows

Is this after edea7a4? I did test that commit on windows before merging like this:

zig-cache\bin\zig.exe fmt ..\lib\std

@andrewrk
Copy link
Member

Also, I think this change might be able to be much simpler, just by changing

zig/build.zig

Line 50 in 5622044

const fmt_build_zig = b.addFmt(&[_][]const u8{"build.zig"});
from build.zig to a directory.

@andrewrk
Copy link
Member

Thanks BTW 👍

@squeek502
Copy link
Member Author

squeek502 commented Jun 21, 2020

This is failing for me locally on Windows

Is this after edea7a4? I did test that commit on windows before merging like this:

zig-cache\bin\zig.exe fmt ..\lib\std

Yes, after edea7a4.


C:\Users\Ryan\Programming\Zig\zig\build-release>".\bin\zig.exe" fmt ..\lib\std
unable to format '..\lib\std\os.zig': error.AccessDenied

(this is likely #5643)


C:\Users\Ryan\Programming\Zig\zig\build-release>".\bin\zig.exe" fmt ..\lib\std\os.zig
error.Unexpected NTSTATUS=0xc0000103
Unable to dump stack trace: debug info stripped
Unexpected

(this is likely caused by some change in edea7a4)


I'm still using Windows 7, though, so that could be the difference? EDIT: Don't think this is the problem; I'm expecting the CI to fail as well.

EDIT#2: CI is failing, so it's not Windows 7-specific:

The following command exited with error code 4294967295:
cd D:\a\1\s\zig-cache\clitest && D:\a\1\s\build\dist\bin\zig.exe fmt D:\a\1\s\zig-cache\clitest\fmt1.zig 
stderr:
Unexpected

@squeek502
Copy link
Member Author

squeek502 commented Jun 21, 2020

Also, I think this change might be able to be much simpler, just by changing

zig/build.zig

Line 50 in 5622044

const fmt_build_zig = b.addFmt(&[_][]const u8{"build.zig"});

from build.zig to a directory.

This would still be an incomplete test, since it doesn't actually make changes to the file (".\bin\zig.exe" fmt ..\build.zig works fine for me [it avoids the errors in the previous comment because no changes are made to the file]).

The added cli tests in this PR intentionally create files that will be changed by zig fmt, so they should be much more complete.

@andrewrk andrewrk merged commit 126f570 into ziglang:master Jun 21, 2020
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

Successfully merging this pull request may close these issues.

2 participants