author | dholmes |
Thu, 01 Feb 2018 21:03:37 -0500 | |
changeset 48698 | aca813e53416 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
1 |
/* |
48698
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
4 |
* |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
8 |
* |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
13 |
* accompanied this code). |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
14 |
* |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
18 |
* |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
21 |
* questions. |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
22 |
*/ |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
23 |
|
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38152
diff
changeset
|
24 |
import jdk.test.lib.process.OutputAnalyzer; |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30121
diff
changeset
|
25 |
import jdk.test.lib.dcmd.CommandExecutor; |
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30121
diff
changeset
|
26 |
import jdk.test.lib.dcmd.JMXExecutor; |
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30121
diff
changeset
|
27 |
import jdk.test.lib.dcmd.PidJcmdExecutor; |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
28 |
import org.testng.annotations.Test; |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
29 |
|
48698
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
30 |
import java.util.Arrays; |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
31 |
import java.util.List; |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
32 |
import java.util.regex.Matcher; |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
33 |
import java.util.regex.Pattern; |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
34 |
|
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
35 |
/* |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
36 |
* @test |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
37 |
* @bug 8054890 |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
38 |
* @summary Test of JVMTI.data_dump diagnostic command |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
30604
diff
changeset
|
39 |
* @modules java.base/jdk.internal.misc |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
38152
diff
changeset
|
40 |
* @library /test/lib |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
41 |
* @run testng DataDumpDcmdTest |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
42 |
*/ |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
43 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
44 |
/** |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
45 |
* This test issues the "JVMTI.data_dump" command which will dump the related JVMTI |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
46 |
* data. |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
47 |
* |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
48 |
*/ |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
49 |
public class DataDumpDcmdTest { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
50 |
public void run(CommandExecutor executor) { |
48698
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
51 |
OutputAnalyzer out = executor.execute("JVMTI.data_dump"); |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
52 |
|
48698
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
53 |
// stderr should be empty except for VM warnings. |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
54 |
if (!out.getStderr().isEmpty()) { |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
55 |
List<String> lines = Arrays.asList(out.getStderr().split("(\\r\\n|\\n|\\r)")); |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
56 |
Pattern p = Pattern.compile(".*VM warning.*"); |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
57 |
for (String line : lines) { |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
58 |
Matcher m = p.matcher(line); |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
59 |
if (!m.matches()) { |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
60 |
throw new RuntimeException("Stderr has output other than VM warnings"); |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
61 |
} |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
62 |
} |
aca813e53416
8196534: [Testbug] serviceability/dcmd/jvmti/*DcmdTest tests can't tolerate unrelated warnings
dholmes
parents:
47216
diff
changeset
|
63 |
} |
30121
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
64 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
65 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
66 |
@Test |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
67 |
public void jmx() throws Throwable { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
68 |
run(new JMXExecutor()); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
69 |
} |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
70 |
|
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
71 |
@Test |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
72 |
public void cli() throws Throwable { |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
73 |
run(new PidJcmdExecutor()); |
cc43664a0ad7
8054890: Serviceability: New diagnostic commands 'VM.set_flag' and 'JVMTI.data_dump'
jbachorik
parents:
diff
changeset
|
74 |
} |
30604
b8d532cb6420
8067013: Rename the com.oracle.java.testlibary package
ykantser
parents:
30121
diff
changeset
|
75 |
} |