Path: blob/master/test/functional/cmdLineTests/shareClassTests/SCCMLTests/SharedClassesModularityTests.xml
6004 views
<?xml version="1.0" encoding="UTF-8" standalone="no"?>12<!--3Copyright (c) 2018, 2021 IBM Corp. and others45This program and the accompanying materials are made available under6the terms of the Eclipse Public License 2.0 which accompanies this7distribution and is available at https://www.eclipse.org/legal/epl-2.0/8or the Apache License, Version 2.0 which accompanies this distribution and9is available at https://www.apache.org/licenses/LICENSE-2.0.1011This Source Code may also be made available under the following12Secondary Licenses when the conditions for such availability set13forth in the Eclipse Public License, v. 2.0 are satisfied: GNU14General Public License, version 2 with the GNU Classpath15Exception [1] and GNU General Public License, version 2 with the16OpenJDK Assembly Exception [2].1718[1] https://www.gnu.org/software/classpath/license.html19[2] http://openjdk.java.net/legal/assembly-exception.html2021SPDX-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-exception22-->2324<!DOCTYPE suite SYSTEM "cmdlinetester.dtd">2526<!-- #### RUN SharedClassesModularityTests SUITE #### -->27<suite id="Shared Classes CommandLineOptionTests Suite">2829<!-- Our test modes for this suite -->30<variable name="mode204" value="-Xshareclasses:name=ShareClassesCMLTests"/>3132<!-- Set variables up -->33<variable name="currentMode" value="$mode204$"/>34<variable name="JAVALIB_DIR" value="$JAVA_HOME$$PATHSEP$lib"/>35<variable name="PROGRAM_HANOI" value="org.openj9.test.ivj.Hanoi 2" />36<variable name="HANOI_DIR" value="org$PATHSEP$openj9$PATHSEP$test$PATHSEP$ivj" />37<variable name="DISK_CLASS" value="$HANOI_DIR$$PATHSEP$Disk.class"/>3839<echo value=" "/>40<echo value="#######################################################"/>41<echo value="Running tests in mode $SCMODE$ with command line options: $currentMode$"/>42<echo value="#######################################################"/>43<echo value=" "/>4445<!--46Note:47Most tests check for strings 'corrupt', 'JVM requested Java dump', and 'JVM requested Snap dump' in the output.48These checks are present because a cache may be found to be corrupt, and the test could otherwise pass.4950The string 'corrupt' is checked because it can appear several messages like below.51JVMSHRC443E Cache CRC is incorrect indicating a corrupt cache. Incorrect cache CRC: 0x0.52JVMDUMP013I Processed dump event "corruptcache", detail "".53JVMSHRC442E Shared cache "jim" is corrupt. Corruption code is -1. Corrupt value is 0x0. No new JVMs will be allowed to connect to the cache.54-->5556<test id="Start : Cleanup: persistent" timeout="600" runPath=".">57<command>$JAVA_EXE$ $currentMode$,destroy</command>58<output type="success" caseSensitive="yes" regex="no">Cache does not exist</output>59<output type="success" caseSensitive="yes" regex="no">has been destroyed</output>60<output type="success" caseSensitive="yes" regex="no">is destroyed</output>61<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>62<output type="failure" caseSensitive="yes" regex="no">Exception:</output>63<output type="failure" caseSensitive="no" regex="no">corrupt</output>64<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>65</test>6667<test id="Test 1 set-up : remove one class from patch path" timeout="600" runPath=".">68<exec command="rm -f $DISK_CLASS$" />69<command>ls $HANOI_DIR$</command>70<output type="success" caseSensitive="yes" regex="no">Post.class</output>71<output type="failure" caseSensitive="no" regex="no">Disk.class</output>72</test>7374<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=".">75<!-- module java.base and module utils are patched -->76<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>77<output type="success" caseSensitive="yes" regex="no">Puzzle solved!</output>78<!-- Bootstrap ClassLoader: classes in java.base that are not patched (loaded from Jimage) should be stored to the cache -->79<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>80<!-- Builtin ClassLoader: classes in utils that are not patched (loaded from module path) should be stored to the cache (in this case class Disk) -->81<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>82<!-- Make sure patched classes in module java.base are loaded by bootstrap ClassLoader -->83<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">class load: jdk/internal/jimage.* from: .*[\\/]jrt-fs.jar</output>84<!-- make sure patched class (class Post) in module utils is loaded by Builtin ClassLoader -->85<output type="required" caseSensitive="yes" regex="no">class load: org.openj9.test.ivj.Post from:</output>8687<!-- Bootstrap ClassLoader: patch classes in java.base should not be stored to the cache -->88<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">Stored class jdk/internal/jimage.* in shared cache</output>89<!-- Builtin ClassLoader: patched classes in module utils should not be stored to the cache -->90<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">Stored class .*/ivj/Post in shared cache</output>91<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>92<output type="failure" caseSensitive="no" regex="no">corrupt</output>93<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>94</test>9596<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=".">97<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>98<output type="success" caseSensitive="yes" regex="no">Puzzle solved!</output>99<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">INIT isClassFromPatchedModule: Class .* is from a patched module .*java.base</output>100101<!-- Bootstrap ClassLoader: module java.base is patched, all the java/* classes from java.base should not be found from the shared cache -->102<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">Found class java/.*</output>103<!-- Builtin ClassLoader: module utils is patched, all the classes from utils should not be found from the shared cache -->104<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">Found class .*/ivj/.*</output>105<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>106<output type="failure" caseSensitive="no" regex="no">corrupt</output>107<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>108</test>109110<test id="Test 3: Jimage and module path should be stored into the cache. Patch paths should not be stored" timeout="600" runPath=".">111<exec command="pwd" capture="PATCH_PATH" quiet="false"/>112<command>$JAVA_EXE$ $currentMode$,printStats=classpath+url</command>113<output type="success" caseSensitive="yes" regex="yes" javaUtilPattern="yes">0x[\w]*\sCLASSPATH[\n\r].*[\\/]lib[\\/]modules</output>114<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">0x[\w]*\sURL[\n\r].*[\\/]utils.jar</output>115<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">Classpaths[\s]*= [1-9]</output>116<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">URLs[\s]*= [1-9]</output>117118<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">[\\/]jrt-fs.jar</output>119<output type="failure" caseSensitive="no" regex="no">$PATCH_PATH$</output>120<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">Classpaths[\s]*= 0</output>121<output type="failure" caseSensitive="no" regex="yes" javaUtilPattern="yes">URLs[\s]*= 0</output>122<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>123<output type="failure" caseSensitive="no" regex="no">corrupt</output>124<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>125</test>126127<test id="Test 3 cleanup" timeout="600" runPath=".">128<command>$JAVA_EXE$ $currentMode$,destroy</command>129<output type="success" caseSensitive="yes" regex="no">Cache does not exist</output>130<output type="success" caseSensitive="yes" regex="no">has been destroyed</output>131<output type="success" caseSensitive="yes" regex="no">is destroyed</output>132133<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>134<output type="failure" caseSensitive="yes" regex="no">Exception:</output>135<output type="failure" caseSensitive="no" regex="no">corrupt</output>136<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>137<output type="failure" caseSensitive="yes" regex="no">JVM requested Java dump</output>138<output type="failure" caseSensitive="yes" regex="no">JVM requested Snap dump</output>139</test>140141<test id="Test 4 set-up: create a shared cache" timeout="600" runPath=".">142<command>$JAVA_EXE$ $currentMode$ -version</command>143<output type="success" caseSensitive="no" regex="yes" javaUtilPattern="yes">(java|openjdk|semeru) version</output>144145<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>146<output type="failure" caseSensitive="yes" regex="no">Exception:</output>147<output type="failure" caseSensitive="no" regex="no">corrupt</output>148<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>149</test>150151<test id="Test 4: Class from unresolved module should not be found" timeout="600" runPath=".">152<command>$JAVA_EXE$ $currentMode$ -Xtrace:print={j9shr.2262} -verbose --module-path $UTILSJAR$ -m utils/$PROGRAM_HANOI$</command>153<output type="success" caseSensitive="yes" regex="no">Puzzle solved!</output>154<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">INIT hookFindSharedClass: Class .* is from an unresolved module. Returning NULL.</output>155156<!-- OpenJ9 issue 1081: assertion failure at j9vmutil(j9vrb).15 if class from unresolved module is found -->157<output type="failure" caseSensitive="no" regex="no">ASSERTION FAILED</output>158<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>159<output type="failure" caseSensitive="yes" regex="no">Exception:</output>160<output type="failure" caseSensitive="no" regex="no">corrupt</output>161<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>162</test>163164<test id="Test 4: Test classes are being found in the shared cache when running an application module" timeout="600" runPath=".">165<command>$JAVA_EXE$ $currentMode$,verboseIO --module-path $UTILSJAR$ -m utils/$PROGRAM_HANOI$</command>166<output type="success" caseSensitive="yes" regex="no">Puzzle solved!</output>167<output type="required" caseSensitive="yes" regex="yes" javaUtilPattern="yes">Found class java/.* in shared cache for class-loader id 0</output>168<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>169170<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>171<output type="failure" caseSensitive="yes" regex="no">Exception:</output>172<output type="failure" caseSensitive="no" regex="no">corrupt</output>173<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>174</test>175176<test id="At end destroy cache for cleanup" timeout="600" runPath=".">177<command>$JAVA_EXE$ $currentMode$,destroy</command>178<output type="success" caseSensitive="yes" regex="no">Cache does not exist</output>179<output type="success" caseSensitive="yes" regex="no">has been destroyed</output>180<output type="success" caseSensitive="yes" regex="no">is destroyed</output>181182<output type="failure" caseSensitive="no" regex="no">Unhandled Exception</output>183<output type="failure" caseSensitive="yes" regex="no">Exception:</output>184<output type="failure" caseSensitive="no" regex="no">corrupt</output>185<output type="failure" caseSensitive="yes" regex="no">Processing dump event</output>186<output type="failure" caseSensitive="yes" regex="no">JVM requested Java dump</output>187<output type="failure" caseSensitive="yes" regex="no">JVM requested Snap dump</output>188</test>189190<!--191***** IMPORTANT NOTE *****192The last test in this file is normally a call to -Xshareclasses:destroy. When the test passes no files should ever be left behind.193-->194</suite>195196197