author | stefank |
Wed, 20 Apr 2016 09:58:15 +0200 | |
changeset 38000 | 7519aefb5b86 |
parent 33135 | aa536100693c |
child 38152 | 80e5da81fb2c |
permissions | -rw-r--r-- |
33135
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
1 |
/* |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
4 |
* |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
8 |
* |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
13 |
* accompanied this code). |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
14 |
* |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
18 |
* |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
21 |
* questions. |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
22 |
*/ |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
23 |
|
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
24 |
/* |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
25 |
* @test |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
26 |
* @bug 6888954 |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
27 |
* @bug 8015884 |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
28 |
* @summary Exercise HotSpot error handling code by invoking java with |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
29 |
* -XX:ErrorHandlerTest option to cause an error report. Check the results. |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
30 |
* @library /testlibrary |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
31 |
* @run driver ErrorHandler |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
32 |
*/ |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
33 |
|
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
34 |
import jdk.test.lib.*; |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
35 |
|
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
36 |
public class ErrorHandler { |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
37 |
|
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
38 |
public static OutputAnalyzer runTest(int testcase) throws Exception { |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
39 |
return new OutputAnalyzer( |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
40 |
ProcessTools.createJavaProcessBuilder( |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
41 |
"-XX:-TransmitErrorReport", "-XX:-CreateCoredumpOnCrash", "-XX:ErrorHandlerTest=" + testcase) |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
42 |
.start()); |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
43 |
} |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
44 |
|
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
45 |
public static void main(String[] args) throws Exception { |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
46 |
// Test is only applicable for debug builds |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
47 |
if (!Platform.isDebugBuild()) { |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
48 |
return; |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
49 |
} |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
50 |
// Keep this in sync with hotspot/src/share/vm/utilities/debug.cpp |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
51 |
int i = 1; |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
52 |
String[] strings = { |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
53 |
"assert(str == NULL) failed: expected null", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
54 |
"assert(num == 1023 && *str == 'X') failed: num=", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
55 |
"guarantee(str == NULL) failed: expected null", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
56 |
"guarantee(num == 1023 && *str == 'X') failed: num=", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
57 |
"fatal error: expected null", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
58 |
"fatal error: num=", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
59 |
"fatal error: this message should be truncated during formatting", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
60 |
"ChunkPool::allocate", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
61 |
"Error: ShouldNotCall()", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
62 |
"Error: ShouldNotReachHere()", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
63 |
"Error: Unimplemented()" |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
64 |
}; |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
65 |
|
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
66 |
String[] patterns = { |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
67 |
"(SIGILL|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=", |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
68 |
"(SIGBUS|SIGSEGV|SIGILL|EXCEPTION_ACCESS_VIOLATION).* at pc=" |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
69 |
}; |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
70 |
|
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
71 |
for (String s : strings) { |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
72 |
runTest(i++).shouldContain(s); |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
73 |
} |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
74 |
|
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
75 |
for (String p : patterns) { |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
76 |
runTest(i++).shouldMatch(p); |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
77 |
} |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
78 |
} |
aa536100693c
8134432: [TESTBUG] Rewrite test/runtime/6888954/vmerrors.sh in Java
gtriantafill
parents:
diff
changeset
|
79 |
} |