Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/test/functional/cmdLineTests/shareClassTests/SCCMLTests/SharedClassesModularityTests.xml
6004 views
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
3
<!--
4
Copyright (c) 2018, 2021 IBM Corp. and others
5
6
This program and the accompanying materials are made available under
7
the terms of the Eclipse Public License 2.0 which accompanies this
8
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
9
or the Apache License, Version 2.0 which accompanies this distribution and
10
is available at https://www.apache.org/licenses/LICENSE-2.0.
11
12
This Source Code may also be made available under the following
13
Secondary Licenses when the conditions for such availability set
14
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
15
General Public License, version 2 with the GNU Classpath
16
Exception [1] and GNU General Public License, version 2 with the
17
OpenJDK Assembly Exception [2].
18
19
[1] https://www.gnu.org/software/classpath/license.html
20
[2] http://openjdk.java.net/legal/assembly-exception.html
21
22
SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
23
-->
24
25
<!DOCTYPE suite SYSTEM "cmdlinetester.dtd">
26
27
<!-- #### RUN SharedClassesModularityTests SUITE #### -->
28
<suite id="Shared Classes CommandLineOptionTests Suite">
29
30
<!-- Our test modes for this suite -->
31
<variable name="mode204" value="-Xshareclasses:name=ShareClassesCMLTests"/>
32
33
<!-- Set variables up -->
34
<variable name="currentMode" value="$mode204$"/>
35
<variable name="JAVALIB_DIR" value="$JAVA_HOME$$PATHSEP$lib"/>
36
<variable name="PROGRAM_HANOI" value="org.openj9.test.ivj.Hanoi 2" />
37
<variable name="HANOI_DIR" value="org$PATHSEP$openj9$PATHSEP$test$PATHSEP$ivj" />
38
<variable name="DISK_CLASS" value="$HANOI_DIR$$PATHSEP$Disk.class"/>
39
40
<echo value=" "/>
41
<echo value="#######################################################"/>
42
<echo value="Running tests in mode $SCMODE$ with command line options: $currentMode$"/>
43
<echo value="#######################################################"/>
44
<echo value=" "/>
45
46
<!--
47
Note:
48
Most tests check for strings 'corrupt', 'JVM requested Java dump', and 'JVM requested Snap dump' in the output.
49
These checks are present because a cache may be found to be corrupt, and the test could otherwise pass.
50
51
The string 'corrupt' is checked because it can appear several messages like below.
52
JVMSHRC443E Cache CRC is incorrect indicating a corrupt cache. Incorrect cache CRC: 0x0.
53
JVMDUMP013I Processed dump event "corruptcache", detail "".
54
JVMSHRC442E Shared cache "jim" is corrupt. Corruption code is -1. Corrupt value is 0x0. No new JVMs will be allowed to connect to the cache.
55
-->
56
57
<test id="Start : Cleanup: persistent" timeout="600" runPath=".">
58
<command>$JAVA_EXE$ $currentMode$,destroy</command>
59
<output type="success" caseSensitive="yes" regex="no">Cache does not exist</output>
60
<output type="success" caseSensitive="yes" regex="no">has been destroyed</output>
61
<output type="success" caseSensitive="yes" regex="no">is destroyed</output>
62
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
63
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
64
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
65
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
66
</test>
67
68
<test id="Test 1 set-up : remove one class from patch path" timeout="600" runPath=".">
69
<exec command="rm -f $DISK_CLASS$" />
70
<command>ls $HANOI_DIR$</command>
71
<output type="success" caseSensitive="yes" regex="no">Post.class</output>
72
<output type="failure" caseSensitive="no" regex="no">Disk.class</output>
73
</test>
74
75
<test id="Test 1: Test --patch-module for Bootstrap ClassLoader and Builtin ClassLoader. Patched classes should not be stored to the cache. Other classes from the patched module should still be stored" timeout="600" runPath=".">
76
<!-- module java.base and module utils are patched -->
77
<command>$JAVA_EXE$ $currentMode$,verboseIO -verbose --patch-module java.base=$JAVALIB_DIR$$PATHSEP$jrt-fs.jar --patch-module utils=. --module-path $UTILSJAR$ -m utils/$PROGRAM_HANOI$</command>
78
<output type="success" caseSensitive="yes" regex="no">Puzzle solved!</output>
79
<!-- Bootstrap ClassLoader: classes in java.base that are not patched (loaded from Jimage) should be stored to the cache -->
80
<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">Stored class java/.* in shared cache for class-loader id 0 with URL .*[\\/]lib[\\/]modules</output>
81
<!-- Builtin ClassLoader: classes in utils that are not patched (loaded from module path) should be stored to the cache (in this case class Disk) -->
82
<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">Stored class org/openj9/test/ivj/Disk in shared cache for class-loader id [2-9] with URL .*[\\/]utils.jar</output>
83
<!-- Make sure patched classes in module java.base are loaded by bootstrap ClassLoader -->
84
<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">class load: jdk/internal/jimage.* from: .*[\\/]jrt-fs.jar</output>
85
<!-- make sure patched class (class Post) in module utils is loaded by Builtin ClassLoader -->
86
<output type="required" caseSensitive="yes" regex="no">class load: org.openj9.test.ivj.Post from:</output>
87
88
<!-- Bootstrap ClassLoader: patch classes in java.base should not be stored to the cache -->
89
<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">Stored class jdk/internal/jimage.* in shared cache</output>
90
<!-- Builtin ClassLoader: patched classes in module utils should not be stored to the cache -->
91
<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">Stored class .*/ivj/Post in shared cache</output>
92
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
93
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
94
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
95
</test>
96
97
<test id="Test 2: Test --patch-module for bootstrap ClassLoader and Builtin ClassLoader. Nothing from patched module should be found from the cache" timeout="600" runPath=".">
98
<command>$JAVA_EXE$ $currentMode$,verboseIO -Xtrace:print=j9shr.2261 --patch-module java.base=$JAVALIB_DIR$$PATHSEP$jrt-fs.jar --patch-module utils=. --module-path $UTILSJAR$ -m utils/$PROGRAM_HANOI$</command>
99
<output type="success" caseSensitive="yes" regex="no">Puzzle solved!</output>
100
<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">INIT isClassFromPatchedModule: Class .* is from a patched module .*java.base</output>
101
102
<!-- Bootstrap ClassLoader: module java.base is patched, all the java/* classes from java.base should not be found from the shared cache -->
103
<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">Found class java/.*</output>
104
<!-- Builtin ClassLoader: module utils is patched, all the classes from utils should not be found from the shared cache -->
105
<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">Found class .*/ivj/.*</output>
106
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
107
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
108
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
109
</test>
110
111
<test id="Test 3: Jimage and module path should be stored into the cache. Patch paths should not be stored" timeout="600" runPath=".">
112
<exec command="pwd" capture="PATCH_PATH" quiet="false"/>
113
<command>$JAVA_EXE$ $currentMode$,printStats=classpath+url</command>
114
<output type="success" caseSensitive="yes" regex="yes" javaUtilPattern="yes">0x[\w]*\sCLASSPATH[\n\r].*[\\/]lib[\\/]modules</output>
115
<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">0x[\w]*\sURL[\n\r].*[\\/]utils.jar</output>
116
<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">Classpaths[\s]*= [1-9]</output>
117
<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">URLs[\s]*= [1-9]</output>
118
119
<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">[\\/]jrt-fs.jar</output>
120
<output type="failure" caseSensitive="no" regex="no">$PATCH_PATH$</output>
121
<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">Classpaths[\s]*= 0</output>
122
<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">URLs[\s]*= 0</output>
123
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
124
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
125
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
126
</test>
127
128
<test id="Test 3 cleanup" timeout="600" runPath=".">
129
<command>$JAVA_EXE$ $currentMode$,destroy</command>
130
<output type="success" caseSensitive="yes" regex="no">Cache does not exist</output>
131
<output type="success" caseSensitive="yes" regex="no">has been destroyed</output>
132
<output type="success" caseSensitive="yes" regex="no">is destroyed</output>
133
134
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
135
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
136
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
137
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
138
<output type="failure" caseSensitive="yes" regex="no">JVM requested Java dump</output>
139
<output type="failure" caseSensitive="yes" regex="no">JVM requested Snap dump</output>
140
</test>
141
142
<test id="Test 4 set-up: create a shared cache" timeout="600" runPath=".">
143
<command>$JAVA_EXE$ $currentMode$ -version</command>
144
<output type="success" caseSensitive="no" regex="yes" javaUtilPattern="yes">(java|openjdk|semeru) version</output>
145
146
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
147
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
148
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
149
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
150
</test>
151
152
<test id="Test 4: Class from unresolved module should not be found" timeout="600" runPath=".">
153
<command>$JAVA_EXE$ $currentMode$ -Xtrace:print={j9shr.2262} -verbose --module-path $UTILSJAR$ -m utils/$PROGRAM_HANOI$</command>
154
<output type="success" caseSensitive="yes" regex="no">Puzzle solved!</output>
155
<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">INIT hookFindSharedClass: Class .* is from an unresolved module. Returning NULL.</output>
156
157
<!-- OpenJ9 issue 1081: assertion failure at j9vmutil(j9vrb).15 if class from unresolved module is found -->
158
<output type="failure" caseSensitive="no" regex="no">ASSERTION FAILED</output>
159
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
160
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
161
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
162
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
163
</test>
164
165
<test id="Test 4: Test classes are being found in the shared cache when running an application module" timeout="600" runPath=".">
166
<command>$JAVA_EXE$ $currentMode$,verboseIO --module-path $UTILSJAR$ -m utils/$PROGRAM_HANOI$</command>
167
<output type="success" caseSensitive="yes" regex="no">Puzzle solved!</output>
168
<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">Found class java/.* in shared cache for class-loader id 0</output>
169
<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">Found class org/openj9/test/ivj/.* in shared cache for class-loader id [2-9] with URL .*[\\/]utils.jar</output>
170
171
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
172
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
173
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
174
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
175
</test>
176
177
<test id="At end destroy cache for cleanup" timeout="600" runPath=".">
178
<command>$JAVA_EXE$ $currentMode$,destroy</command>
179
<output type="success" caseSensitive="yes" regex="no">Cache does not exist</output>
180
<output type="success" caseSensitive="yes" regex="no">has been destroyed</output>
181
<output type="success" caseSensitive="yes" regex="no">is destroyed</output>
182
183
<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>
184
<output type="failure" caseSensitive="yes" regex="no">Exception:</output>
185
<output type="failure" caseSensitive="no" regex="no">corrupt</output>
186
<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>
187
<output type="failure" caseSensitive="yes" regex="no">JVM requested Java dump</output>
188
<output type="failure" caseSensitive="yes" regex="no">JVM requested Snap dump</output>
189
</test>
190
191
<!--
192
***** IMPORTANT NOTE *****
193
The last test in this file is normally a call to -Xshareclasses:destroy. When the test passes no files should ever be left behind.
194
-->
195
</suite>
196
197