test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java
changeset 48171 7ad2d33a0f05
parent 48138 78b2ecdd3c4b
child 48469 7312ae4465d6
--- a/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java	Thu Nov 30 16:00:34 2017 -0500
+++ b/test/hotspot/jtreg/runtime/appcds/BootClassPathMismatch.java	Thu Nov 30 14:25:33 2017 -0800
@@ -52,6 +52,7 @@
 
         BootClassPathMismatch test = new BootClassPathMismatch();
         test.testBootClassPathMismatch();
+        test.testBootClassPathMismatch2();
         test.testBootClassPathMatch();
     }
 
@@ -78,6 +79,26 @@
         }
     }
 
+    /* Error should be detected if:
+     * dump time: <no bootclasspath specified>
+     * run-time : -Xbootclasspath/a:${testdir}/hello.jar
+     */
+    public void testBootClassPathMismatch2() throws Exception {
+        String appJar = JarBuilder.getOrCreateHelloJar();
+        String appClasses[] = {"Hello"};
+        OutputAnalyzer dumpOutput = TestCommon.dump(appJar, appClasses);
+        OutputAnalyzer execOutput = TestCommon.exec(
+            appJar, "-verbose:class", "-Xbootclasspath/a:" + appJar, "Hello");
+        try {
+            TestCommon.checkExec(execOutput, mismatchMessage);
+        } catch (java.lang.RuntimeException re) {
+          String cause = re.getMessage();
+          if (!mismatchMessage.equals(cause)) {
+              throw re;
+          }
+        }
+    }
+
     /* No error if:
      * dump time: -Xbootclasspath/a:${testdir}/hello.jar
      * run-time : -Xbootclasspath/a:${testdir}/hello.jar