Path: blob/master/test/hotspot/jtreg/serviceability/sa/TestIntConstant.java
41149 views
/*1* Copyright (c) 2017, 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.ArrayList;24import java.util.List;25import jdk.test.lib.apps.LingeredApp;26import jdk.test.lib.Utils;27import java.util.Map;28import java.util.HashMap;29import jtreg.SkippedException;3031/**32* @test33* @summary Test the 'intConstant' command of jhsdb clhsdb.34* @bug 819030735* @requires vm.hasSA36* @library /test/lib37* @build jdk.test.lib.apps.*38* @run main/othervm TestIntConstant39*/4041public class TestIntConstant {4243public static void main (String... args) throws Exception {44System.out.println("Starting TestIntConstant test");45LingeredApp app = null;46try {47ClhsdbLauncher test = new ClhsdbLauncher();4849app = LingeredApp.startApp();5051System.out.println ("Started LingeredApp with pid " + app.getPid());5253List<String> cmds = List.of("intConstant",54"intConstant _temp_constant 45",55"intConstant _temp_constant");5657Map<String, List<String>> expStrMap = new HashMap<>();5859// Strings to check for in the output of 'intConstant'. The60// 'intConstant' command prints out entries from the61// 'gHotSpotVMIntConstants', which is a table of integer constants,62// with names and the values derived from enums and #define preprocessor63// macros in hotspot.64expStrMap.put("intConstant", List.of(65"CollectedHeap::G1 3",66"RUNNABLE 2",67"Deoptimization::Reason_class_check 4",68"_thread_uninitialized 0"));69expStrMap.put("intConstant _temp_constant", List.of(70"intConstant _temp_constant 45"));71test.run(app.getPid(), cmds, expStrMap, null);72} catch (SkippedException se) {73throw se;74} catch (Exception ex) {75throw new RuntimeException("Test ERROR " + ex, ex);76} finally {77LingeredApp.stopApp(app);78}79System.out.println("Test PASSED");80}81}828384