RFR(XS) 8218029 [TESTBUG] Use -Djava.class.path= to specify empty -cp in CDS tests

Calvin Cheung calvin.cheung at oracle.com
Thu Jan 31 05:10:36 UTC 2019


Thanks for the clarifications. The fix makes sense.

thanks,
Calvin

On 1/30/19, 7:51 PM, Ioi Lam wrote:
> Hi Calvin,
>
> The command-line that you gave (on the Linux shell) would pass the 
> empty string as the value for -cp.
>
> However, in the JTREG test cases included in this patch, the 
> command-line that's executed is effectively the following as typed in 
> a Linux shell
>
> $ java -cp \"\" MyApp
>
> Here's a way to reproduce the problem. You can see that the string 
> with 2 double quote characters were recorded in the NON_EXIST part of 
> the CDS archive. That's not the intention of the test case.
>
> ================
>
> $ echo sun/tools/jar/Main > classlist
>
> $ java -Xshare:dump -cp \"\" -XX:SharedClassListFile=classlist 
> -verbose | grep Main
> [0.100s][info][class,load] sun.tools.jar.Main source: jrt:/jdk.jartool
> [0.103s][info][class,load] sun.tools.jar.Main$CRC32OutputStream 
> source: jrt:/jdk.jartool
> [0.106s][info][class,load] sun.tools.jar.Main$ModuleInfoEntry source: 
> jrt:/jdk.jartool
>
> $ tbjava -Xshare:on -XX:+PrintSharedArchiveAndExit
> [0.002s][info][class,path] opened: 
> /jdk/bld/sandbox/images/jdk/lib/modules
> [0.007s][info][class,path] type=BOOT
> [0.007s][info][class,path] Expecting BOOT 
> path=/jdk/bld/sandbox/images/jdk/lib/modules
> [0.007s][info][class,path] ok
> [0.007s][info][class,path] type=APP
> [0.007s][info][class,path] Expecting -Djava.class.path=""
> [0.007s][info][class,path]
> [0.007s][info][class,path] Run time APP classpath is shorter than the 
> one at dump time:
> [0.007s][info][class,path] type=NON_EXIST
> [0.007s][info][class,path] Expecting that "" does not exist
> [0.007s][info][class,path] ok
> [0.007s][info][class,path] checking shared classpath entry: 
> /jdk/bld/sandbox/images/jdk/lib/modules
> [0.007s][info][class,path] ok
> archive is invalid
> ================
>
> Thanks
>
> - Ioi
>
>
> On 1/30/19 3:03 PM, Calvin Cheung wrote:
>> Hi Ioi,
>>
>> The fix looks fine but I'm not sure if it is necessary.
>>
>> I've tried the following on linux and windows and the java.class.path 
>> property is not set.
>>
>> java -cp "" MyApp
>>
>> MyApp just display all system properties as follows:
>>
>>         Properties properties = System.getProperties();
>>
>>         properties.forEach((k, v) -> System.out.println(k + ":" + v));
>>
>> thanks,
>> Calvin
>>
>> On 1/29/19, 7:51 PM, Ioi Lam wrote:
>>> https://bugs.openjdk.java.net/browse/JDK-8218029
>>> http://cr.openjdk.java.net/~iklam/jdk13/8218029-testbug-empty-classpath.v01/ 
>>>
>>>
>>> Please review this simple fix. For portability,
>>>
>>>      "-cp", "\"\"",
>>>
>>> in the JVM command-line is replaced with
>>>
>>>      "-Djava.class.path="
>>>
>>>
>>> Thanks!
>>>
>>> Ioi
>>>


More information about the hotspot-runtime-dev mailing list