author | mr |
Wed, 16 Jan 2019 16:27:21 -0800 | |
changeset 53372 | 4003935e6e5f |
parent 47216 | 71c04702a3d5 |
child 54543 | 4fc566b7a9c0 |
permissions | -rw-r--r-- |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
1 |
/* |
46850
970a24772fe4
8177015: STACK_SIZE_MINIMUM of 32k is not always enough for Mac OS X
cjplummer
parents:
41112
diff
changeset
|
2 |
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
4 |
* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
8 |
* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
13 |
* accompanied this code). |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
14 |
* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
18 |
* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
21 |
* questions. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
22 |
*/ |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
23 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
24 |
/* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
25 |
* @test |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
26 |
* @bug 6762191 |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
27 |
* @summary Setting stack size to 16K causes segmentation fault |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
28 |
* @compile TooSmallStackSize.java |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
29 |
* @run main TooSmallStackSize |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
30 |
*/ |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
31 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
32 |
/* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
33 |
* The primary purpose of this test is to make sure we can run with a 16k stack |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
34 |
* size without crashing. Also this test will determine the minimum allowed |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
35 |
* stack size for the platform (as provided by the JVM error message when a very |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
36 |
* small stack is used), and then verify that the JVM can be launched with that stack |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
37 |
* size without a crash or any error messages. |
41112
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
38 |
* |
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
39 |
* Note: The '-Xss<size>' and '-XX:ThreadStackSize=<k-bytes>' options |
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
40 |
* both control Java thread stack size. This repo's version of the test |
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
41 |
* exercises the '-Xss' option. The hotspot repo's version of the test |
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
42 |
* exercises the '-XX:ThreadStackSize' VM option. |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
43 |
*/ |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
44 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
45 |
public class TooSmallStackSize extends TestHelper { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
46 |
/* for debugging. Normally false. */ |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
47 |
static final boolean verbose = false; |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
48 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
49 |
static void printTestOutput(TestResult tr) { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
50 |
System.out.println("*** exitValue = " + tr.exitValue); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
51 |
for (String x : tr.testOutput) { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
52 |
System.out.println(x); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
53 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
54 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
55 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
56 |
/* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
57 |
* Returns the minimum stack size this platform will allowed based on the |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
58 |
* contents of the error message the JVM outputs when too small of a |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
59 |
* -Xss size was used. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
60 |
* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
61 |
* The TestResult argument must contain the result of having already run |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
62 |
* the JVM with too small of a stack size. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
63 |
*/ |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
64 |
static String getMinStackAllowed(TestResult tr) { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
65 |
/* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
66 |
* The JVM output will contain in one of the lines: |
41112
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
67 |
* "The Java thread stack size specified is too small. Specify at least 100k" |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
68 |
* Although the actual size will vary. We need to extract this size |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
69 |
* string from the output and return it. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
70 |
*/ |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
71 |
String matchStr = "Specify at least "; |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
72 |
for (String x : tr.testOutput) { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
73 |
int match_idx = x.indexOf(matchStr); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
74 |
if (match_idx >= 0) { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
75 |
int size_start_idx = match_idx + matchStr.length(); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
76 |
int k_start_idx = x.indexOf("k", size_start_idx); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
77 |
return x.substring(size_start_idx, k_start_idx + 1); // include the "k" |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
78 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
79 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
80 |
|
41112
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
81 |
System.out.println("Expect='" + matchStr + "'"); |
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
82 |
System.out.println("Actual:"); |
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
83 |
printTestOutput(tr); |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
84 |
System.out.println("FAILED: Could not get the stack size from the output"); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
85 |
throw new RuntimeException("test fails"); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
86 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
87 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
88 |
/* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
89 |
* Run the JVM with the specified stack size. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
90 |
* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
91 |
* Returns the minimum allowed stack size gleaned from the error message, |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
92 |
* if there is an error message. Otherwise returns the stack size passed in. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
93 |
*/ |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
94 |
static String checkStack(String stackSize) { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
95 |
String min_stack_allowed; |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
96 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
97 |
if (verbose) |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
98 |
System.out.println("*** Testing " + stackSize); |
37540
e92d95400f31
8154470: defines.h confused about PROGNAME and JAVA_ARGS
martin
parents:
35624
diff
changeset
|
99 |
TestResult tr = doExec(javaCmd, "-Xss" + stackSize, "-version"); |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
100 |
if (verbose) |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
101 |
printTestOutput(tr); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
102 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
103 |
if (tr.isOK()) { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
104 |
System.out.println("PASSED: got no error message with stack size of " + stackSize); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
105 |
min_stack_allowed = stackSize; |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
106 |
} else { |
41112
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
107 |
String matchStr = "The Java thread stack size specified is too small"; |
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
108 |
if (tr.contains(matchStr)) { |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
109 |
System.out.println("PASSED: got expected error message with stack size of " + stackSize); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
110 |
min_stack_allowed = getMinStackAllowed(tr); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
111 |
} else { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
112 |
// Likely a crash |
41112
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
113 |
System.out.println("Expect='" + matchStr + "'"); |
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
114 |
System.out.println("Actual:"); |
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
115 |
printTestOutput(tr); |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
116 |
System.out.println("FAILED: Did not get expected error message with stack size of " + stackSize); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
117 |
throw new RuntimeException("test fails"); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
118 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
119 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
120 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
121 |
return min_stack_allowed; |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
122 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
123 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
124 |
/* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
125 |
* Run the JVM with the minimum allowed stack size. This should always succeed. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
126 |
*/ |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
127 |
static void checkMinStackAllowed(String stackSize) { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
128 |
if (verbose) |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
129 |
System.out.println("*** Testing " + stackSize); |
37540
e92d95400f31
8154470: defines.h confused about PROGNAME and JAVA_ARGS
martin
parents:
35624
diff
changeset
|
130 |
TestResult tr = doExec(javaCmd, "-Xss" + stackSize, "-version"); |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
131 |
if (verbose) |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
132 |
printTestOutput(tr); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
133 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
134 |
if (tr.isOK()) { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
135 |
System.out.println("PASSED: VM launched with minimum allowed stack size of " + stackSize); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
136 |
} else { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
137 |
// Likely a crash |
41112
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
138 |
System.out.println("Test output:"); |
15f038151608
8140520: segfault on solaris-amd64 with "-XX:VMThreadStackSize=1" option
rdurbin
parents:
37540
diff
changeset
|
139 |
printTestOutput(tr); |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
140 |
System.out.println("FAILED: VM failed to launch with minimum allowed stack size of " + stackSize); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
141 |
throw new RuntimeException("test fails"); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
142 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
143 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
144 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
145 |
public static void main(String... args) { |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
146 |
/* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
147 |
* The result of a 16k stack size should be a quick exit with a complaint |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
148 |
* that the stack size is too small. However, for some win32 builds, the |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
149 |
* stack is always at least 64k, and this also sometimes is the minimum |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
150 |
* allowed size, so we won't see an error in this case. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
151 |
* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
152 |
* This test case will also produce a crash on some platforms if the fix |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
153 |
* for 6762191 is not yet in place. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
154 |
*/ |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
155 |
checkStack("16k"); |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
156 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
157 |
/* |
46850
970a24772fe4
8177015: STACK_SIZE_MINIMUM of 32k is not always enough for Mac OS X
cjplummer
parents:
41112
diff
changeset
|
158 |
* Try with a 64k stack size, which is the size that the launcher will |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
159 |
* set to if you try setting to anything smaller. This should produce the same |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
160 |
* result as setting to 16k if the fix for 6762191 is in place. |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
161 |
*/ |
46850
970a24772fe4
8177015: STACK_SIZE_MINIMUM of 32k is not always enough for Mac OS X
cjplummer
parents:
41112
diff
changeset
|
162 |
String min_stack_allowed = checkStack("64k"); |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
163 |
|
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
164 |
/* |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
165 |
* Try again with a the minimum stack size that was given in the error message |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
166 |
*/ |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
167 |
checkMinStackAllowed(min_stack_allowed); |
46850
970a24772fe4
8177015: STACK_SIZE_MINIMUM of 32k is not always enough for Mac OS X
cjplummer
parents:
41112
diff
changeset
|
168 |
|
970a24772fe4
8177015: STACK_SIZE_MINIMUM of 32k is not always enough for Mac OS X
cjplummer
parents:
41112
diff
changeset
|
169 |
/* |
970a24772fe4
8177015: STACK_SIZE_MINIMUM of 32k is not always enough for Mac OS X
cjplummer
parents:
41112
diff
changeset
|
170 |
* Try again with a size that is not OS page aligned. This is to help test that |
970a24772fe4
8177015: STACK_SIZE_MINIMUM of 32k is not always enough for Mac OS X
cjplummer
parents:
41112
diff
changeset
|
171 |
* asserts added for 8176768 are not triggered. |
970a24772fe4
8177015: STACK_SIZE_MINIMUM of 32k is not always enough for Mac OS X
cjplummer
parents:
41112
diff
changeset
|
172 |
*/ |
970a24772fe4
8177015: STACK_SIZE_MINIMUM of 32k is not always enough for Mac OS X
cjplummer
parents:
41112
diff
changeset
|
173 |
checkMinStackAllowed("513k"); |
28102
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
174 |
} |
0efebd8c99e2
6762191: Setting stack size to 16K causes segmentation fault
cjplummer
parents:
diff
changeset
|
175 |
} |