Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch008/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/bootclssearch008.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 (actually only in VM_INIT callback).33* This test checks that AddToBootstrapClassLoaderSearch() can add two segments34* to bootstrap class search path in Live phase, and debuggee class will be35* loaded from the first segment even if it is found in the second segment too,36* The following checks are performed by the test:37* - AddToBootstrapClassLoaderSearch() adds two segments and returns38* no errors in Live phase39* - also it checks that anything other than an40* existing JAR file is an invalid path41* - debuggee class located by the first added segment will be loaded42* - debuggee class located by the second added segment will NOT be loaded43* There are two different implementations of debuggee class 'bootclssearch004'.44* Source of "positive" implementation is located in jar file 'bootclssearch004.jar'45* which is located in subdirectory 'newclass01/nsk/jvmti/AddToBootstrapClassLoaderSearch/'.46* It will be compiled to47* '$COMMON_CLASSES_LOCATION/newclass01/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch004.jar',48* that will be added first to bootstrap class search path.49* This implementation returns PASS.50* Source of "negative" implementation is located in jar file 'bootclssearch004.jar'51* which is located in subdirectory 'newclass02/nsk/jvmti/AddToBootstrapClassLoaderSearch/'.52* It will be compiled to53* '$COMMON_CLASSES_LOCATION/newclass02/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch004.jar',54* that will be added second to bootstrap class search path.55* This implementation returns FAIL.56* The agent adds both jars to the bootstrap class search path57* in VM_INIT callback, and expects that positive implementation of debuggee class58* from the first added segment will be loaded and executed.59* If AddToBootstrapClassLoaderSearch() returns error in VM_INIT callback,60* then VM fails on initialization.61* If negative implementation of debuggee class is loaded and executed,62* then it returns FAIL and test fails with exit code 97.63* Otherwise, if both segments are successfully added and positive implementation64* of debuggee class is loaded and executed, then it returns PASS and test65* passes with exit code 95.66* COMMENTS67* Ported from bootclssearch004.68*69* @library /vmTestbase70* /test/lib71* @build nsk.share.Consts72*73* @comment compile ../bootclssearch004/newclassXX to bin/newclassXX74* @run driver nsk.share.ExtraClassesBuilder75* ../bootclssearch004/newclass0176* ../bootclssearch004/newclass0277*78* @comment create bootclssearch004.jar in ./bin/newclass01/79* @run driver ExecDriver --cmd80* ${compile.jdk}/bin/jar81* -cf ./bin/newclass01/bootclssearch004.jar82* -C ./bin/newclass01/83* nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch004.class84*85* @comment create bootclssearch004.jar in ./bin/newclass02/86* @run driver ExecDriver --cmd87* ${compile.jdk}/bin/jar88* -cf ./bin/newclass02/bootclssearch004.jar89* -C ./bin/newclass02/90* nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch004.class91*92* @comment ExecDriver is used b/c main class isn't on source/class path93* @run main/othervm/native ExecDriver --java94* -agentlib:bootclssearch_agent=-waittime=5,phasetocheck=live,segment1=./bin/newclass01/bootclssearch004.jar,segment2=./bin/newclass02/bootclssearch004.jar95* nsk.jvmti.AddToBootstrapClassLoaderSearch.bootclssearch00496*/979899100