Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/demo/jvmti/hprof/OptionsTest.java
38840 views
/*1* Copyright (c) 2004, 2014, 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*/222324/* @test25* @bug 5083441 629904726* @summary Test jvmti hprof27*28* @compile -g:lines HelloWorld.java ../DemoRun.java29* @build OptionsTest30* @run main OptionsTest HelloWorld31*/3233import java.util.*;3435public class OptionsTest {3637public static void main(String args[]) throws Exception {38DemoRun hprof;39List<String> options = new LinkedList<String>();4041options.add("cpu=samples,depth=0,file=options0.txt");42options.add("cpu=times,depth=0,file=options1.txt");43options.add("cpu=old,depth=0,file=options2.txt");44options.add("depth=0,file=options3.txt");4546for(String option: options) {47/* Run JVMTI hprof agent with various options */48hprof = new DemoRun("hprof", option);49hprof.runit(args[0]);5051/* Make sure patterns in output look ok */52if (hprof.output_contains("ERROR")) {53throw new RuntimeException("Test failed with " + option54+ " - ERROR seen in output");55}56}5758/* Must be a pass. */59System.out.println("Test passed - cleanly terminated");60}61}626364