Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddToSystemClassLoaderSearch/systemclssearch004/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/AddToSystemClassLoaderSearch/systemclssearch004.28* VM Testbase keywords: [quick, jpda, jvmti, onload_only_logic, noras, vm6]29* VM Testbase readme:30* DESCRIPTION31* This JVMTI test exercises JVMTI thread function AddToSystemClassLoaderSearch()32* in Live phase.33* This test checks that AddToSystemClassLoaderSearch() can add two segments34* to system 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* - AddToSystemClassLoaderSearch() 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* Source of "positive" implementation is located in jar file 'systemclssearch003.jar'44* which is located in subdirectory 'newclass01/nsk/jvmti/AddToSystemClassLoaderSearch/'.45* It will be compiled to46* '$COMMON_CLASSES_LOCATION/newclass01/nsk/jvmti/AddToSystemClassLoaderSearch/systemclssearch003.jar',47* that will be added first to system class search path.48* This implementation returns PASS.49* Source of "negative" implementation is located in jar file 'systemclssearch003.jar'50* which is located in subdirectory 'newclass02/nsk/jvmti/AddToSystemClassLoaderSearch/'.51* It will be compiled to52* '$COMMON_CLASSES_LOCATION/newclass02/nsk/jvmti/AddToSystemClassLoaderSearch/systemclssearch003.jar',53* that will be added second to system class search path.54* This implementation returns FAIL.55* The agent adds both jars to the system class search path56* in VM_INIT callback, and expects that positive implementation of debuggee class57* from the first added segment will be loaded and executed.58* If AddToSystemClassLoaderSearch() returns error in VM_INIT callback,59* then VM fails on initialization.60* If negative implementation of debuggee class is loaded and executed,61* then it returns FAIL and test fails with exit code 97.62* Otherwise, if both segments are successfully added and positive implementation63* of debuggee class is loaded and executed, then it returns PASS and test64* passes with exit code 95.65* COMMENTS66* Ported from systemclssearch003.67*68* @library /vmTestbase69* /test/lib70* @build nsk.share.jvmti.JVMTITest71* nsk.share.Consts72*73* @comment compile ../systemclssearch003/newclassXX to bin/newclassXX74* @run driver nsk.share.ExtraClassesBuilder75* ../systemclssearch003/newclass0176* ../systemclssearch003/newclass0277*78* @comment create systemclssearch003.jar in current directory79* @run driver ExecDriver --cmd80* ${compile.jdk}/bin/jar81* -cf ./bin/newclass01/systemclssearch003.jar82* -C ./bin/newclass01/83* nsk/jvmti/AddToSystemClassLoaderSearch/systemclssearch003.class84*85* @comment create systemclssearch003.jar in current directory86* @run driver ExecDriver --cmd87* ${compile.jdk}/bin/jar88* -cf ./bin/newclass02/systemclssearch003.jar89* -C ./bin/newclass02/90* nsk/jvmti/AddToSystemClassLoaderSearch/systemclssearch003.class91*92* @comment ExecDriver is used b/c main class isn't on source/class path93* @run main/othervm/native ExecDriver --java94* -agentlib:systemclssearch_agent=-waittime=5,phasetocheck=live,segment1=./bin/newclass01/systemclssearch003.jar,segment2=./bin/newclass02/systemclssearch003.jar95* nsk.jvmti.AddToSystemClassLoaderSearch.systemclssearch00396*/979899100