Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/run/run002/run002.java
40951 views
/*1* Copyright (c) 2002, 2020, 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/*25* @test26*27* @summary converted from VM Testbase nsk/jdb/run/run002.28* VM Testbase keywords: [jpda, jdb]29* VM Testbase readme:30* DESCRIPTION31* This is a test for the 'run' command.32* The 'run' command is issued in the superclass of test driver class.33* The test is passed if "run nsk.jdb.run.run002a" string is found34* in jdb's output stream:35* The test consists of two parts:36* run002.java - test driver, i.e. launches jdb and debuggee,37* writes commands to jdb, reads the jdb output,38* run002a.java - the debugged application.39* COMMENTS40* This test functionally equals to nsk/jdb/run/run001 test and41* replaces it.42*43* @library /vmTestbase44* /test/lib45* @build nsk.jdb.run.run002.run002a46* @run main/othervm47* nsk.jdb.run.run002.run00248* -arch=${os.family}-${os.simpleArch}49* -waittime=550* -debugee.vmkind=java51* -transport.address=dynamic52* -jdb=${test.jdk}/bin/jdb53* -java.options="${test.vm.opts} ${test.java.opts}"54* -workdir=.55* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"56*/5758package nsk.jdb.run.run002;5960import nsk.share.*;61import nsk.share.jdb.*;6263import java.io.*;64import java.util.*;6566public class run002 extends JdbTest {6768public static void main (String argv[]) {69System.exit(run(argv, System.out) + JCK_STATUS_BASE);70}7172public static int run(String argv[], PrintStream out) {73debuggeeClass = DEBUGGEE_CLASS;74firstBreak = FIRST_BREAK;75lastBreak = LAST_BREAK;76return new run002().runTest(argv, out);77}7879static final String PACKAGE_NAME = "nsk.jdb.run.run002";80static final String TEST_CLASS = PACKAGE_NAME + ".run002";81static final String DEBUGGEE_CLASS = TEST_CLASS + "a";82static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";83static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";8485protected void runCases() {86String[] reply;87Paragrep grep;88int count;89Vector v;90String found;9192jdb.contToExit(1);9394if (argumentHandler.isLaunchingConnector()) {95reply = jdb.getTotalReply();96grep = new Paragrep(reply);97v = new Vector();98v.add(JdbCommand.run);99v.add(DEBUGGEE_CLASS);100if (grep.find(v) != 1) {101failure("jdb failed to run debugged application.");102}103}104}105}106107108