< prev index next >

test/runtime/ErrorHandling/SafeFetchInErrorHandlingTest.java

Print this page
@  rev 7996 : 8075533: Zero JVM segfaults for -version after JDK-8074552
|


   4 import java.io.InputStreamReader;
   5 import java.util.regex.Pattern;
   6 
   7 import com.oracle.java.testlibrary.OutputAnalyzer;
   8 import com.oracle.java.testlibrary.Platform;
   9 import com.oracle.java.testlibrary.ProcessTools;
  10 
  11 /*
  12  * @test
  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");




   4 import java.io.InputStreamReader;
   5 import java.util.regex.Pattern;
   6 
   7 import com.oracle.java.testlibrary.OutputAnalyzer;
   8 import com.oracle.java.testlibrary.Platform;
   9 import com.oracle.java.testlibrary.ProcessTools;
  10 
  11 /*
  12  * @test
  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() || Platform.isZero()) {
  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");


< prev index next >