1 /*
2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 
25 /*
26  * @test
27  *
28  * @summary converted from VM Testbase nsk/jdi/ObjectReference/waitingThreads/waitingthreads002.
29  * VM Testbase keywords: [quick, jpda, jdi]
30  * VM Testbase readme:
31  * DESCRIPTION:
32  *     The test checks an following assertion of
33  *     com.sun.jdi.ObjectReference.waitingThreads method spec:
34  *        Returns a List containing a ThreadReference for each thread currently
35  *        waiting for this object's monitor.
36  *     There are two test cases:
37  *        - An object with no waiting threads.
38  *          A list with zero size is expected to be returned by the method.
39  *        - An object with threads waiting to lock monitor in a synchronized statement.
40  *          The debugger checks with expected results:
41  *            - a size of returned list of ThreadReferences,
42  *            - the names of thread references,
43  *            - whether the thread reference has the same contented monitor object
44  *              as checked one.
45  *     The debugger program - nsk.jdi.ObjectReference.waitingThreads.waitingthreads004;
46  *     the debuggee program - nsk.jdi.ObjectReference.waitingThreads.waitingthreads004a.
47  *     Communication details between the debugger and the debuggee:
48  *        Using nsk.jdi.share classes, the debugger connects to debuggee program running
49  *        on another VM and establishes a communication pipe with the debuggee. The pipe
50  *        is used in bi-directional way by sending and receiving special commands between
51  *        the debugger and debuggee for synchronization
52  *     In case of error the test produces the exit code 97 and a corresponding error
53  *     message(s). Otherwise, the test is passed and produces the exit code 95 and
54  *     no message.
55  * COMMENTS:
56  *  4883502 TEST_BUG: waiting Threads testcases not predictable
57  *
58  * @library /vmTestbase
59  *          /test/lib
60  * @run driver jdk.test.lib.FileInstaller . .
61  * @build nsk.jdi.ObjectReference.waitingThreads.waitingthreads002
62  *        nsk.jdi.ObjectReference.waitingThreads.waitingthreads002a
63  * @run main/othervm PropertyResolvingWrapper
64  *      nsk.jdi.ObjectReference.waitingThreads.waitingthreads002
65  *      -verbose
66  *      -arch=${os.family}-${os.simpleArch}
67  *      -waittime=5
68  *      -debugee.vmkind=java
69  *      -transport.address=dynamic
70  *      "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
71  */
72 
73