author | goetz |
Mon, 25 Jun 2018 23:04:21 +0200 | |
changeset 50791 | b1e90a8a876c |
parent 48178 | 88ec5fca7726 |
child 53635 | 247e5ca412f5 |
permissions | -rw-r--r-- |
43965
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
1 |
/* |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
48178
diff
changeset
|
2 |
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
43965
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
4 |
* |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
8 |
* |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
13 |
* accompanied this code). |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
14 |
* |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
18 |
* |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
21 |
* questions. |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
22 |
*/ |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
23 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
24 |
import java.util.ArrayList; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
25 |
import java.util.Scanner; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
26 |
import java.util.List; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
27 |
import java.io.File; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
28 |
import java.io.IOException; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
29 |
import java.util.stream.Collectors; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
30 |
import java.io.OutputStream; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
31 |
import jdk.test.lib.apps.LingeredApp; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
32 |
import jdk.test.lib.JDKToolLauncher; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
33 |
import jdk.test.lib.Platform; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
34 |
import jdk.test.lib.process.ProcessTools; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
35 |
import jdk.test.lib.process.OutputAnalyzer; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
36 |
import jdk.test.lib.Utils; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
37 |
import jdk.test.lib.Asserts; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
38 |
|
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
48178
diff
changeset
|
39 |
/** |
43965
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
40 |
* @test |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
41 |
* @library /test/lib |
50791
b1e90a8a876c
8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents:
48178
diff
changeset
|
42 |
* @requires vm.hasSAandCanAttach |
44087
deab1e2f0ebf
8175512: new TestPrintMdo.java fails with -XX:TieredStopAtLevel=1
jgeorge
parents:
43965
diff
changeset
|
43 |
* @requires vm.flavor == "server" & !vm.emulatedClient & !(vm.opt.TieredStopAtLevel == 1) |
43965
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
44 |
* @build jdk.test.lib.apps.* |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
45 |
* @run main/othervm TestPrintMdo |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
46 |
*/ |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
47 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
48 |
public class TestPrintMdo { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
49 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
50 |
private static final String PRINTMDO_OUT_FILE = "printmdo_out.txt"; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
51 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
52 |
private static void verifyPrintMdoOutput() throws Exception { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
53 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
54 |
Exception unexpected = null; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
55 |
File printMdoFile = new File(PRINTMDO_OUT_FILE); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
56 |
Asserts.assertTrue(printMdoFile.exists() && printMdoFile.isFile(), |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
57 |
"File with printmdo output not created: " + |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
58 |
printMdoFile.getAbsolutePath()); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
59 |
try { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
60 |
Scanner scanner = new Scanner(printMdoFile); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
61 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
62 |
String unexpectedMsg = |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
63 |
"One or more of 'VirtualCallData', 'CounterData', " + |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
64 |
"'ReceiverTypeData', 'bci', 'MethodData' " + |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
65 |
"or 'java/lang/Object' not found"; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
66 |
boolean knownClassFound = false; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
67 |
boolean knownProfileDataTypeFound = false; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
68 |
boolean knownTokensFound = false; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
69 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
70 |
while (scanner.hasNextLine()) { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
71 |
String line = scanner.nextLine(); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
72 |
line = line.trim(); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
73 |
System.out.println(line); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
74 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
75 |
if (line.contains("missing reason for ")) { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
76 |
unexpected = new RuntimeException("Unexpected msg: missing reason for "); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
77 |
break; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
78 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
79 |
if (line.contains("VirtualCallData") || |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
80 |
line.contains("CounterData") || |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
81 |
line.contains("ReceiverTypeData")) { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
82 |
knownProfileDataTypeFound = true; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
83 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
84 |
if (line.contains("bci") || |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
85 |
line.contains("MethodData")) { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
86 |
knownTokensFound = true; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
87 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
88 |
if (line.contains("java/lang/Object")) { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
89 |
knownClassFound = true; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
90 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
91 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
92 |
if ((knownClassFound == false) || |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
93 |
(knownTokensFound == false) || |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
94 |
(knownProfileDataTypeFound == false)) { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
95 |
unexpected = new RuntimeException(unexpectedMsg); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
96 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
97 |
if (unexpected != null) { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
98 |
throw unexpected; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
99 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
100 |
} catch (Exception ex) { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
101 |
throw new RuntimeException("Test ERROR " + ex, ex); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
102 |
} finally { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
103 |
printMdoFile.delete(); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
104 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
105 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
106 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
107 |
private static void startClhsdbForPrintMdo(long lingeredAppPid) throws Exception { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
108 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
109 |
Process p; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
110 |
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb"); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
111 |
launcher.addToolArg("clhsdb"); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
112 |
launcher.addToolArg("--pid"); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
113 |
launcher.addToolArg(Long.toString(lingeredAppPid)); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
114 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
115 |
ProcessBuilder pb = new ProcessBuilder(); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
116 |
pb.command(launcher.getCommand()); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
117 |
System.out.println( |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
118 |
pb.command().stream().collect(Collectors.joining(" "))); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
119 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
120 |
try { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
121 |
p = pb.start(); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
122 |
} catch (Exception attachE) { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
123 |
throw new Error("Couldn't start jhsdb or attach to LingeredApp : " + attachE); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
124 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
125 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
126 |
// Issue the 'printmdo' input at the clhsdb prompt. |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
127 |
OutputStream input = p.getOutputStream(); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
128 |
String str = "printmdo -a > " + PRINTMDO_OUT_FILE + "\nquit\n"; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
129 |
try { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
130 |
input.write(str.getBytes()); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
131 |
input.flush(); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
132 |
} catch (IOException ioe) { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
133 |
throw new Error("Problem issuing the printmdo command: " + str, ioe); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
134 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
135 |
|
48178 | 136 |
OutputAnalyzer output = new OutputAnalyzer(p); |
137 |
||
43965
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
138 |
try { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
139 |
p.waitFor(); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
140 |
} catch (InterruptedException ie) { |
48178 | 141 |
p.destroyForcibly(); |
43965
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
142 |
throw new Error("Problem awaiting the child process: " + ie, ie); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
143 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
144 |
|
48178 | 145 |
output.shouldHaveExitValue(0); |
43965
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
146 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
147 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
148 |
public static void main (String... args) throws Exception { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
149 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
150 |
LingeredApp app = null; |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
151 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
152 |
try { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
153 |
List<String> vmArgs = new ArrayList<String>(); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
154 |
vmArgs.add("-XX:+ProfileInterpreter"); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
155 |
vmArgs.addAll(Utils.getVmOptions()); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
156 |
|
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
157 |
app = LingeredApp.startApp(vmArgs); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
158 |
System.out.println ("Started LingeredApp with pid " + app.getPid()); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
159 |
startClhsdbForPrintMdo(app.getPid()); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
160 |
verifyPrintMdoOutput(); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
161 |
} finally { |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
162 |
LingeredApp.stopApp(app); |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
163 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
164 |
} |
d9ba85f5cb9d
8175054: Move new TestPrintMdo.java to hotspot/test directory
jgeorge
parents:
diff
changeset
|
165 |
} |