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