16 * @author Thomas Stuefe (SAP)
17 */
18
19 public class SecondaryErrorTest {
20
21
22 public static void main(String[] args) throws Exception {
23
24 // Do not execute for windows, nor for non-debug builds
25 if (Platform.isWindows()) {
26 return;
27 }
28
29 if (!Platform.isDebugBuild()) {
30 return;
31 }
32
33 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
34 "-XX:+UnlockDiagnosticVMOptions",
35 "-Xmx100M",
36 "-XX:ErrorHandlerTest=15",
37 "-XX:TestCrashInErrorHandler=14",
38 "-version");
39
40 OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
41
42 // we should have crashed with a SIGFPE
43 output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*");
44 output_detail.shouldMatch("# +SIGFPE.*");
45
46 // extract hs-err file
47 String hs_err_file = output_detail.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
48 if (hs_err_file == null) {
49 throw new RuntimeException("Did not find hs-err file in output.\n");
50 }
51
52 // scan hs-err file: File should contain the "[error occurred during error reporting..]"
53 // markers which show that the secondary error handling kicked in and handled the
54 // error successfully. As an added test, we check that the last line contains "END.",
55 // which is an end marker written in the last step and proves that hs-err file was
|
16 * @author Thomas Stuefe (SAP)
17 */
18
19 public class SecondaryErrorTest {
20
21
22 public static void main(String[] args) throws Exception {
23
24 // Do not execute for windows, nor for non-debug builds
25 if (Platform.isWindows()) {
26 return;
27 }
28
29 if (!Platform.isDebugBuild()) {
30 return;
31 }
32
33 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
34 "-XX:+UnlockDiagnosticVMOptions",
35 "-Xmx100M",
36 "-XX:-CreateCoredumpOnCrash",
37 "-XX:ErrorHandlerTest=15",
38 "-XX:TestCrashInErrorHandler=14",
39 "-version");
40
41 OutputAnalyzer output_detail = new OutputAnalyzer(pb.start());
42
43 // we should have crashed with a SIGFPE
44 output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*");
45 output_detail.shouldMatch("# +SIGFPE.*");
46
47 // extract hs-err file
48 String hs_err_file = output_detail.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1);
49 if (hs_err_file == null) {
50 throw new RuntimeException("Did not find hs-err file in output.\n");
51 }
52
53 // scan hs-err file: File should contain the "[error occurred during error reporting..]"
54 // markers which show that the secondary error handling kicked in and handled the
55 // error successfully. As an added test, we check that the last line contains "END.",
56 // which is an end marker written in the last step and proves that hs-err file was
|