test/hotspot/jtreg/serviceability/sa/ClhsdbJhisto.java
author stefank
Tue, 19 Feb 2019 10:04:53 +0100
changeset 53817 784537ff9c4e
parent 53596 bb40a5303c84
child 54388 a1acc800c87a
permissions -rw-r--r--
8218978: SA: Enable more ZGC testing Reviewed-by: eosterlund, ysuenaga
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48160
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
     1
/*
53596
bb40a5303c84 8217473: SA: Tests using ClhsdbLauncher fail on SAP docker containers
jgeorge
parents: 52925
diff changeset
     2
 * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
48160
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
     4
 *
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
     7
 * published by the Free Software Foundation.
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
     8
 *
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    13
 * accompanied this code).
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    14
 *
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    18
 *
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    21
 * questions.
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    22
 */
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    23
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    24
import java.util.ArrayList;
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    25
import java.util.HashMap;
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    26
import java.util.List;
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    27
import java.util.Map;
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    28
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    29
import jdk.test.lib.apps.LingeredApp;
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    30
import jdk.test.lib.Utils;
53596
bb40a5303c84 8217473: SA: Tests using ClhsdbLauncher fail on SAP docker containers
jgeorge
parents: 52925
diff changeset
    31
import jtreg.SkippedException;
48160
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    32
50791
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 49921
diff changeset
    33
/**
48160
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    34
 * @test
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    35
 * @bug 8191658
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    36
 * @summary Test clhsdb jhisto command
50791
b1e90a8a876c 8205419: [testbug] TestJmapCore failing without SA: introduce @requires vm.hasSAandCanAttach
goetz
parents: 49921
diff changeset
    37
 * @requires vm.hasSA
52925
9c18c9d839d3 8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents: 52797
diff changeset
    38
 * @requires vm.gc != "Shenandoah"
48160
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    39
 * @library /test/lib
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    40
 * @run main/othervm ClhsdbJhisto
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    41
 */
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    42
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    43
public class ClhsdbJhisto {
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    44
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    45
    public static void main(String[] args) throws Exception {
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    46
        System.out.println("Starting ClhsdbJhisto test");
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    47
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    48
        LingeredAppWithInterface theApp = null;
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    49
        try {
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    50
            ClhsdbLauncher test = new ClhsdbLauncher();
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    51
            List<String> vmArgs = new ArrayList<String>();
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    52
            vmArgs.addAll(Utils.getVmOptions());
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    53
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    54
            theApp = new LingeredAppWithInterface();
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    55
            LingeredApp.startApp(vmArgs, theApp);
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    56
            System.out.println("Started LingeredApp with pid " + theApp.getPid());
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    57
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    58
            List<String> cmds = List.of("jhisto");
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    59
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    60
            Map<String, List<String>> expStrMap = new HashMap<>();
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    61
            expStrMap.put("jhisto", List.of(
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    62
                    "java.lang.String",
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    63
                    "java.util.HashMap",
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    64
                    "java.lang.Class",
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    65
                    "java.nio.HeapByteBuffer",
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    66
                    "java.net.URI",
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    67
                    "LingeredAppWithInterface",
49921
b708a1e34fcc 8202417: [TESTBUG] Broken hard-coded dependency in serviceability/sa/ClhsdbJhisto.java
redestad
parents: 48160
diff changeset
    68
                    "ParselTongue"));
48160
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    69
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    70
            test.run(theApp.getPid(), cmds, expStrMap, null);
53596
bb40a5303c84 8217473: SA: Tests using ClhsdbLauncher fail on SAP docker containers
jgeorge
parents: 52925
diff changeset
    71
        } catch (SkippedException se) {
bb40a5303c84 8217473: SA: Tests using ClhsdbLauncher fail on SAP docker containers
jgeorge
parents: 52925
diff changeset
    72
            throw se;
48160
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    73
        } catch (Exception ex) {
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    74
            throw new RuntimeException("Test ERROR " + ex, ex);
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    75
        } finally {
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    76
            LingeredApp.stopApp(theApp);
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    77
        }
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    78
        System.out.println("Test PASSED");
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    79
    }
599f67f3c6d6 8191658: SA: Testcases for attach, detach, reattach and Jhisto commands
sballal
parents:
diff changeset
    80
}