author | ykantser |
Thu, 26 Mar 2015 16:36:56 +0100 | |
changeset 29678 | dd2f3932c21e |
parent 19971 | 37d89625f15c |
child 30604 | b8d532cb6420 |
permissions | -rw-r--r-- |
19971
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
1 |
/* |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
19971
diff
changeset
|
2 |
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
19971
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
4 |
* |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
7 |
* published by the Free Software Foundation. |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
8 |
* |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
13 |
* accompanied this code). |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
14 |
* |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
18 |
* |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
21 |
* questions. |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
22 |
*/ |
10275
fd163a3b3591
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
23 |
|
19971
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
24 |
|
10275
fd163a3b3591
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
25 |
|
19971
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
26 |
/* |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
27 |
* @test JsrRewriting |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
28 |
* @summary JSR (jump local subroutine) |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
29 |
* rewriting can overflow memory address size variables |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
30 |
* @bug 7020373 |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
31 |
* @bug 7055247 |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
32 |
* @bug 7053586 |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
33 |
* @bug 7185550 |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
34 |
* @bug 7149464 |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
35 |
* @key cte_test |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
36 |
* @library /testlibrary |
29678
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
19971
diff
changeset
|
37 |
* @modules java.base/sun.misc |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
19971
diff
changeset
|
38 |
* java.desktop |
dd2f3932c21e
8075586: Add @modules as needed to the open hotspot tests
ykantser
parents:
19971
diff
changeset
|
39 |
* java.management |
19971
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
40 |
* @run main JsrRewriting |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
41 |
*/ |
10275
fd163a3b3591
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
42 |
|
19971
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
43 |
import com.oracle.java.testlibrary.*; |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
44 |
import java.io.File; |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
45 |
|
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
46 |
public class JsrRewriting { |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
47 |
|
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
48 |
public static void main(String[] args) throws Exception { |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
49 |
|
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
50 |
// ======= Configure the test |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
51 |
String jarFile = System.getProperty("test.src") + |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
52 |
File.separator + "JsrRewritingTestCase.jar"; |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
53 |
String className = "OOMCrashClass4000_1"; |
10275
fd163a3b3591
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
54 |
|
19971
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
55 |
// limit is 768MB in native words |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
56 |
int mallocMaxTestWords = (1024 * 1024 * 768 / 4); |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
57 |
if (Platform.is64bit()) |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
58 |
mallocMaxTestWords = (mallocMaxTestWords / 2); |
10275
fd163a3b3591
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
59 |
|
19971
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
60 |
// ======= extract the test class |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
61 |
ProcessBuilder pb = new ProcessBuilder(new String[] { |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
62 |
JDKToolFinder.getJDKTool("jar"), |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
63 |
"xvf", jarFile } ); |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
64 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
65 |
output.shouldHaveExitValue(0); |
10275
fd163a3b3591
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
66 |
|
19971
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
67 |
// ======= execute the test |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
68 |
pb = ProcessTools.createJavaProcessBuilder( |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
69 |
"-cp", ".", |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
70 |
"-XX:+UnlockDiagnosticVMOptions", |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
71 |
"-XX:MallocMaxTestWords=" + mallocMaxTestWords, |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
72 |
className); |
10275
fd163a3b3591
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
73 |
|
19971
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
74 |
output = new OutputAnalyzer(pb.start()); |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
75 |
String[] expectedMsgs = { |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
76 |
"java.lang.LinkageError", |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
77 |
"java.lang.NoSuchMethodError", |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
78 |
"Main method not found in class " + className, |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
79 |
"insufficient memory" |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
80 |
}; |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
81 |
|
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
82 |
MultipleOrMatch(output, expectedMsgs); |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
83 |
} |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
84 |
|
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
85 |
private static void |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
86 |
MultipleOrMatch(OutputAnalyzer analyzer, String[] whatToMatch) { |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
87 |
String output = analyzer.getOutput(); |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
88 |
|
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
89 |
for (String expected : whatToMatch) |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
90 |
if (output.contains(expected)) |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
91 |
return; |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
92 |
|
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
93 |
String err = |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
94 |
" stdout: [" + analyzer.getOutput() + "];\n" + |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
95 |
" exitValue = " + analyzer.getExitValue() + "\n"; |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
96 |
System.err.println(err); |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
97 |
|
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
98 |
StringBuilder msg = new StringBuilder("Output did not contain " + |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
99 |
"any of the following expected messages: \n"); |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
100 |
for (String expected : whatToMatch) |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
101 |
msg.append(expected).append(System.lineSeparator()); |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
102 |
throw new RuntimeException(msg.toString()); |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
103 |
} |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
104 |
} |
37d89625f15c
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
16457
diff
changeset
|
105 |