hotspot/test/runtime/MinimalVM/JMX.java
author ctornqvi
Tue, 23 Aug 2016 13:20:51 -0400
changeset 40660 d2f433c48708
child 44405 5bc48f22b149
permissions -rw-r--r--
8155964: Create a set of tests for verifying the Minimal VM Reviewed-by: gtriantafill, dholmes, lmesnik, cjplummer
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40660
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     1
/*
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     4
 *
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     8
 *
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    13
 * accompanied this code).
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    14
 *
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    18
 *
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    21
 * questions.
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    22
 */
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    23
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    24
/*
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    25
 * @test
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    26
 * @requires vm.flavor == "minimal"
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    27
 * @library /test/lib
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    28
 * @run main/othervm JMX
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    29
 */
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    30
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    31
import jdk.test.lib.JDKToolFinder;
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    32
import jdk.test.lib.process.OutputAnalyzer;
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    33
import jdk.test.lib.process.ProcessTools;
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    34
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    35
public class JMX {
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    36
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    37
    public static void main(String args[]) throws Exception {
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    38
        ProcessBuilder pb;
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    39
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    40
        pb = ProcessTools.createJavaProcessBuilder("-minimal", "-XX:+ManagementServer", "-version");
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    41
        new OutputAnalyzer(pb.start())
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    42
                .shouldContain("ManagementServer is not supported in this VM.")
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    43
                .shouldHaveExitValue(1);
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    44
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    45
        pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Dcom.sun.management ", "-version");
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    46
        new OutputAnalyzer(pb.start())
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    47
                .shouldContain("-Dcom.sun.management is not supported in this VM.")
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    48
                .shouldHaveExitValue(1);
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    49
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    50
        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), Long.toString(ProcessTools.getProcessId()), "VM.print_threads"});
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    51
        new OutputAnalyzer(pb.start())
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    52
                .shouldContain("Could not find any processes matching ")
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    53
                .shouldHaveExitValue(1);
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    54
    }
d2f433c48708 8155964: Create a set of tests for verifying the Minimal VM
ctornqvi
parents:
diff changeset
    55
}