test/hotspot/jtreg/serviceability/sa/ClhsdbLongConstant.java
author sballal
Thu, 16 Nov 2017 09:26:48 +0530
changeset 47899 f113d1ef7bed
child 50107 300e4a88c400
permissions -rw-r--r--
8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands Reviewed-by: jgeorge, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47899
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
     1
/*
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
     4
 *
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
     7
 * published by the Free Software Foundation.
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
     8
 *
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    13
 * accompanied this code).
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    14
 *
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    18
 *
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    21
 * questions.
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    22
 */
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    23
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    24
import java.util.HashMap;
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    25
import java.util.List;
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    26
import java.util.Map;
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    27
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    28
import jdk.test.lib.apps.LingeredApp;
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    29
import jdk.test.lib.Platform;
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    30
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    31
/*
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    32
 * @test
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    33
 * @bug 8190198
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    34
 * @summary Test clhsdb longConstant command
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    35
 * @library /test/lib
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    36
 * @run main/othervm ClhsdbLongConstant
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    37
 */
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    38
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    39
public class ClhsdbLongConstant {
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    40
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    41
    public static void main(String[] args) throws Exception {
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    42
        System.out.println("Starting ClhsdbLongConstant test");
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    43
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    44
        LingeredApp theApp = null;
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    45
        try {
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    46
            ClhsdbLauncher test = new ClhsdbLauncher();
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    47
            theApp = LingeredApp.startApp();
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    48
            System.out.println("Started LingeredApp with pid " + theApp.getPid());
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    49
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    50
            List<String> cmds = List.of(
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    51
                    "longConstant",
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    52
                    "longConstant markOopDesc::locked_value",
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    53
                    "longConstant markOopDesc::lock_bits",
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    54
                    "longConstant jtreg::test 6",
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    55
                    "longConstant jtreg::test");
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    56
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    57
            Map<String, List<String>> expStrMap = new HashMap<>();
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    58
            expStrMap.put("longConstant", List.of(
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    59
                    "longConstant markOopDesc::locked_value",
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    60
                    "longConstant markOopDesc::lock_bits",
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    61
                    "InvocationCounter::count_increment",
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    62
                    "markOopDesc::epoch_mask_in_place"));
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    63
            expStrMap.put("longConstant markOopDesc::locked_value", List.of(
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    64
                    "longConstant markOopDesc::locked_value"));
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    65
            expStrMap.put("longConstant markOopDesc::lock_bits", List.of(
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    66
                    "longConstant markOopDesc::lock_bits"));
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    67
            expStrMap.put("longConstant jtreg::test", List.of(
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    68
                    "longConstant jtreg::test 6"));
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    69
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    70
            Map<String, List<String>> unExpStrMap = new HashMap<>();
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    71
            unExpStrMap.put("longConstant jtreg::test", List.of(
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    72
                    "Error: java.lang.RuntimeException: No long constant named"));
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    73
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    74
            test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    75
        } catch (Exception ex) {
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    76
            throw new RuntimeException("Test ERROR " + ex, ex);
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    77
        } finally {
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    78
            LingeredApp.stopApp(theApp);
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    79
        }
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    80
        System.out.println("Test PASSED");
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    81
    }
f113d1ef7bed 8190198: SA: Framework for writing 'jhsdb clhsdb' commands tests and testcases for some of the commands
sballal
parents:
diff changeset
    82
}