Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdb/threadgroups/threadgroups002/threadgroups002.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/threadgroups/threadgroups002.28* VM Testbase keywords: [jpda, jdb]29* VM Testbase readme:30* DECSRIPTION31* This is a test for jdb 'threadgroups' command.32* The main thread creates 3 threadgroups of 5 threads each.33* All threads are locked in their 'run' method on a lock that the main34* thread holds. The 'threadgroups' command is issued at this point.35* The test passes if three user-defined threadgroups are reported.36* COMMENTS37* This test functionally equals to nsk/jdb/threadgroups/threadgroups00138* test and replaces it.39*40* @library /vmTestbase41* /test/lib42* @build nsk.jdb.threadgroups.threadgroups002.threadgroups002a43* @run main/othervm44* nsk.jdb.threadgroups.threadgroups002.threadgroups00245* -arch=${os.family}-${os.simpleArch}46* -waittime=547* -debugee.vmkind=java48* -transport.address=dynamic49* -jdb=${test.jdk}/bin/jdb50* -java.options="${test.vm.opts} ${test.java.opts}"51* -workdir=.52* -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"53*/5455package nsk.jdb.threadgroups.threadgroups002;5657import nsk.share.*;58import nsk.share.jdb.*;5960import java.io.*;61import java.util.*;6263public class threadgroups002 extends JdbTest {6465public static void main (String argv[]) {66System.exit(run(argv, System.out) + JCK_STATUS_BASE);67}6869public static int run(String argv[], PrintStream out) {70debuggeeClass = DEBUGGEE_CLASS;71firstBreak = FIRST_BREAK;72lastBreak = LAST_BREAK;73return new threadgroups002().runTest(argv, out);74}7576static final String PACKAGE_NAME = "nsk.jdb.threadgroups.threadgroups002";77static final String TEST_CLASS = PACKAGE_NAME + ".threadgroups002";78static final String DEBUGGEE_CLASS = TEST_CLASS + "a";79static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main";80static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak";8182protected void runCases() {83String[] reply;84Paragrep grep;85int count;86Vector v;87String found;8889jdb.setBreakpointInMethod(LAST_BREAK);90jdb.receiveReplyFor(JdbCommand.cont);9192reply = jdb.receiveReplyFor(JdbCommand.threadgroups);93grep = new Paragrep(reply);94count = grep.find(threadgroups002a.THREADGROUP_NAME);95if (count != threadgroups002a.numThreadGroups ) {96failure("Unexpected number of " + threadgroups002a.THREADGROUP_NAME + " was listed: " + count +97"\n\texpected value: " + threadgroups002a.numThreadGroups);98}99100jdb.contToExit(1);101}102}103104105