RFR [XS] 8153300 - [TESTBUG] Enhance test/testlibrary/ClassFileInstaller.java to support JAR files
Ioi Lam
ioi.lam at oracle.com
Tue Apr 5 01:00:12 UTC 2016
Hi Misha,
Thanks for the review.
The Boolean.getBoolean(String) API actually will read the named system
property. So this is a common pattern used by the JDK source code. E.g.,
jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/Parser.java:
private static boolean pdebug =
Boolean.getBoolean("jstat.parser.debug");
Thanks
- Ioi
On 4/4/16 5:13 PM, Mikhailo Seledtsov wrote:
> Hi Ioi,
>
> I support the idea of incorporating jar file support into test utilities. A number of tests use jars instead of simple class files; this will simplify test development and maintenance.
>
> Overall this change looks good. I have one comment:
> ClassFileInstaller.java:75
> public static boolean DEBUG = Boolean.getBoolean("ClassFileInstaller.debug");
> I believe this should be:
> public static boolean DEBUG = Boolean.getBoolean(System.getProperty("ClassFileInstaller.debug", false));
>
> The rest looks good to me.
>
> Thank you,
> Misha
>
> >Sorry, the bug ID is 8153300. I have fixed the e-mail subject.
> >
> >- Ioi
> >
> >On 4/1/16 9:45 AM, Ioi Lam wrote:
> >/ Please review a very small fix:
> />/
> />/ http://cr.openjdk.java.net/~iklam/jdk9/8153300-enhance-classfileinstaller.v01/ <http://cr.openjdk.java.net/%7Eiklam/jdk9/8153300-enhance-classfileinstaller.v01/>
> />/
> />/
> />/ Bug: [TESTBUG] Enhance test/testlibrary/ClassFileInstaller.java to
> />/ support JAR files
> />/
> />/ https://bugs.openjdk.java.net/browse/JDK-8153300
> />/
> />/ Summary of fix:
> />/
> />/ Many hotspot tests need to create JAR files. The current method is
> />/ messy:
> />/
> />/ [1] Because JTREG compiles .class files into various directories,
> />/ we need
> />/ to use ClassFileInstaller to find the .class file and copy it
> />/ into the
> />/ current directory.
> />/ [2] Then, there are various ad-hoc calls to sun.tools.jar.Main to
> />/ create the
> />/ JAR file. This is not desirable because sun.tools.jar is an
> />/ internal
> />/ package and javac gives warnings about it.
> />/
> />/ I have improved ClassFileInstaller so that JAR files can be easily
> />/ created using JTREG tags:
> />/
> />/ * @build ClassFileInstaller sun.hotspot.WhiteBox
> />/ * @run main ClassFileInstaller -jar whitebox.jar sun.hotspot.WhiteBox
> />/
> />/ To handle more complex use cases, new APIs are also added to
> />/ ClassFileInstaller
> />/ for programmatically creating JAR files inside the test source code.
> />/
> />/ I converted two CDS test cases to use the new functionality.
> />/
> />/ FYI, I am also working on new tests for a closed issue
> />/ (JDK-8153297) that use
> />/ the new functionality.
> />/
> />/ Thanks
> />/ - Ioi
> />/
> />/
> />/
> /
More information about the hotspot-dev
mailing list