< prev index next >

test/runtime/SharedArchiveFile/LargeSharedSpace.java

Print this page

        

@@ -21,14 +21,14 @@
  * questions.
  */
 
 /*
  * @test LargeSharedSpace
- * @bug 8168790
+ * @bug 8168790 8169870
  * @summary Test CDS dumping with specific space size.
- * The space size used in the test might not be suitable on windows and 32-bit platforms.
- * @requires (sun.arch.data.model != "32") & (os.family != "windows")
+ * 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
  * @run main LargeSharedSpace
  */

@@ -36,13 +36,21 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 
 public class LargeSharedSpace {
     public static void main(String[] args) throws Exception {
+       String sizes[] = {"1066924031", "1600386047"};
+       String expectedOutputs[] = {"Loading classes to share",
+                                   "larger than compressed klass limit"};
+       for (int i = 0; i < sizes.length; i++) {
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-XX:SharedMiscCodeSize=1066924031", "-XX:+UnlockDiagnosticVMOptions",
+                "-XX:SharedMiscCodeSize="+sizes[i], "-XX:+UnlockDiagnosticVMOptions",
             "-XX:SharedArchiveFile=./LargeSharedSpace.jsa", "-Xshare:dump");
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-       output.shouldContain("Loading classes to share");
-       output.shouldHaveExitValue(0);
+           try {
+               output.shouldContain(expectedOutputs[i]);
+           } catch (RuntimeException e) {
+               output.shouldContain("Unable to allocate memory for shared space");
+           }
+       }
     }
 }
< prev index next >