< prev index next >

test/runtime/SharedArchiveFile/LargeSharedSpace.java

Print this page

        

@@ -22,11 +22,11 @@
  */
 
 /*
  * @test LargeSharedSpace
  * @bug 8168790 8169870
- * @summary Test CDS dumping with specific space size.
+ * @summary Test CDS dumping using specific space size without crashing.
  * The space size used in the test might not be suitable on windows.
  * @requires (os.family != "windows")
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management

@@ -48,14 +48,21 @@
            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
                 "-XX:SharedMiscCodeSize="+sizes[i], "-XX:+UnlockDiagnosticVMOptions",
                 "-XX:SharedArchiveFile=./LargeSharedSpace.jsa", "-Xshare:dump");
            OutputAnalyzer output = new OutputAnalyzer(pb.start());
            try {
+               // First, check the case specified by the expectedOutputs
                output.shouldContain(expectedOutputs[i]);
-           } catch (RuntimeException e) {
+           } catch (RuntimeException e1) {
+               try {
+                   // Second, check explicitly if the archive is dumped successfully
+                   output.shouldContain("Loading classes to share");
+               } catch (RuntimeException e2) {
+                   // Lastly, check known error case
                /* failed to reserve the memory for the required size, might happen
                   on 32-bit platforms */
                output.shouldContain("Unable to allocate memory for shared space");
            }
        }
     }
+    }
 }
< prev index next >