This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix the transitive_includes test on Windows
ClosedPublic

Authored by mstorsjo on Jul 9 2022, 1:58 PM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rG8a002ab99eea: [libcxx] [test] Fix the transitive_includes test on Windows
Summary

The binary-mode writing to stdout can probably be written in different
ways - even though it's not as elegant as the original.

Diff Detail

Event Timeline

mstorsjo created this revision.Jul 9 2022, 1:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2022, 1:58 PM
mstorsjo requested review of this revision.Jul 9 2022, 1:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 9 2022, 1:58 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Aug 18 2022, 1:28 PM

LGTM but the writing in binary mode looks really arcane, I'd like to understand why it's needed.

libcxx/test/libcxx/transitive_includes.sanitize.py
38

Can you explain what's the problem with the original version?

This revision is now accepted and ready to land.Aug 18 2022, 1:28 PM
mstorsjo added inline comments.Aug 18 2022, 1:36 PM
libcxx/test/libcxx/transitive_includes.sanitize.py
38

The original version writes it as a text stream, so it gets \r\n newlines, which compares as different in the comparisons below.

As an alternative, we could also update the templates for generating the autogenerated parts, and making it call diff -w which ignores whitespace differences, which also should fix the issue.

mstorsjo updated this revision to Diff 453918.Aug 19 2022, 1:19 AM

Removed kludgy code for writing to stdout in binary mode in python, switched to using diff -w for a whitespace-insensitive comparison.

FWIW the only test failure in CI seems to be entirely unrelated to this, so if this seems ok I'll go ahead and push it later today, as this was what was discussed with Louis on discord.

This revision was landed with ongoing or failed builds.Aug 19 2022, 1:13 PM
This revision was automatically updated to reflect the committed changes.