Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddToSystemClassLoaderSearch/systemclssearch003/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/systemclssearch003.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 OnLoad phase.33* This test checks that AddToSystemClassLoaderSearch() can add two segments34* to system class search path in OnLoad 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 OnLoad phase39* - debuggee class located by the first added segment will be loaded40* - debuggee class located by the second added segment will NOT be loaded41* There are two different implementations of debuggee class 'systemclssearch003'.42* Source of "positive" implementation is located in subdirectory 'newclass01'.43* It will be compiled to '$COMMON_CLASSES_LOCATION/newclass01', that will be44* added first to system class search path.45* This implementation returns PASS.46* Source of "negative" implementation is located in subdirectory 'newclass02'.47* It will be compiled to '$COMMON_CLASSES_LOCATION/newclass02', that will be48* added second to system class search path.49* This implementation returns FAIL.50* The agent adds both subdirectories to the system class search path51* in Agent_OnLoad(), and expects that positive implementation of debuggee class52* from the first added segment will be loaded and executed.53* If AddToSystemClassLoaderSearch() returns error in Agent_OnLoad(),54* then agent returns JNI_ERR and VM fails on initialization.55* If negative implementation of debuggee class is loaded and executed,56* then it returns FAIL and test fails with exit code 97.57* Otherwise, if both segments are successfully added and positive implementation58* of debuggee class is loaded and executed, then it returns PASS and test59* passes with exit code 95.60* COMMENTS61*62* @library /vmTestbase63* /test/lib64* @build nsk.share.jvmti.JVMTITest65* 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:systemclssearch_agent=-waittime=5,phasetocheck=onload,segment1=./bin/newclass01,segment2=./bin/newclass0274* nsk.jvmti.AddToSystemClassLoaderSearch.systemclssearch00375*/76777879