< prev index next >

test/runtime/ErrorHandling/TestOnOutOfMemoryError.java

Print this page

        

@@ -21,15 +21,15 @@
  * questions.
  */
 
 /*
  * @test TestOnOutOfMemoryError
- * @summary Test using -XX:OnOutOfMemoryError=<cmd>
+ * @summary Test using multiple -XX:OnOutOfMemoryError=<cmd>
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @run main TestOnOutOfMemoryError
- * @bug 8078470
+ * @bug 8078470 8177522
  */
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 

@@ -42,13 +42,15 @@
             Object[] oa = new Object[Integer.MAX_VALUE];
             return;
         }
 
         // else this is the main test
-        String msg = "Test Succeeded";
+        String msg1 = "Test1 Succeeded";
+        String msg2 = "Test2 Succeeded";
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-           "-XX:OnOutOfMemoryError=echo " + msg,
+           "-XX:OnOutOfMemoryError=echo " + msg1,
+           "-XX:OnOutOfMemoryError=echo " + msg2,
            TestOnOutOfMemoryError.class.getName(),
            "throwOOME");
 
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
 

@@ -63,9 +65,10 @@
 
            So we don't want to match on the "# Executing ..." line, and they
            both get written to stdout.
         */
         output.shouldContain("Requested array size exceeds VM limit");
-        output.stdoutShouldMatch("^" + msg); // match start of line only
+        output.stdoutShouldMatch("^" + msg1); // match start of line only
+        output.stdoutShouldMatch("^" + msg2); // match start of line only
         System.out.println("PASSED");
     }
 }
< prev index next >