1 /*
2  * Copyright (c) 2018, 2020, 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/jvmti/scenarios/capability/CM01/cm01t009.
29  * VM Testbase keywords: [quick, jpda, jvmti, noras, redefine]
30  * VM Testbase readme:
31  * DESCRIPTION
32  *     The test is for CM01 scenario of "capability management".
33  *     This test checks capability can_signal_thread
34  *     and correspondent functions:
35  *         StopThread
36  *         InterruptThread
37  *     Testcases:
38  *       1. Check if GetPotentialCapabilities returns the capability
39  *       2. Add the capability during Onload phase
40  *       3. Check if GetCapabilities returns the capability
41  *       4. Relinquish the capability during Onload phase
42  *       5. Check if GetCapabilities does not return the capability
43  *       6. Add back the capability and check with GetCapabilities
44  *       7. Check that only correspondent function work and functions of
45  *          other capabilities return JVMTI_ERROR_MUST_POSSESS_CAPABILITY
46  *       8. Check if VM exits well with the capability has not been relinquished
47  * COMMENTS
48  *     The test updated to match new JVMTI spec 0.2.90:
49  *     - remove function checkExceptionInfoFunctions()
50  *       because of removed capability can_get_exception_info
51  *     - extend function checkSourceInfoFunctions()
52  *       by adding check for GetSourceFileName()
53  *     - change signatures of heap iteration callbacks
54  *       used in function checkHeapFunctions()
55  *     - change signature of agentProc function
56  *       and save JNIEnv pointer now passed as argument.
57  *     Fixed according to 4960375 bug.
58  *         The test updated to match new JVMTI spec 0.2.94: changed signature
59  *         of heap iteration callbacks used in checkHeapFunctions().
60  *     In addition to the previous fix made alive
61  *     checkGetCurrentThreadCpuTime() and checkGetThreadCpuTime().
62  *     Fixed according to bug 6277019.
63  *       Remove function IsMethodObsolete
64  *       because of removed capability can_redefine_classes
65  *
66  * @library /vmTestbase
67  *          /test/lib
68  * @run main/othervm/native
69  *      -agentlib:cm01t009=-waittime=5
70  *      nsk.jvmti.scenarios.capability.CM01.cm01t009
71  */
72 
73