changeset 46410:5ffd0f5000cc

8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test Summary: Added the java.corba to the set of root modules by using the --add-modules option. Used the CDSTestUtils.checkExec() for checking test results. Reviewed-by: sspitsyn, jiangli, mseledtsov, iklam
author ccheung
date Tue, 25 Apr 2017 11:06:42 -0700
parents b8e6a56681f5
children 92fd9825e468
files hotspot/test/ProblemList.txt hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java
diffstat 2 files changed, 24 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/test/ProblemList.txt	Tue Apr 25 11:58:37 2017 +0200
+++ b/hotspot/test/ProblemList.txt	Tue Apr 25 11:06:42 2017 -0700
@@ -122,7 +122,6 @@
 runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
 # This test is disabled since it will stress NMT and timeout during normal testing
 runtime/NMT/MallocStressTest.java 8166548 generic-all
-runtime/SharedArchiveFile/BootAppendTests.java 8150683 generic-all
 runtime/SharedArchiveFile/DefaultUseWithClient.java 8154204 generic-all
 
 #############################################################################
--- a/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java	Tue Apr 25 11:58:37 2017 +0200
+++ b/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java	Tue Apr 25 11:06:42 2017 -0700
@@ -73,7 +73,7 @@
         logTestCase("1");
         testBootAppendModuleClass();
 
-        log("TESTCASE: 2");
+        logTestCase("2");
         testBootAppendDuplicateModuleClass();
 
         logTestCase("3");
@@ -123,11 +123,11 @@
         for (String mode : modes) {
             CDSOptions opts = (new CDSOptions())
                 .setXShareMode(mode).setUseVersion(false)
-                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
+                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar, "-showversion")
                 .addSuffix(APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
 
-            CDSTestUtils.runWithArchive(opts)
-                .shouldContain("java.lang.ClassNotFoundException: javax.sound.sampled.MyClass");
+            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
+            CDSTestUtils.checkExec(out, opts, "java.lang.ClassNotFoundException: javax.sound.sampled.MyClass");
         }
     }
 
@@ -144,11 +144,13 @@
         for (String mode : modes) {
             CDSOptions opts = (new CDSOptions())
                 .setXShareMode(mode).setUseVersion(false)
-                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
-                .addSuffix(APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
+                .addPrefix("--add-modules", "java.corba", "-showversion",
+                           "-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
+                .addSuffix("-Xlog:class+load=info",
+                           APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
 
-            CDSTestUtils.runWithArchive(opts)
-                .shouldContain("[class,load] org.omg.CORBA.Context source: jrt:/java.corba");
+            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
+            CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context source: jrt:/java.corba");
         }
     }
 
@@ -164,17 +166,17 @@
         for (String mode : modes) {
             CDSOptions opts = (new CDSOptions())
                 .setXShareMode(mode).setUseVersion(false)
-                .addPrefix("-Xbootclasspath/a:" + bootAppendJar,
+                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
                            "--limit-modules=java.base", "-cp", appJar)
                 .addSuffix("-Xlog:class+load=info",
                            APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
 
-            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts)
-                .shouldContain("[class,load] javax.sound.sampled.MyClass");
+            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
+            CDSTestUtils.checkExec(out, opts, "[class,load] javax.sound.sampled.MyClass");
 
             // When CDS is enabled, the shared class should be loaded from the archive.
             if (mode.equals("on")) {
-                out.shouldContain("[class,load] javax.sound.sampled.MyClass source: shared objects file");
+                CDSTestUtils.checkExec(out, opts, "[class,load] javax.sound.sampled.MyClass source: shared objects file");
             }
         }
     }
@@ -193,14 +195,16 @@
         for (String mode : modes) {
             CDSOptions opts = (new CDSOptions())
                 .setXShareMode(mode).setUseVersion(false)
-                .addPrefix("-Xbootclasspath/a:" + bootAppendJar,
+                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
                            "--limit-modules=java.base", "-cp", appJar)
                 .addSuffix("-Xlog:class+load=info",
                            APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
 
-            CDSTestUtils.runWithArchive(opts)
-                .shouldContain("[class,load] org.omg.CORBA.Context")
-                .shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar");
+            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
+            CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context");
+            if (!CDSTestUtils.isUnableToMap(out)) {
+                out.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar");
+            }
         }
     }
 
@@ -215,18 +219,18 @@
         for (String mode : modes) {
             CDSOptions opts = (new CDSOptions())
                 .setXShareMode(mode).setUseVersion(false)
-                .addPrefix("-Xbootclasspath/a:" + bootAppendJar,
+                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
                            "--limit-modules=java.base", "-cp", appJar)
                 .addSuffix("-Xlog:class+load=info",
                            APP_CLASS, BOOT_APPEND_CLASS_NAME);
 
-            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts)
-                .shouldContain("[class,load] nonjdk.myPackage.MyClass");
+            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
+            CDSTestUtils.checkExec(out, opts, "[class,load] nonjdk.myPackage.MyClass");
 
             // If CDS is enabled, the nonjdk.myPackage.MyClass should be loaded
             // from the shared archive.
             if (mode.equals("on")) {
-                out.shouldContain(
+                CDSTestUtils.checkExec(out, opts,
                     "[class,load] nonjdk.myPackage.MyClass source: shared objects file");
             }
         }