24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @key nmt jcmd |
26 * @key nmt jcmd |
27 * @summary Verify that jcmd correctly reports that NMT is not enabled |
27 * @summary Verify that jcmd correctly reports that NMT is not enabled |
28 * @library /testlibrary |
28 * @library /testlibrary |
29 * First run without enabling NMT |
29 * @run main JcmdWithNMTDisabled 1 |
30 * @run main/othervm JcmdWithNMTDisabled |
|
31 * Then run with explicitly disabling NMT, should not be any difference |
|
32 * @run main/othervm -XX:NativeMemoryTracking=off JcmdWithNMTDisabled |
|
33 */ |
30 */ |
34 |
31 |
35 import com.oracle.java.testlibrary.*; |
32 import com.oracle.java.testlibrary.*; |
36 |
33 |
37 public class JcmdWithNMTDisabled { |
34 public class JcmdWithNMTDisabled { |
38 static ProcessBuilder pb = new ProcessBuilder(); |
35 static ProcessBuilder pb = new ProcessBuilder(); |
39 static String pid; |
36 static String pid; |
40 |
37 |
41 public static void main(String args[]) throws Exception { |
38 public static void main(String args[]) throws Exception { |
|
39 |
|
40 // This test explicitly needs to be run with the exact command lines below, not passing on |
|
41 // arguments from the parent VM is a conscious choice to avoid NMT being turned on. |
|
42 if (args.length > 0) { |
|
43 ProcessBuilder pb; |
|
44 OutputAnalyzer output; |
|
45 String testjdkPath = System.getProperty("test.jdk"); |
|
46 |
|
47 // First run without enabling NMT |
|
48 pb = ProcessTools.createJavaProcessBuilder("-Dtest.jdk=" + testjdkPath, "JcmdWithNMTDisabled"); |
|
49 output = new OutputAnalyzer(pb.start()); |
|
50 output.shouldHaveExitValue(0); |
|
51 |
|
52 // Then run with explicitly disabling NMT, should not be any difference |
|
53 pb = ProcessTools.createJavaProcessBuilder("-Dtest.jdk=" + testjdkPath, "-XX:NativeMemoryTracking=off", "JcmdWithNMTDisabled"); |
|
54 output = new OutputAnalyzer(pb.start()); |
|
55 output.shouldHaveExitValue(0); |
|
56 |
|
57 return; |
|
58 } |
|
59 |
42 // Grab my own PID |
60 // Grab my own PID |
43 pid = Integer.toString(ProcessTools.getProcessId()); |
61 pid = Integer.toString(ProcessTools.getProcessId()); |
44 |
62 |
45 jcmdCommand("summary"); |
63 jcmdCommand("summary"); |
46 jcmdCommand("detail"); |
64 jcmdCommand("detail"); |