Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/TestDescription.java
40955 views
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/ClassFileLoadHook/classfloadhk006.
29
* VM Testbase keywords: [quick, jpda, jvmti, noras, redefine]
30
* VM Testbase readme:
31
* DESCRIPTION
32
* This JVMTI test exercises JVMTI event ClassFileLoadHook().
33
* This test checks if CLASS_FILE_LOAD_HOOK event is received
34
* upon redefinition of tested class and correct class reference
35
* as well as original and redefined bytecodes are passed
36
* to the event callback.
37
* The tested class is loaded with default classloader.
38
* This test uses two different bytecodes of the tested class
39
* 'classfloadhk006r' compiled from the different sources.
40
* This directory contains original source of the tested class,
41
* which is used to load class with default loader in debuggee class.
42
* The subdirectory 'newclass' contains redefined class
43
* with changed implementation of methods.
44
* The test performs the following checks:
45
* - CLASS_FILE_LOAD_HOOK event callback is invoked and only once
46
* for the tested class upon its redefinition
47
* - reference to redefined class passed to the event callback
48
* is equal to expected one
49
* - redefined bytecode passed to the event callback is equal
50
* to expected one
51
* - the new redefined bytecode of the tested class is actually
52
* used after class redefinition
53
* The debuggee class preliminary loads redefined bytecode of
54
* the tested class into static field and agent gets this
55
* bytecode to use it in CLASS_FILE_LOAD_HOOK event callback.
56
* The debuggee loads tested class using default classloader.
57
* The agent enables CLASS_FILE_LOAD_HOOK event and redefines
58
* tested class with the new bytecode.
59
* Upon receiving CLASS_FILE_LOAD_HOOK event the agent performs
60
* checks for class reference and bytecode passed to the event
61
* callback.
62
* If no CLASS_FILE_LOAD_HOOK events were received, the agent
63
* complains an error.
64
* After tested class has been redefined debuggee uses reflection
65
* API to call static method of this class. If method returns value
66
* according to the redefined implementation, then the new bytecode
67
* was actually used for redefinition of tested class. Otherwise,
68
* if method returns value according to the old implementation,
69
* or any unexpected value, then the test complains an error.
70
* If all checks are successfull, the test passes with exit code 95,
71
* otherwise the test fails with exit code 97.
72
* COMMENTS
73
* Modified due to fix of the rfe
74
* 5010823 TEST_RFE: some JVMTI tests use the replaced capability
75
*
76
* @library /vmTestbase
77
* /test/lib
78
* @build nsk.jvmti.ClassFileLoadHook.classfloadhk006
79
* nsk.jvmti.ClassFileLoadHook.classfloadhk006r
80
*
81
* @comment compile newclassXX to bin/newclassXX
82
* @run driver nsk.share.ExtraClassesBuilder
83
* newclass
84
*
85
* @run main/othervm/native
86
* -agentlib:classfloadhk006=-waittime=5
87
* nsk.jvmti.ClassFileLoadHook.classfloadhk006
88
* ./bin
89
*/
90
91
92