Normally Python converts all newline characters, Windows or Unix,
to Unix newlines when opening a file. However, lit opens files in
binary mode, which does not perform this conversion. As a result,
trailing Windows newlines are not stripped from test input, which
caused a failure in the TestRunner unit test:
FAIL: test_custom (__main__.TestIntegratedTestKeywordParser) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\bgesiak\src\llvm\llvm\utils\lit\tests\unit\TestRunner.py", line 109, in test_custom self.assertItemsEqual(value, ['a', 'b', 'c']) AssertionError: Element counts were not equal: First has 1, Second has 0: 'c\r' First has 0, Second has 1: 'c'
Fix the discrepancy in behavior across the two platforms by
manually stripping Windows newlines before yielding each line in
the test file.