JDK-8187806 : executeTestJava handles -cp differently in jdk.test.lib.process.ProcessTools and jdk.testlibrary.ProcessTools
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: test
  • Affected Version: 10
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2017-09-22
  • Updated: 2018-09-13
  • Resolved: 2018-09-13
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.
Other
tbd_majorResolved
Related Reports
Duplicate :  
Relates :  
Description
jdk.test.lib.process.ProcessTools.executeTestJava always adds -cp, while jdk.testlibrary.ProcessTools.executeTestJava does not.

See details:
(all created by createJavaProcessBuilder(false, command))

jdk.test.lib.process.ProcessTools:
    public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) {
...
329:        args.add("-cp");
330:        args.add(System.getProperty("java.class.path"));
331:
332:        if (addTestVmAndJavaOptions) {
333:            Collections.addAll(args, Utils.getTestJavaOpts());
334:        }


jdk.testlibrary.ProcessTools:
    public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) {
...
288:        if (addTestVmAndJavaOptions) {
289:            // -cp is needed to make sure the same classpath is used whether the test is
290:            // run in AgentVM mode or OtherVM mode. It was added to the hotspot version
291:            // of this API as part of 8077608. However, for the jdk version it is only
292:            // added when addTestVmAndJavaOptions is true in order to minimize
293:            // disruption to existing JDK tests, which have yet to be tested with -cp
294:            // being added. At some point -cp should always be added to be consistent
295:            // with what the hotspot version does.
296:            args.add("-cp");
297:            args.add(System.getProperty("java.class.path"));
298:            Collections.addAll(args, Utils.getTestJavaOpts());
299:        }

In case test need to run with specified "-cp", jdk.testlibrary.ProcessTools.executeTestJava make it easier (example: test/jdk/java/lang/reflect/Proxy/ProxyTest.java).

This inconsistent needs to be resolved while trying to remove  jdk.testlibrary.ProcessTools
Comments
fixed by JDK-8210112
13-09-2018