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