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