Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch009/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/bootclssearch009.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 and bootstrap classloader35* will find debuggee class using that segment.36* Debuggee class does not have direct superclass to be loaded too.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 will be found by bootstrap classloader using added segment42* Source of debuggee class 'bootclssearch001' is located in 'bootclssearch001.jar'43* which is located in special subdirectory 'newclass/nsk/jvmti/AddToBootstrapClassLoaderSearch/'.44* It will be compiled to45* '$COMMON_CLASSES_LOCATION/newclass/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch001.jar'46* jar file, where it usually can not be found by bootstrap classloader.47* The agent adds this jar to the bootstrap class search path48* in VM_INIT callback(), and thus the debuggee class should be found by49* bootstrap classloader and executed normally.50* If AddToBootstrapClassLoaderSearch() does not adds segment to bootstrap51* class search path, then debuggee class is not found and VM fails on52* initialization.53* Otherwise, if debuggee class is found, loaded, executed, it returns PASS54* and the test passes with exit code 95.55* COMMENTS56* Ported from bootclssearch001.57*58* @library /vmTestbase59* /test/lib60* @build nsk.share.Consts61*62* @comment compile ../bootclssearch001/newclassXX to bin/newclassXX63* @run driver nsk.share.ExtraClassesBuilder64* ../bootclssearch001/newclass65*66* @comment create bootclssearch001.jar in current directory67* @run driver ExecDriver --cmd68* ${compile.jdk}/bin/jar69* -cf bootclssearch001.jar70* -C ./bin/newclass/71* nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch001.class72*73* @comment ExecDriver is used b/c main class isn't on source/class path74* @run main/othervm/native ExecDriver --java75* -agentlib:bootclssearch_agent=-waittime=5,phasetocheck=live,segment1=./bootclssearch001.jar76* nsk.jvmti.AddToBootstrapClassLoaderSearch.bootclssearch00177*/78798081