author | lmesnik |
Thu, 17 May 2018 16:21:27 -0700 | |
changeset 50169 | dd501973095c |
child 51048 | 5c58b4c10fbd |
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/stack015. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
29 |
* VM testbase keywords: [stress, 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 |
* This test provokes multiple stack overflows in the multiple |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
33 |
* threads -- by invoking synchronized virtual recursive method |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
34 |
* for the given fixed depth of recursion from within another |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
35 |
* recursive method already deeply invoked. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
36 |
* This test measures a number of recursive invocations until |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
37 |
* stack overflow, and then tries to provoke similar stack overflows |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
38 |
* in 10 times in each of 10 threads. Each provocation consists of |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
39 |
* invoking that recursive method for the given fixed depth |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
40 |
* of invocations which is 10 times that depth measured before. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
41 |
* The test is deemed passed, if VM have not crashed, and |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
42 |
* if exception other than due to stack overflow was not |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
43 |
* thrown. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
44 |
* COMMENTS |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
45 |
* This test crashes HS versions 2.0, 1.3, and 1.4 on Solaris. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
46 |
* However, it passes against all these HS versions on Win32. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
47 |
* See the bug: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
48 |
* 4366625 (P4/S4) multiple stack overflow causes HS crash |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
49 |
* |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
50 |
* @run main/othervm nsk.stress.stack.stack015 |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
51 |
*/ |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
52 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
53 |
package nsk.stress.stack; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
54 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
55 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
56 |
import java.io.PrintStream; |
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 |
public class stack015 extends stack015i { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
59 |
final static int THREADS = 10; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
60 |
final static int CYCLES = 10; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
61 |
final static int STEP = 10; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
62 |
final static int RESERVE = 10; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
63 |
|
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 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
71 |
// The test will invoke the particular stack015.recurse() |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
72 |
// method via abstract test.recurse() invocations. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
73 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
74 |
stack015i test = new stack015(); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
75 |
stack015i.test = test; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
76 |
|
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 |
// Measure maximal recursion depth until stack overflow: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
79 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
80 |
int maxDepth = 0; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
81 |
for (int depth = 0; ; depth += STEP) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
82 |
try { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
83 |
test.recurse(depth); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
84 |
maxDepth = depth; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
85 |
} catch (StackOverflowError soe) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
86 |
break; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
87 |
} catch (OutOfMemoryError oome) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
88 |
break; |
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 |
out.println("Max. depth: " + maxDepth); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
91 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
92 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
93 |
// Execute multiple threads repeatedly provoking stack overflows: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
94 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
95 |
stack015i threads[] = new stack015i[THREADS]; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
96 |
for (int i = 0; i < threads.length; i++) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
97 |
threads[i] = new stack015(); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
98 |
threads[i].depthToTry = RESERVE * maxDepth; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
99 |
threads[i].start(); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
100 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
101 |
for (int i = 0; i < threads.length; i++) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
102 |
if (threads[i].isAlive()) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
103 |
try { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
104 |
threads[i].join(); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
105 |
} catch (InterruptedException exception) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
106 |
exception.printStackTrace(out); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
107 |
return 2; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
108 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
109 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
110 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
111 |
// Check if unexpected exceptions were thrown: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
112 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
113 |
int exitCode = 0; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
114 |
for (int i = 0; i < threads.length; i++) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
115 |
if (threads[i].thrown != null) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
116 |
threads[i].thrown.printStackTrace(out); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
117 |
exitCode = 2; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
118 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
119 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
120 |
if (exitCode != 0) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
121 |
out.println("# TEST FAILED"); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
122 |
return exitCode; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
123 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
124 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
125 |
synchronized void syncRecurse(int depth) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
126 |
if (depth > 0) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
127 |
syncRecurse(depth - 1); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
128 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
129 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
130 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
131 |
abstract class stack015i extends Thread { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
132 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
133 |
// Pure virtual method: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
134 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
135 |
abstract void syncRecurse(int depth); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
136 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
137 |
void recurse(int depth) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
138 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
139 |
// Stack overflow must occur here: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
140 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
141 |
syncRecurse(stack015.STEP); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
142 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
143 |
// If no stack overflow occured, try again with deeper stack: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
144 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
145 |
if (depth > 0) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
146 |
recurse(depth - 1); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
147 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
148 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
149 |
Throwable thrown = null; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
150 |
int depthToTry; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
151 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
152 |
static stack015i test; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
153 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
154 |
public void run() { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
155 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
156 |
// Provoke multiple stack overflows: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
157 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
158 |
for (int i = 0; i < stack015.CYCLES; i++) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
159 |
try { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
160 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
161 |
// All threads invoke the same synchronized method: |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
162 |
// |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
163 |
test.recurse(depthToTry); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
164 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
165 |
throw new Exception( |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
166 |
"TEST_RFE: no stack overflow thrown" + |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
167 |
", need to try deeper recursion?"); |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
168 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
169 |
} catch (StackOverflowError error) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
170 |
// It's OK: stack overflow was expected. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
171 |
} catch (OutOfMemoryError oome) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
172 |
// Also OK: there may be no memory for stack expansion. |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
173 |
|
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
174 |
} catch (Throwable throwable) { |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
175 |
if (throwable instanceof ThreadDeath) |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
176 |
throw (ThreadDeath) throwable; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
177 |
// It isn't OK! |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
178 |
thrown = throwable; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
179 |
break; |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
180 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
181 |
} |
dd501973095c
8199271: [TESTBUG] open source VM testbase stress tests
lmesnik
parents:
diff
changeset
|
182 |
} |