Skip to content

Commit f2ff9ba

Browse files
fmeumclaude
andcommitted
Normalize line endings in RewindingTestsHelper.buildAndGetOutput
Genrule output files may contain mixed line endings: source files written by testCase.write() use System.lineSeparator(), but echo in the genrule command always produces \n. On platforms where the system line separator is \r\n, this causes buildAndGetOutput assertions to fail with "line contents match, but line-break characters differ". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f2d1481 commit f2ff9ba

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/test/java/com/google/devtools/build/lib/skyframe/rewinding/RewindingTestsHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,9 @@ final String buildAndGetOutput(String pkg, BuildIntegrationTestCase testCase) th
337337
return ExecResult.delegate();
338338
});
339339
testCase.buildTarget(String.format("//%s:consume_output", pkg));
340-
return invocationOutput.get();
340+
// Genrule output may have mixed line endings: source files written by testCase.write() use
341+
// System.lineSeparator(), but echo in the genrule command always produces \n.
342+
return invocationOutput.get().replace("\r\n", "\n").replace("\r", "\n");
341343
}
342344

343345
public final void runNoLossSmokeTest() throws Exception {

0 commit comments

Comments
 (0)