JDK-8211180 : SourceLauncherTest.java fails in JDK12 CI on Win*
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 12
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: x86_64
  • Submitted: 2018-09-26
  • Updated: 2021-06-25
  • Resolved: 2018-09-26
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 12
12 b14Fixed
Related Reports
Relates :  
Description
The following test is failing in the JDK12 CI:

    tools/javac/launcher/SourceLauncherTest.java

Here's a snippet of the failing log:

26 tests, 1 errors
java.lang.Exception: 1 errors found
	at toolbox.TestRunner.runTests(TestRunner.java:116)
	at SourceLauncherTest.main(SourceLauncherTest.java:64)
	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)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:246)
	at java.base/java.lang.Thread.run(Thread.java:835)

JavaTest Message: Test threw exception: java.lang.Exception
JavaTest Message: shutting down test

result: Failed. Execution failed: `main' threw exception: java.lang.Exception: 1 errors found


test result: Failed. Execution failed: `main' threw exception: java.lang.Exception: 1 errors found
Comments
Chuckle: burnt by my own past experience! It is a perennial problem, comparing golden text on Windows. This time, with that in mind, I was too clever by half, and proactively converted platform newlines in the generated output to \n, not realizing that the method being used for the comparison was doing the opposite, and converting \n in the golden string to platform newlines!
26-09-2018

Yes, it's writing to a file, but that's irrelevant. java will accept either line separator on any platform, and besides, we're not seeing compilation errors from javac. Also, all the other similar test cases are working just fine. As I said previously, the info in the .jtr file says the error is in a mismatch between what the small program wrote (using System.out.println) and what the test is expecting that small program to write.
26-09-2018

Sorry yes line.separator :) So writeJavaFiles isn't really writing to a file. I'll leave it with you.
26-09-2018

1. Definitely not File.separator! You probably mean System.getProperty("line.separator") 2. Changing the line separator in the source given to javac via the source launcher would not cause this bug. The mismatch is in the text generated when the testPermissions test is run. I'm working on a fix.
26-09-2018

+ tb.writeJavaFiles(base, + "import java.net.URL;\n" + + "class ShowCodeSource {\n" + + " public static void main(String... args) {\n" + + " URL u = ShowCodeSource.class.getProtectionDomain().getCodeSource().getLocation();\n" + + " System.out.println(u);\n" + + " }\n" + + "}"); \n should be File.Separator ?
26-09-2018

Probably a newline problem in the test, since this "visible"text appears to match. test: testPermissions stdout: user.dir=T:\\testoutput\\jtreg\\JTwork\\scratch\\3 exception: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "user.dir" "write") Error: Unexpected output; expected: user.dir=T:\\testoutput\\jtreg\\JTwork\\scratch\\3 exception: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "user.dir" "write")
26-09-2018

The CI job set contains 5 changesets including this one: JDK-8210274 Source Launcher should work with a security manager I have not verified that the test failure is associated with JDK-8210274.
26-09-2018