Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch002/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/AddToBootstrapClassLoaderSearch/bootclssearch002.
29
* VM Testbase keywords: [quick, jpda, jvmti, onload_only_logic, noras, no_cds]
30
* VM Testbase readme:
31
* DESCRIPTION
32
* This JVMTI test exercises JVMTI thread function AddToBootstrapClassLoaderSearch().
33
* This test checks that AddToBootstrapClassLoaderSearch() adds segment
34
* to bootstrap class search path and bootstrap classloader will find
35
* debuggee class using that segment.
36
* Debuggee class has direct superclass located in the original bootstrap classpath.
37
* The following checks are performed by the test:
38
* - AddToBootstrapClassLoaderSearch() returns no errors in OnLoad phase
39
* - debuggee class will be found by bootstrap classloader using added segment
40
* - superclass needed for debuggee class will be also found by bootstrap
41
* classloader though located in the original bootstrap classpath
42
* - superclass needed for debuggee class will be loaded from bootstrap
43
* classpath, not from usual classpath
44
* Source of debuggee class 'bootclssearch002' is located in subdirectory 'newclass'.
45
* It will be compiled to '$COMMON_CLASSES_LOCATION/newclass', where it usually
46
* cannot be found by bootstrap classloader.
47
* The superclass 'bootclssearch002p' has two different implementations.
48
* Source of "positive" implementation is located in subdirectory 'loadclass'.
49
* It will be compiled to '$COMMON_CLASSES_LOCATION/loadclass' that is added
50
* to original bootstrap classpath using option -Xbootclasspath/a.
51
* This implementation returns PASS.
52
* Source of "negative" implementation is located in the currect directory.
53
* It will be compiled to '$COMMON_CLASSES_LOCATION/classes' that is available
54
* from usual classpath.
55
* This implementation prints error and returns FAIL.
56
* The agent adds '$COMMON_CLASSES_LOCATION/newclass' directory with debuggee
57
* class implementation to the bootstrap class search path in Agent_OnLoad(),
58
* and thus the debuggee class should be found by bootstrap classloader.
59
* While loading debuggee class the bootstrap classloader should find and load
60
* "positive" implementation of superclass available from original bootstrap
61
* classpath, but not "negative" implementation available from usual classpath.
62
* If AddToBootstrapClassLoaderSearch() returns error in Agent_OnLoad(),
63
* then agent returns JNI_ERR and VM fails on initialization.
64
* If AddToBootstrapClassLoaderSearch() does not adds segment to bootstrap
65
* classloader search path, then debuggee class is not found and VM
66
* fails on initialization.
67
* If bootstrap classloader cannot find superclass located by the original
68
* bootstrap classpath, then VM also fails on initialization.
69
* If bootstrap classloader loads "negative" implementation of superclass
70
* available from usual classpath, then the debuggee class returns FAIL,
71
* and the test fails with exit code 97.
72
* Otherwise, if segment is successfully added and debuggee class with positive
73
* implementation of superclass are found, loaded, and executed, then it
74
* returns PASS. and the test passes with exit code 95.
75
* COMMENTS
76
* Made code cleanup: nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent
77
* agent is used now.
78
*
79
* @library /vmTestbase
80
* /test/lib
81
* @build nsk.jvmti.AddToBootstrapClassLoaderSearch.bootclssearch002p
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
* @comment ExecDriver is used b/c main class isn't on source/class path
92
* @run main/othervm/native ExecDriver --java
93
* -Xbootclasspath/a:./bin/loadclass
94
* -agentlib:bootclssearch_agent=-waittime=5,phasetocheck=onload,segment1=./bin/newclass
95
* nsk.jvmti.AddToBootstrapClassLoaderSearch.bootclssearch002
96
*/
97
98
99