JDK-8204355 : [Graal] org.graalvm.compiler.debug.test.CSVUtilTest fails on Windows due to improper line separator used
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-06-05
  • Updated: 2018-07-06
  • Resolved: 2018-06-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12
11 b21Fixed 12Fixed
Related Reports
Duplicate :  
Description
org.graalvm.compiler.debug.test.CSVUtilTest fails on Windows due to improper line separator used

org.graalvm.compiler.debug.test.CSVUtilTest$Escape started (1 of 5)
  testEscape['XXX"YYY' to '"XXX\\"YYY"']: Passed 105.9 ms
  testEscape['X\\XX"YYY' to '"X\\\\XX\\"YYY"']: Passed 2.1 ms
org.graalvm.compiler.debug.test.CSVUtilTest$Escape finished 113.6 ms
org.graalvm.compiler.debug.test.CSVUtilTest$FormatStringBuilder started (2 of 5)
  testBuildFormatString[ [] to "" ]: Passed 6.5 ms
  testBuildFormatString[ [%s] to "%s" ]: Passed 3.2 ms
  testBuildFormatString[ [%s,%s] to "%s;%s" ]: Passed 3.1 ms
org.graalvm.compiler.debug.test.CSVUtilTest$FormatStringBuilder finished 16.2 ms
org.graalvm.compiler.debug.test.CSVUtilTest$Formatter started (3 of 5)
  testFormatter[format='%s;%s' args='XXX,YYY' output='XXX;YYY']: FAILED
testFormatter[format='%s;%s' args='XXX,YYY' output='XXX;YYY'](org.graalvm.compiler.debug.test.CSVUtilTest$Formatter)
org.junit.ComparisonFailure: expected:<XXX;YYY[]> but was:<XXX;YYY[
]>
	at org.junit.Assert.assertEquals(Assert.java:115)
	at org.junit.Assert.assertEquals(Assert.java:144)
	at org.graalvm.compiler.debug.test.CSVUtilTest$Formatter.testFormatter(CSVUtilTest.java:119)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

The issue is on line 119:
   111          @Test
   112          public void testFormatter() {
   113              ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
   114              // call the method under test
   115              CSVUtil.Escape.println(new PrintStream(outputStream), format, toObjectArray(args));
   116              // get the actual string
   117              String printedStream = new String(outputStream.toByteArray(), StandardCharsets.UTF_8);
   118              // remove newline
   119              assertEquals(expected, printedStream.substring(0, printedStream.length() - 1));
   120          }


System.getProperty("line.separator") or System.lineSeparator() (jdk8+) should be used instead of 1.

It seems similar issue exists in org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/util/Util.java as well
where new line is defined as 
 final String newLine = "\n";
Comments
[~dholmes] I think I had patch for CSVUtilTest in my local ws and this is why I missed it to add to problem list.
29-06-2018

Why wasn't this problem-listed before allowing it to cause CI test failures?
29-06-2018

yeah, that's why I created a PR against graal upstream repo -- https://github.com/oracle/graal/pull/503
28-06-2018

[~iignatyev] I think this issue should be fixed in Graal ws and then ported to jdk ws as part of Graal Update. This is why I didn't assign it to myself ;)
28-06-2018

ILW = Test fails due to wrong line separator (test bug), single Graal test on Windows (more tests might be affected), no workaround = MLH = P4
06-06-2018