Unit tests broken on windows cmd/psh

11 views
Skip to first unread message

Charles Nicholson

unread,
Dec 9, 2025, 1:53:52 PM (9 days ago) Dec 9
to gn-dev
Hi GN folks-

The GN unit tests that compare the results of "gn format" seem to have been broken for a while on Windows when the repo is cloned through cmd or powershell. (I'm guessing not many people build GN from windows, and use a pre-built binary instead?) I'm pretty sure it's just a CRLF vs LF thing- I noticed in the .gitattributes file in the root that *.gn and *.gni are tset as "text eol=lf" but there's no corresponding entry for the *.golden files. So, the tests fail because the *.gn files get LF and the *.golden files end up getting CRLF and then don't compare exactly.

I think it's as simple as adding the following line to the .gitattributes file:

*.golden text eol=lf

(and, hopefully, adding a native cmd/psh configuration to whatever CI exists!)

In the meantime I'm happy to just skip running the unit tests on windows, but I figured I'd report it.

Best,
Charles

Roland McGrath

unread,
Dec 9, 2025, 2:14:22 PM (9 days ago) Dec 9
to Charles Nicholson, gn-dev
The CI is at https://ci.chromium.org/p/gn/g/gn/console and you can see there that the Windows bot does happily build and run tests.
I don't know how the bot setup differs from your environment.

Your change seems fine to me and you can send it for review via https://gn-review.googlesource.com and we'll approve and land it.
I'm not clear on why we don't just use `*` there instead of matching specific suffixes.

Charles Nicholson

unread,
Dec 9, 2025, 2:34:08 PM (9 days ago) Dec 9
to Roland McGrath, gn-dev
I'm on a completely vanilla win11 installation and running stock git from https://git-scm.com/install/windows to clone GN from a clean powershell instance.

I wonder if this has to do with whether the git repository is cloned from inside a git-bash instance, and what the global git settings are? To be honest, I'm not sure why it works over on luci with the asymmetrical gitattributes, unless something over there is auto-CRLF-ing everything via a setting. It makes sense to me that it fails; GN's .gitattributes are currently set up to force *.golden to be different from *.gn, unless there's some other override somewhere.

Anyway, I tried to open a CL; I made a gerrit account on the GN instance with my gmail SSO identity but then when I tried to push my local .gitattributes fix to submit it for review, I got a terminal challenge for username/password and stopped. I don't really have the appetite to re-learn Gerrit authorization from my Google days; I'd appreciate someone who's already set up doing it, or I'll just happily live without running the unit tests after building GN.

Best,
Charles
Reply all
Reply to author
Forward
0 new messages