test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java

Print this page




  13  * @bug 8074552
  14  * @summary SafeFetch32 and SafeFetchN do not work in error handling
  15  * @library /testlibrary
  16  * @author Thomas Stuefe (SAP)
  17  */
  18 
  19 public class SafeFetchInErrorHandlingTest {
  20 
  21 
  22   public static void main(String[] args) throws Exception {
  23 
  24     if (!Platform.isDebugBuild()) {
  25       return;
  26     }
  27 
  28     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  29         "-XX:+UnlockDiagnosticVMOptions",
  30         "-Xmx100M",
  31         "-XX:ErrorHandlerTest=14",
  32         "-XX:+TestSafeFetchInErrorHandler",

  33         "-version");
  34 
  35     OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
  36 
  37     // we should have crashed with a SIGSEGV
  38     output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*");
  39     output_detail.shouldMatch("# +(?:SIGSEGV|EXCEPTION_ACCESS_VIOLATION).*");
  40 
  41     // extract hs-err file
  42     String hs_err_file = output_detail.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
  43     if (hs_err_file == null) {
  44       throw new RuntimeException("Did not find hs-err file in output.\n");
  45     }
  46 
  47     File f = new File(hs_err_file);
  48     if (!f.exists()) {
  49       throw new RuntimeException("hs-err file missing at "
  50           + f.getAbsolutePath() + ".\n");
  51     }
  52 




  13  * @bug 8074552
  14  * @summary SafeFetch32 and SafeFetchN do not work in error handling
  15  * @library /testlibrary
  16  * @author Thomas Stuefe (SAP)
  17  */
  18 
  19 public class SafeFetchInErrorHandlingTest {
  20 
  21 
  22   public static void main(String[] args) throws Exception {
  23 
  24     if (!Platform.isDebugBuild()) {
  25       return;
  26     }
  27 
  28     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
  29         "-XX:+UnlockDiagnosticVMOptions",
  30         "-Xmx100M",
  31         "-XX:ErrorHandlerTest=14",
  32         "-XX:+TestSafeFetchInErrorHandler",
  33         "-XX:-CreateCoredumpOnCrash",
  34         "-version");
  35 
  36     OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
  37 
  38     // we should have crashed with a SIGSEGV
  39     output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*");
  40     output_detail.shouldMatch("# +(?:SIGSEGV|EXCEPTION_ACCESS_VIOLATION).*");
  41 
  42     // extract hs-err file
  43     String hs_err_file = output_detail.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
  44     if (hs_err_file == null) {
  45       throw new RuntimeException("Did not find hs-err file in output.\n");
  46     }
  47 
  48     File f = new File(hs_err_file);
  49     if (!f.exists()) {
  50       throw new RuntimeException("hs-err file missing at "
  51           + f.getAbsolutePath() + ".\n");
  52     }
  53