< prev index next >

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

Print this page




  40  */
  41 
  42 // This test was adapted from SafeFetchInErrorHandlingTest.java.
  43 public class BadNativeStackInErrorHandlingTest {
  44   public static void main(String[] args) throws Exception {
  45     if (!Platform.isDebugBuild() || Platform.isZero()) {
  46       return;
  47     }
  48 
  49     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  50         "-XX:+UnlockDiagnosticVMOptions",
  51         "-Xmx100M",
  52         "-XX:ErrorHandlerTest=14",
  53         "-XX:-CreateCoredumpOnCrash",
  54         "-version");
  55 
  56     OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
  57 
  58     // we should have crashed with a SIGSEGV
  59     output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*");
  60     output_detail.shouldMatch("# +(?:SIGSEGV|EXCEPTION_ACCESS_VIOLATION).*");
  61 
  62     // extract hs-err file
  63     String hs_err_file = output_detail.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
  64     if (hs_err_file == null) {
  65         throw new RuntimeException("Did not find hs-err file in output.\n");
  66     }
  67 
  68     File f = new File(hs_err_file);
  69     if (!f.exists()) {
  70         throw new RuntimeException("hs-err file missing at " +
  71                                    f.getAbsolutePath() + ".\n");
  72     }
  73 
  74     System.out.println("Found hs_err file. Scanning...");
  75 
  76     FileInputStream fis = new FileInputStream(f);
  77     BufferedReader br = new BufferedReader(new InputStreamReader(fis));
  78     String line = null;
  79 
  80     // The failing line looks like this:




  40  */
  41 
  42 // This test was adapted from SafeFetchInErrorHandlingTest.java.
  43 public class BadNativeStackInErrorHandlingTest {
  44   public static void main(String[] args) throws Exception {
  45     if (!Platform.isDebugBuild() || Platform.isZero()) {
  46       return;
  47     }
  48 
  49     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  50         "-XX:+UnlockDiagnosticVMOptions",
  51         "-Xmx100M",
  52         "-XX:ErrorHandlerTest=14",
  53         "-XX:-CreateCoredumpOnCrash",
  54         "-version");
  55 
  56     OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
  57 
  58     // we should have crashed with a SIGSEGV
  59     output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*");
  60     output_detail.shouldMatch("# +(?:SIGSEGV|SIGBUS|EXCEPTION_ACCESS_VIOLATION).*");
  61 
  62     // extract hs-err file
  63     String hs_err_file = output_detail.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
  64     if (hs_err_file == null) {
  65         throw new RuntimeException("Did not find hs-err file in output.\n");
  66     }
  67 
  68     File f = new File(hs_err_file);
  69     if (!f.exists()) {
  70         throw new RuntimeException("hs-err file missing at " +
  71                                    f.getAbsolutePath() + ".\n");
  72     }
  73 
  74     System.out.println("Found hs_err file. Scanning...");
  75 
  76     FileInputStream fis = new FileInputStream(f);
  77     BufferedReader br = new BufferedReader(new InputStreamReader(fis));
  78     String line = null;
  79 
  80     // The failing line looks like this:


< prev index next >