Path: blob/master/test/hotspot/jtreg/serviceability/sa/ClhsdbPrintAll.java
41152 views
/*1* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.util.HashMap;24import java.util.List;25import java.util.Map;26import jdk.test.lib.apps.LingeredApp;27import jtreg.SkippedException;2829/**30* @test31* @bug 817538432* @summary Test clhsdb 'printall' command33* @requires vm.hasSA34* @library /test/lib35* @run main/othervm/timeout=2400 -Xmx1g ClhsdbPrintAll36*/3738public class ClhsdbPrintAll {3940public static void main(String[] args) throws Exception {41System.out.println("Starting ClhsdbPrintAll test");4243LingeredAppWithEnum theApp = null;44try {45ClhsdbLauncher test = new ClhsdbLauncher();4647theApp = new LingeredAppWithEnum();48LingeredApp.startApp(theApp);49System.out.println("Started LingeredAppWithEnum with pid " + theApp.getPid());5051List<String> cmds = List.of("printall");5253Map<String, List<String>> expStrMap = new HashMap<>();54Map<String, List<String>> unExpStrMap = new HashMap<>();55expStrMap.put("printall", List.of(56"aload_0",57"Constant Pool of",58"public static void main\\(java.lang.String\\[\\]\\)",59"Bytecode",60"\\[enum\\] class Song \\[signature Ljava/lang/Enum\\<LSong;\\>;\\]",61"Method java.lang.Object clone\\(\\)",62"public static Song\\[\\] values\\(\\)",63"invokevirtual",64"checkcast",65"Field Song HAVANA",66"Exception Table",67"invokedynamic"));68unExpStrMap.put("printall", List.of(69"cannot be cast to class"));70test.run(theApp.getPid(), cmds, expStrMap, unExpStrMap);71} catch (SkippedException se) {72throw se;73} catch (Exception ex) {74throw new RuntimeException("Test ERROR " + ex, ex);75} finally {76LingeredApp.stopApp(theApp);77}78System.out.println("Test PASSED");79}80}818283