author | ysuenaga |
Wed, 13 Nov 2019 10:27:06 +0900 | |
changeset 59045 | 846fee5ea75e |
parent 51840 | dc15e45122b2 |
permissions | -rw-r--r-- |
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
1 |
/* |
51540
3d3e8a33701e
8186548: move jdk.testlibrary.JcmdBase closer to tests
iignatyev
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. |
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
4 |
* |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
8 |
* |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
13 |
* accompanied this code). |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
14 |
* |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
18 |
* |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
21 |
* questions. |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
22 |
*/ |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
23 |
|
51840 | 24 |
import static jdk.test.lib.Asserts.*; |
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
25 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
26 |
import java.io.File; |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
27 |
import java.io.IOException; |
28412 | 28 |
import java.nio.file.Files; |
29 |
import java.nio.file.Path; |
|
30 |
import java.nio.file.Paths; |
|
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
31 |
import java.util.List; |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
32 |
|
51675 | 33 |
import jdk.test.lib.process.OutputAnalyzer; |
34 |
import jdk.test.lib.process.ProcessTools; |
|
51754 | 35 |
import jdk.test.lib.Utils; |
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
36 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
37 |
/* |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
38 |
* @test |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
39 |
* @bug 7104647 7154822 |
44423 | 40 |
* @summary Unit test for jcmd utility. The test will send different diagnostic |
41 |
* command requests to the current java process. |
|
42 |
* |
|
51675 | 43 |
* @library /test/lib |
44423 | 44 |
* |
24505
d2c5179475ea
8043551: [TESTBUG] sun/tools/jcmd/TestJcmdSanity.java failure in nightly jdk9-dev fastdebug build
sla
parents:
24366
diff
changeset
|
45 |
* @run main/othervm -XX:+UsePerfData TestJcmdSanity |
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
46 |
*/ |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
47 |
public class TestJcmdSanity { |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
48 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
49 |
private static final String TEST_SRC = System.getProperty("test.src").trim(); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
50 |
private static final String[] VM_ARGS = new String[] { "-XX:+UsePerfData" }; |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
51 |
private static final String JCMD_COMMAND_REGEX = "(\\w|\\.)*"; |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
52 |
private static final String PERF_COUNTER_REGEX = "(\\w|\\.)*\\=.*"; |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
53 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
54 |
public static void main(String[] args) throws Exception { |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
55 |
testJcmdPidHelp(); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
56 |
testJcmdPidHelpHelp(); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
57 |
testJcmdPid_f(); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
58 |
testJcmdPidPerfCounterPrint(); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
59 |
testJcmdPidBigScript(); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
60 |
} |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
61 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
62 |
/** |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
63 |
* jcmd -J-XX:+UsePerfData pid help |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
64 |
*/ |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
65 |
private static void testJcmdPidHelp() throws Exception { |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
66 |
OutputAnalyzer output = JcmdBase.jcmd(VM_ARGS, |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
67 |
new String[] {"help"}); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
68 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
69 |
output.shouldHaveExitValue(0); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
70 |
output.shouldNotContain("Exception"); |
34327
50693d25f4a7
8139430: Refactor test library to decrease module dependencies of tests
shurailine
parents:
30376
diff
changeset
|
71 |
output.shouldContain(Long.toString(ProcessTools.getProcessId()) + ":"); |
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
72 |
matchJcmdCommands(output); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
73 |
output.shouldContain("For more information about a specific command use 'help <command>'."); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
74 |
} |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
75 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
76 |
/** |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
77 |
* jcmd -J-XX:+UsePerfData pid help help |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
78 |
*/ |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
79 |
private static void testJcmdPidHelpHelp() throws Exception { |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
80 |
OutputAnalyzer output = JcmdBase.jcmd(VM_ARGS, |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
81 |
new String[] {"help", "help"}); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
82 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
83 |
output.shouldHaveExitValue(0); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
84 |
verifyOutputAgainstFile(output); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
85 |
} |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
86 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
87 |
/** |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
88 |
* jcmd -J-XX:+UsePerfData pid PerfCounter.print |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
89 |
*/ |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
90 |
private static void testJcmdPidPerfCounterPrint() throws Exception { |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
91 |
OutputAnalyzer output = JcmdBase.jcmd(VM_ARGS, |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
92 |
new String[] {"PerfCounter.print"}); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
93 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
94 |
output.shouldHaveExitValue(0); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
95 |
matchPerfCounters(output); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
96 |
} |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
97 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
98 |
/** |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
99 |
* jcmd -J-XX:+UsePerfData pid -f dcmd-script.txt |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
100 |
*/ |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
101 |
private static void testJcmdPid_f() throws Exception { |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
102 |
File scrpitFile = new File(TEST_SRC, "dcmd-script.txt"); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
103 |
OutputAnalyzer output = JcmdBase.jcmd(VM_ARGS, |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
104 |
new String[] {"-f", scrpitFile.getAbsolutePath()}); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
105 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
106 |
output.shouldHaveExitValue(0); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
107 |
verifyOutputAgainstFile(output); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
108 |
} |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
109 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
110 |
/** |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
111 |
* Tests that it possible send a file over 1024 bytes large via jcmd -f. |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
112 |
* |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
113 |
* jcmd -J-XX:+UsePerfData pid -f dcmd-big-script.txt |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
114 |
*/ |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
115 |
private static void testJcmdPidBigScript() throws Exception { |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
116 |
File scrpitFile = new File(TEST_SRC, "dcmd-big-script.txt"); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
117 |
OutputAnalyzer output = JcmdBase.jcmd(VM_ARGS, |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
118 |
new String[] {"-f", scrpitFile.getAbsolutePath()}); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
119 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
120 |
output.shouldHaveExitValue(0); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
121 |
output.shouldNotContain("Exception"); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
122 |
output.shouldContain(System.getProperty("java.vm.name").trim()); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
123 |
} |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
124 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
125 |
/** |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
126 |
* Verifies the listed jcmd commands match a certain pattern. |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
127 |
* |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
128 |
* The output of the jcmd commands should look like: |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
129 |
* VM.uptime |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
130 |
* VM.flags |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
131 |
* VM.system_properties |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
132 |
* |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
133 |
* @param output The generated output from the jcmd. |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
134 |
* @throws Exception |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
135 |
*/ |
51675 | 136 |
private static void matchJcmdCommands(OutputAnalyzer output) { |
137 |
output.shouldMatchByLine(JCMD_COMMAND_REGEX, |
|
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
138 |
"help", |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
139 |
JCMD_COMMAND_REGEX); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
140 |
} |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
141 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
142 |
/** |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
143 |
* Verifies the generated output from the PerfCounter.print command |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
144 |
* matches a certain pattern. |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
145 |
* |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
146 |
* The output of perf counters should look like: |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
147 |
* java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM" |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
148 |
* java.threads.daemon=7 |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
149 |
* sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta" |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
150 |
* |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
151 |
* @param output The generated output from the PerfCounter.print command. |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
152 |
* @throws Exception |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
153 |
*/ |
51675 | 154 |
private static void matchPerfCounters(OutputAnalyzer output) { |
155 |
output.shouldMatchByLineFrom(PERF_COUNTER_REGEX, |
|
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
156 |
PERF_COUNTER_REGEX); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
157 |
} |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
158 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
159 |
private static void verifyOutputAgainstFile(OutputAnalyzer output) throws IOException { |
28412 | 160 |
Path path = Paths.get(TEST_SRC, "help_help.out"); |
161 |
List<String> fileOutput = Files.readAllLines(path); |
|
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
162 |
List<String> outputAsLines = output.asLines(); |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
163 |
assertTrue(outputAsLines.containsAll(fileOutput), |
28412 | 164 |
"The ouput should contain all content of " + path.toAbsolutePath()); |
22286
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
165 |
} |
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
166 |
|
5c1a07e4573d
7185591: jcmd-big-script.sh ERROR: could not find app's Java pid.
ykantser
parents:
diff
changeset
|
167 |
} |