author | lmesnik |
Thu, 12 Jul 2018 13:32:45 -0700 | |
changeset 51048 | 5c58b4c10fbd |
parent 50169 | dd501973095c |
child 51283 | ac4f5ef0edd9 |
permissions | -rw-r--r-- |
50169
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
1 |
/* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
2 |
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
4 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
8 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
13 |
* accompanied this code). |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
14 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
18 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
21 |
* questions. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
22 |
*/ |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
23 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
24 |
/* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
25 |
* @test |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
26 |
* @key stress |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
27 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
28 |
* @summary converted from VM testbase nsk/stress/stack/stack001. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
29 |
* VM testbase keywords: [stress, quick, stack, nonconcurrent] |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
30 |
* VM testbase readme: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
31 |
* DESCRIPTION |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
32 |
* Provoke StackOverflowError by infinite recursion in Java method, |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
33 |
* intercept the exception try to make one more invocation. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
34 |
* COMMENTS |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
35 |
* Kestrel for Solaris_JDK_1.3-b10 crashes while trying to execute |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
36 |
* this test with Client HS VM. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
37 |
* See lots of bugs concerning similar failuires: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
38 |
* Evaluated: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
39 |
* 4217960 [native stack overflow bug] reflection test causes crash |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
40 |
* Accepted: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
41 |
* 4285716 native stack overflow causes crash on Solaris |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
42 |
* 4281578 Second stack overflow crashes HotSpot VM |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
43 |
* Closed (duplicate): |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
44 |
* 4027933 Native stack overflows not detected or handled correctly |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
45 |
* 4134353 (hpi) sysThreadCheckStack is a no-op on win32 |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
46 |
* 4185411 Various crashes when using recursive reflection. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
47 |
* 4167055 infinite recursion in FindClass |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
48 |
* 4222359 Infinite recursion crashes jvm |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
49 |
* Closed (will not fix): |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
50 |
* 4231968 StackOverflowError in a native method causes Segmentation Fault |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
51 |
* 4254634 println() while catching StackOverflowError causes hotspot VM crash |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
52 |
* 4302288 the second stack overflow causes Classic VM to exit on win32 |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
53 |
* |
51048
5c58b4c10fbd
8139876: Exclude hanging nsk/stress/stack from execution with deoptimization enabled
lmesnik
parents:
50169
diff
changeset
|
54 |
* @requires vm.opt.DeoptimizeALot == null | vm.opt.DeoptimizeALot == false |
50169
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
55 |
* @run main/othervm nsk.stress.stack.stack001 |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
56 |
*/ |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
57 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
58 |
package nsk.stress.stack; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
59 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
60 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
61 |
import java.io.PrintStream; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
62 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
63 |
public class stack001 { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
64 |
public static void main(String[] args) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
65 |
int exitCode = run(args, System.out); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
66 |
System.exit(exitCode + 95); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
67 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
68 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
69 |
public static int run(String args[], PrintStream out) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
70 |
stack001 test = new stack001(); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
71 |
test.recurse(0); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
72 |
out.println("Maximal depth: " + test.maxdepth); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
73 |
return 0; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
74 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
75 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
76 |
private int maxdepth; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
77 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
78 |
private void recurse(int depth) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
79 |
maxdepth = depth; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
80 |
try { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
81 |
recurse(depth + 1); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
82 |
} catch (Error error) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
83 |
if (!(error instanceof StackOverflowError) && |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
84 |
!(error instanceof OutOfMemoryError)) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
85 |
throw error; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
86 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
87 |
if (maxdepth == depth) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
88 |
recurse(depth + 1); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
89 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
90 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
91 |
} |