Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch007/TestDescription.java
40955 views
/*1* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/222324/*25* @test26*27* @summary converted from VM Testbase nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch007.28* VM Testbase keywords: [quick, jpda, jvmti, onload_only_logic, noras, vm6, no_cds]29* VM Testbase readme:30* DESCRIPTION31* This JVMTI test exercises JVMTI thread function AddToBootstrapClassLoaderSearch()32* in Live phase.33* This test checks that AddToBootstrapClassLoaderSearch() adds segment34* to bootstrap class search path in Live phase, but debuggee class35* located by this segment will no be loaded if this class is available36* from the original bootstrap classpath.37* The following checks are performed by the test:38* - AddToBootstrapClassLoaderSearch() returns no errors in Live phase39* - in particular it checks that anything other than an40* existing JAR file is an invalid path41* - debuggee class located by the original bootstrap classpath will be loaded42* - debuggee class located by the added segment will NOT be loaded43* There are two different impelmentations of debuggee class 'bootclssearch003'.44* Source of "positive" implementation is located in subdirectory 'loadclass'.45* It will be compiled to '$COMMON_CLASSES_LOCATION/loadclass' and added to46* original bootstrap classpath using option -Xbootclasspath/a.47* This implementation returns PASS status.48* Source of "negative" implementation is located in 'bootclssearch003.jar'49* which is located in subdirectory 'newclass/nsk/jvmti/AddToBootstrapClassLoaderSearch/'.50* It will be compiled to51* '$COMMON_CLASSES_LOCATION/newclass/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch003.jar'52* and added to bootstrap class search path with AddToBootstrapClassLoaderSearch().53* This implementation returns prints error and returns FAIL status.54* The agent adds jar file55* '$COMMON_CLASSES_LOCATION/newclassnsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch003.jar'56* to the bootstrap classloader search path in VM_INIT callback, and expects57* that positive implementation of debuggee class will be loaded and58* executed.59* If negative version of debuggee class will be loaded and executed,60* then it returns FAIL and test fails with exit code 97.61* Otherwise, if positive version of debuggee class will be loaded and executed,62* then it returns PASS and test passes with exit code 95.63* COMMENTS64* Ported from bootclssearch003.65*66* @library /vmTestbase67* /test/lib68* @build nsk.share.Consts69*70* @comment compile ../bootclssearch003/loadclassXX to bin/loadclassXX71* @run driver nsk.share.ExtraClassesBuilder72* ../bootclssearch003/loadclass73*74* @comment compile ../bootclssearch003/newclassXX to bin/newclassXX75* @run driver nsk.share.ExtraClassesBuilder76* ../bootclssearch003/newclass77*78* @comment create bootclssearch003.jar in current directory79* @run driver ExecDriver --cmd80* ${compile.jdk}/bin/jar81* -cf bootclssearch003.jar82* -C ./bin/newclass/83* nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch003.class84*85* @comment ExecDriver is used b/c main class isn't on source/class path86* @run main/othervm/native ExecDriver --java87* -Xbootclasspath/a:./bin/loadclass88* -agentlib:bootclssearch_agent=-waittime=5,phasetocheck=live,segment1=./bootclssearch003.jar89* nsk.jvmti.AddToBootstrapClassLoaderSearch.bootclssearch00390*/91929394