< prev index next >

test/runtime/ErrorHandling/CreateCoredumpOnCrash.java

Print this page
rev 8694 : imported patch 8080733


  29  *          java.management
  30  *          jdk.jvmstat/sun.jvmstat.monitor
  31  * @build jdk.test.lib.*
  32  * @run driver CreateCoredumpOnCrash
  33  */
  34 
  35 import jdk.test.lib.*;
  36 import sun.misc.Unsafe;
  37 
  38 public class CreateCoredumpOnCrash {
  39     private static class Crasher {
  40         public static void main(String[] args) {
  41             Utils.getUnsafe().getInt(0);
  42         }
  43     }
  44 
  45     public static void main(String[] args) throws Exception {
  46         runTest("-XX:-CreateCoredumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");
  47 
  48         if (Platform.isWindows()) {
  49             runTest("-XX:+CreateCoredumpOnCrash").shouldContain("Core dump will be written. Default location");
  50 
  51             // The old CreateMinidumpOnCrash option should still work
  52             runTest("-XX:+CreateMinidumpOnCrash").shouldContain("Core dump will be written. Default location");
  53             runTest("-XX:-CreateMinidumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");
  54 
  55             if (Platform.isDebugBuild()) {
  56                 // Make sure we create dumps on Windows debug builds by default
  57                 runTest("-Ddummyopt=false").shouldContain("Core dump will be written. Default location");
  58             }
  59         } else {
  60             runTest("-XX:+CreateCoredumpOnCrash").shouldNotContain("CreateCoredumpOnCrash turned off, no core file dumped");
  61         }
  62 
  63     }
  64     public static OutputAnalyzer runTest(String option) throws Exception {
  65         return new OutputAnalyzer(
  66             ProcessTools.createJavaProcessBuilder(
  67             "-Xmx64m", "-XX:-TransmitErrorReport", option, Crasher.class.getName())
  68             .start());
  69     }
  70 }


  29  *          java.management
  30  *          jdk.jvmstat/sun.jvmstat.monitor
  31  * @build jdk.test.lib.*
  32  * @run driver CreateCoredumpOnCrash
  33  */
  34 
  35 import jdk.test.lib.*;
  36 import sun.misc.Unsafe;
  37 
  38 public class CreateCoredumpOnCrash {
  39     private static class Crasher {
  40         public static void main(String[] args) {
  41             Utils.getUnsafe().getInt(0);
  42         }
  43     }
  44 
  45     public static void main(String[] args) throws Exception {
  46         runTest("-XX:-CreateCoredumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");
  47 
  48         if (Platform.isWindows()) {


  49             // The old CreateMinidumpOnCrash option should still work

  50             runTest("-XX:-CreateMinidumpOnCrash").shouldContain("CreateCoredumpOnCrash turned off, no core file dumped");





  51         } else {
  52             runTest("-XX:+CreateCoredumpOnCrash").shouldNotContain("CreateCoredumpOnCrash turned off, no core file dumped");
  53         }
  54 
  55     }
  56     public static OutputAnalyzer runTest(String option) throws Exception {
  57         return new OutputAnalyzer(
  58             ProcessTools.createJavaProcessBuilder(
  59             "-Xmx64m", "-XX:-TransmitErrorReport", option, Crasher.class.getName())
  60             .start());
  61     }
  62 }
< prev index next >