< prev index next >
test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java
Print this page
*** 20,29 ****
--- 20,34 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
+ // NOTE: the test takes a long time for each VM option combination, so we split
+ // it into 3 @test parts, so that they can be executed in parallel. If you make a
+ // change, please ensure all @test blocks are in sync.
+
+
/*
* @test
* @summary Test options that are incompatible with use of shared strings
* Also test mismatch in oops encoding between dump time and run time
* @requires vm.cds.archived.java.heap
*** 34,46 ****
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @build HelloString
! * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions
*/
import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import sun.hotspot.code.Compiler;
--- 39,77 ----
* @library /test/lib /test/hotspot/jtreg/runtime/appcds
* @modules jdk.jartool/sun.tools.jar
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
* @build HelloString
! * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions 0
! */
!
!
! /*
! * @test
! * @requires vm.cds.archived.java.heap
! * @requires (vm.gc=="null")
! * @library /test/lib /test/hotspot/jtreg/runtime/appcds
! * @modules jdk.jartool/sun.tools.jar
! * @build sun.hotspot.WhiteBox
! * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
! * @build HelloString
! * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions 1
*/
+ /*
+ * @test
+ * @requires vm.cds.archived.java.heap
+ * @requires (vm.gc=="null")
+ * @library /test/lib /test/hotspot/jtreg/runtime/appcds
+ * @modules jdk.jartool/sun.tools.jar
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @build HelloString
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions 2
+ */
+
+
import jdk.test.lib.Asserts;
import jdk.test.lib.Platform;
import jdk.test.lib.process.OutputAnalyzer;
import sun.hotspot.code.Compiler;
*** 57,70 ****
"The shared archive file's ObjectAlignmentInBytes of .* does not equal the current ObjectAlignmentInBytes of";
static final String COMPACT_STRING_MISMATCH =
"The shared archive file's CompactStrings setting .* does not equal the current CompactStrings setting";
static String appJar;
! static String[] globalVmOptions;
public static void main(String[] args) throws Exception {
! globalVmOptions = args; // specified by "@run main" in IncompatibleOptions_*.java
appJar = JarBuilder.build("IncompatibleOptions", "HelloString");
// Uncompressed OOPs
testDump(1, "-XX:+UseG1GC", "-XX:-UseCompressedOops", COOPS_DUMP_WARNING, true);
if (GC.Z.isSupported()) { // ZGC is included in build.
--- 88,108 ----
"The shared archive file's ObjectAlignmentInBytes of .* does not equal the current ObjectAlignmentInBytes of";
static final String COMPACT_STRING_MISMATCH =
"The shared archive file's CompactStrings setting .* does not equal the current CompactStrings setting";
static String appJar;
! static String[] vmOptionsPrefix = {};
public static void main(String[] args) throws Exception {
! String[] noargs = {};
! SharedStringsUtils.run(Integer.parseInt(args[0]), 3, noargs, IncompatibleOptions::test);
! // Add a new @test block if you get an assert ----^ about this number. See
! // SharedStringsUtils.java for details.
! }
!
! public static void test(String[] args_ignored) throws Exception {
! vmOptionsPrefix = SharedStringsUtils.getChildVMOptionsPrefix();
appJar = JarBuilder.build("IncompatibleOptions", "HelloString");
// Uncompressed OOPs
testDump(1, "-XX:+UseG1GC", "-XX:-UseCompressedOops", COOPS_DUMP_WARNING, true);
if (GC.Z.isSupported()) { // ZGC is included in build.
*** 116,126 ****
static void testDump(int testCaseNr, String collectorOption, String extraOption,
String expectedWarning, boolean expectedToFail) throws Exception {
System.out.println("Testcase: " + testCaseNr);
OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list("Hello"),
! TestCommon.concat(globalVmOptions,
"-XX:+UseCompressedOops",
collectorOption,
"-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile("SharedStringsBasic.txt"),
"-Xlog:cds,cds+hashtables",
extraOption));
--- 154,164 ----
static void testDump(int testCaseNr, String collectorOption, String extraOption,
String expectedWarning, boolean expectedToFail) throws Exception {
System.out.println("Testcase: " + testCaseNr);
OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list("Hello"),
! TestCommon.concat(vmOptionsPrefix,
"-XX:+UseCompressedOops",
collectorOption,
"-XX:SharedArchiveConfigFile=" + TestCommon.getSourceFile("SharedStringsBasic.txt"),
"-Xlog:cds,cds+hashtables",
extraOption));
*** 143,158 ****
// needed, otherwise system considers empty extra option as a
// main class param, and fails with "Could not find or load main class"
if (!extraOption.isEmpty()) {
output = TestCommon.exec(appJar,
! TestCommon.concat(globalVmOptions,
"-XX:+UseCompressedOops",
collectorOption, "-Xlog:cds", extraOption, "HelloString"));
} else {
output = TestCommon.exec(appJar,
! TestCommon.concat(globalVmOptions,
"-XX:+UseCompressedOops",
collectorOption, "-Xlog:cds", "HelloString"));
}
if (expectedWarning != null) {
--- 181,196 ----
// needed, otherwise system considers empty extra option as a
// main class param, and fails with "Could not find or load main class"
if (!extraOption.isEmpty()) {
output = TestCommon.exec(appJar,
! TestCommon.concat(vmOptionsPrefix,
"-XX:+UseCompressedOops",
collectorOption, "-Xlog:cds", extraOption, "HelloString"));
} else {
output = TestCommon.exec(appJar,
! TestCommon.concat(vmOptionsPrefix,
"-XX:+UseCompressedOops",
collectorOption, "-Xlog:cds", "HelloString"));
}
if (expectedWarning != null) {
< prev index next >