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