fix(tools): read the select_tests changed-file list as UTF-8 with a byte order mark

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
xXPBSXxandClaude Sonnet 5.5 committed 2026-10-20 03:00:15 +02:00
1 parent a569f47cb7
commit 3f007a8798
2 files changed
+8 -1

No files matched your search

+1 -1
View File
@@ -237,7 +237,7 @@ def main():
print("full run: no test graph")
return 0
graph = json.loads(Path(args.graph).read_text(encoding="utf-8"))
changed = [line.strip() for line in Path(args.changed).read_text(encoding="utf-8").splitlines() if line.strip()]
changed = [line.strip() for line in Path(args.changed).read_text(encoding="utf-8-sig").splitlines() if line.strip()]
picked, full = select(graph, changed)
if picked is None:
print(f"full run: {', '.join(full[:5])}")
+7
View File
@@ -101,6 +101,13 @@ class SelectTests(unittest.TestCase):
self.assertIsNone(selected)
self.assertIn(changed, output)
def test_changed_list_with_a_byte_order_mark_and_crlf_keeps_its_first_path(self):
listed = self.build / "changed bom.txt"
listed.write_bytes(b"\xef\xbb\xbfCMakeLists.txt\r\nalpha/alpha.h\r\n")
output = self.tool("select", self.build, self.graph, listed)
self.assertIn("CMakeLists.txt", output)
self.assertFalse((self.build / "select.tests").exists())
def test_missing_graph_runs_everything(self):
self.assertIsNone(self.select("alpha/alpha.h", graph=self.build / "missing.json")[1])