1 /*
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
26 import java.io.File;
27 import java.io.IOException;
28 import java.nio.file.Files;
29 import java.nio.file.Path;
30 import java.nio.file.Paths;
31 import java.util.List;
32
33 import jdk.testlibrary.JcmdBase;
34 import jdk.testlibrary.OutputAnalyzer;
35 import jdk.testlibrary.ProcessTools;
36 import jdk.testlibrary.Utils;
37
38 /**
39 * Unit test for jcmd utility. The test will send different diagnostic command
40 * requests to the current java process.
41 */
42 /*
43 * @test
44 * @bug 7104647 7154822
45 * @library /lib/testlibrary
46 * @build jdk.testlibrary.*
47 * @run main/othervm -XX:+UsePerfData TestJcmdSanity
48 */
49 public class TestJcmdSanity {
50
51 private static final String TEST_SRC = System.getProperty("test.src").trim();
52 private static final String[] VM_ARGS = new String[] { "-XX:+UsePerfData" };
53 private static final String JCMD_COMMAND_REGEX = "(\\w|\\.)*";
54 private static final String PERF_COUNTER_REGEX = "(\\w|\\.)*\\=.*";
55
56 public static void main(String[] args) throws Exception {
57 testJcmdPidHelp();
58 testJcmdPidHelpHelp();
59 testJcmdPid_f();
60 testJcmdPidPerfCounterPrint();
61 testJcmdPidBigScript();
62 }
63
64 /**
65 * jcmd -J-XX:+UsePerfData pid help
|
1 /*
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
26 import java.io.File;
27 import java.io.IOException;
28 import java.nio.file.Files;
29 import java.nio.file.Path;
30 import java.nio.file.Paths;
31 import java.util.List;
32
33 import jdk.testlibrary.JcmdBase;
34 import jdk.testlibrary.OutputAnalyzer;
35 import jdk.testlibrary.ProcessTools;
36 import jdk.testlibrary.Utils;
37
38 /**
39 * Unit test for jcmd utility. The test will send different diagnostic command
40 * requests to the current java process.
41 */
42 /*
43 * @test
44 * @bug 7104647 7154822
45 * @library /lib/testlibrary
46 * @modules java.management
47 * @build jdk.testlibrary.*
48 * @run main/othervm -XX:+UsePerfData TestJcmdSanity
49 */
50 public class TestJcmdSanity {
51
52 private static final String TEST_SRC = System.getProperty("test.src").trim();
53 private static final String[] VM_ARGS = new String[] { "-XX:+UsePerfData" };
54 private static final String JCMD_COMMAND_REGEX = "(\\w|\\.)*";
55 private static final String PERF_COUNTER_REGEX = "(\\w|\\.)*\\=.*";
56
57 public static void main(String[] args) throws Exception {
58 testJcmdPidHelp();
59 testJcmdPidHelpHelp();
60 testJcmdPid_f();
61 testJcmdPidPerfCounterPrint();
62 testJcmdPidBigScript();
63 }
64
65 /**
66 * jcmd -J-XX:+UsePerfData pid help
|