hotspot/test/serviceability/dcmd/vm/DynLibsTest.java
changeset 28821 f7820f311663
child 29678 dd2f3932c21e
equal deleted inserted replaced
28820:1837a69c2a22 28821:f7820f311663
       
     1 import org.testng.annotations.Test;
       
     2 import org.testng.Assert;
       
     3 
       
     4 import com.oracle.java.testlibrary.OutputAnalyzer;
       
     5 import com.oracle.java.testlibrary.Platform;
       
     6 import com.oracle.java.testlibrary.dcmd.CommandExecutor;
       
     7 import com.oracle.java.testlibrary.dcmd.JMXExecutor;
       
     8 
       
     9 /*
       
    10  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
       
    11  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
    12  *
       
    13  * This code is free software; you can redistribute it and/or modify it
       
    14  * under the terms of the GNU General Public License version 2 only, as
       
    15  * published by the Free Software Foundation.
       
    16  *
       
    17  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    18  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    19  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    20  * version 2 for more details (a copy is included in the LICENSE file that
       
    21  * accompanied this code).
       
    22  *
       
    23  * You should have received a copy of the GNU General Public License version
       
    24  * 2 along with this work; if not, write to the Free Software Foundation,
       
    25  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    26  *
       
    27  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    28  * or visit www.oracle.com if you need additional information or have any
       
    29  * questions.
       
    30  */
       
    31 
       
    32 /*
       
    33  * @test
       
    34  * @summary Test of VM.dynlib diagnostic command via MBean
       
    35  * @library /testlibrary
       
    36  * @build com.oracle.java.testlibrary.*
       
    37  * @build com.oracle.java.testlibrary.dcmd.*
       
    38  * @run testng DynLibsTest
       
    39  */
       
    40 
       
    41 public class DynLibsTest {
       
    42 
       
    43     public void run(CommandExecutor executor) {
       
    44         OutputAnalyzer output = executor.execute("VM.dynlibs");
       
    45 
       
    46         String osDependentBaseString = null;
       
    47         if (Platform.isAix()) {
       
    48             osDependentBaseString = "lib%s.so";
       
    49         } else if (Platform.isLinux()) {
       
    50             osDependentBaseString = "lib%s.so";
       
    51         } else if (Platform.isOSX()) {
       
    52             osDependentBaseString = "lib%s.dylib";
       
    53         } else if (Platform.isSolaris()) {
       
    54             osDependentBaseString = "lib%s.so";
       
    55         } else if (Platform.isWindows()) {
       
    56             osDependentBaseString = "%s.dll";
       
    57         }
       
    58 
       
    59         if (osDependentBaseString == null) {
       
    60             Assert.fail("Unsupported OS");
       
    61         }
       
    62 
       
    63         output.shouldContain(String.format(osDependentBaseString, "jvm"));
       
    64         output.shouldContain(String.format(osDependentBaseString, "java"));
       
    65         output.shouldContain(String.format(osDependentBaseString, "management"));
       
    66     }
       
    67 
       
    68     @Test
       
    69     public void jmx() {
       
    70         run(new JMXExecutor());
       
    71     }
       
    72 }