< prev index next >

test/hotspot/jtreg/runtime/ErrorHandling/TestHeapDumpOnOutOfMemoryError.java

Print this page

        

@@ -21,14 +21,13 @@
  * questions.
  */
 
 /*
  * @test TestHeapDumpOnOutOfMemoryError
- * @summary Test verifies that -XX:HeapDumpOnOutOfMemoryError dump heap when OutOfMemory is thrown
- * @modules java.base/jdk.internal.misc
+ * @summary Test verifies that -XX:HeapDumpOnOutOfMemoryError dump heap when OutOfMemory is thrown in heap
  * @library /test/lib
- * @run driver/timeout=240 TestHeapDumpOnOutOfMemoryError
+ * @run driver TestHeapDumpOnOutOfMemoryError run heap
  */
 
 import jdk.test.lib.Asserts;
 import jdk.test.lib.classloader.GeneratingClassLoader;
 import jdk.test.lib.hprof.HprofParser;

@@ -59,13 +58,11 @@
                 throw new Error("OOME not triggered");
             } catch (OutOfMemoryError err) {
                 return;
             }
         }
-        test(HEAP_OOME);
-        test(METASPACE_OOME);
-        testHeapDumpPath();
+        test(args[1]);
     }
 
     static void test(String type) throws Exception {
         String heapdumpFilename = type + ".hprof";
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+HeapDumpOnOutOfMemoryError",

@@ -81,33 +78,6 @@
 
         HprofParser.parse(new File(heapdumpFilename));
         System.out.println("PASSED");
     }
 
-    static void testHeapDumpPath() throws Exception {
-        String heapdumpPath = "dumps";
-        File dumpDirectory = new File(heapdumpPath);
-        dumpDirectory.mkdir();
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+HeapDumpOnOutOfMemoryError",
-                "-XX:HeapDumpPath=" + heapdumpPath, "-Xmx256m", "-XX:MaxMetaspaceSize=64m",
-                TestHeapDumpOnOutOfMemoryError.class.getName(), HEAP_OOME);
-
-        OutputAnalyzer output = new OutputAnalyzer(pb.start());
-        output.stdoutShouldNotBeEmpty();
-        output.shouldContain("Dumping heap");
-
-        Asserts.assertFalse(dumpDirectory.listFiles().length == 0,
-                "There is no dump files found in " + dumpDirectory );
-
-        Asserts.assertTrue(dumpDirectory.listFiles().length == 1,
-                "There are unexpected files in " + dumpDirectory
-                        + ": " + String.join(",", dumpDirectory.list()) +".");
-
-        File dump = dumpDirectory.listFiles()[0];
-        Asserts.assertTrue(dump.exists() && dump.isFile(),
-                "Could not find dump file " + dump.getAbsolutePath());
-
-        HprofParser.parse(dump);
-        System.out.println("PASSED");
-    }
-
 }
< prev index next >