Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch003/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/bootclssearch003.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() adds segment33* to bootstrap class search path in OnLoad phase, but debuggee class34* located by this segment will no be loaded if this class is available35* from the original bootstrap classpath.36* The following checks are performed by the test:37* - AddToBootstrapClassLoaderSearch() returns no errors in OnLoad phase38* - debuggee class located by the original bootstrap classpath will be loaded39* - debuggee class located by the added segment will NOT be loaded40* There are two different impelmentations of debuggee class 'bootclssearch003'.41* Source of "positive" implementation is located in subdirectory 'loadclass'.42* It will be compiled to '$COMMON_CLASSES_LOCATION/loadclass' and added to43* original bootstrap classpath using option +Xbootclasspath/a.44* This implementation returns PASS status.45* Source of "negative" implementation is located in subdirectory 'newclass'.46* It will be compiled to '$COMMON_CLASSES_LOCATION/newclass' and added47* to bootstrap class search path with AddToBootstrapClassLoaderSearch().48* This implementation returns prints error and returns FAIL status.49* The agent adds subdirectory '$COMMON_CLASSES_LOCATION/newclass' to50* the bootstrap classloader search path in Agent_OnLoad(), and expects51* that positive implementation of debuggee class will be loaded and52* executed.53* If AddToBootstrapClassLoaderSearch() returns error in Agent_OnLoad(),54* then agent returns JNI_ERR and VM fails on initialization.55* If negative version of debuggee class will be loaded and executed,56* then it returns FAIL and test fails with exit code 97.57* Otherwise, if positive version of debuggee class will be loaded and executed,58* then it returns PASS and test 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 loadclassXX to bin/loadclassXX68* @run driver nsk.share.ExtraClassesBuilder69* loadclass70*71* @comment compile newclassXX to bin/newclassXX72* @run driver nsk.share.ExtraClassesBuilder73* newclass74*75* @comment ExecDriver is used b/c main class isn't on source/class path76* @run main/othervm/native ExecDriver --java77* -Xbootclasspath/a:./bin/loadclass78* -agentlib:bootclssearch_agent=-waittime=5,phasetocheck=onload,segment1=./bin/newclass79* nsk.jvmti.AddToBootstrapClassLoaderSearch.bootclssearch00380*/81828384