Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch004/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/bootclssearch004.28* VM Testbase keywords: [quick, jpda, jvmti, onload_only_logic, noras, no_cds]29* VM Testbase readme:30* DESCRIPTION31* This JVMTI test exercises JVMTI thread function AddToBootstrapClassLoaderSearch().32* This test checks that AddToBootstrapClassLoaderSearch() can add two segments33* to bootstrap class search path in OnLoad phase, and debuggee class will be34* loaded from the first segment even if it is found in the second segment too,35* The following checks are performed by the test:36* - AddToBootstrapClassLoaderSearch() adds two segments and returns37* no errors in OnLoad phase38* - debuggee class located by the first added segment will be loaded39* - debuggee class located by the second added segment will NOT be loaded40* There are two different implementations of debuggee class 'bootclssearch004'.41* Source of "positive" implementation is located in subdirectory 'newclass01'.42* It will be compiled to '$COMMON_CLASSES_LOCATION/newclass01', that will be43* added first to bootstrap class search path.44* This implementation returns PASS.45* Source of "negative" implementation is located in subdirectory 'newclass02'.46* It will be compiled to '$COMMON_CLASSES_LOCATION/newclass02', that will be47* added second to bootstrap class search path.48* This implementation returns FAIL.49* The agent adds both subdirectories to the bootstrap class search path50* in Agent_OnLoad(), and expects that positive implementation of debuggee class51* from the first added segment will be loaded and executed.52* If AddToBootstrapClassLoaderSearch() returns error in Agent_OnLoad(),53* then agent returns JNI_ERR and VM fails on initialization.54* If negative implementation of debuggee class is loaded and executed,55* then it returns FAIL and test fails with exit code 97.56* Otherwise, if both segments are successfully added and positive implementation57* of debuggee class is loaded and executed, then it returns PASS and test58* passes with exit code 95.59* COMMENTS60* Made code cleanup: nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent61* agent is used now.62*63* @library /vmTestbase64* /test/lib65* @build nsk.share.Consts66*67* @comment compile newclassXX to bin/newclassXX68* @run driver nsk.share.ExtraClassesBuilder69* newclass02 newclass0170*71* @comment ExecDriver is used b/c main class isn't on source/class path72* @run main/othervm/native ExecDriver --java73* -agentlib:bootclssearch_agent=-waittime=5,phasetocheck=onload,segment1=./bin/newclass01,segment2=./bin/newclass0274* nsk.jvmti.AddToBootstrapClassLoaderSearch.bootclssearch00475*/76777879