1042N/A#
3261N/A# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
1042N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1042N/A#
1042N/A# This code is free software; you can redistribute it and/or modify it
1042N/A# under the terms of the GNU General Public License version 2 only, as
1042N/A# published by the Free Software Foundation.
1042N/A#
1042N/A# This code is distributed in the hope that it will be useful, but WITHOUT
1042N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1042N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1042N/A# version 2 for more details (a copy is included in the LICENSE file that
1042N/A# accompanied this code).
1042N/A#
1042N/A# You should have received a copy of the GNU General Public License version
1042N/A# 2 along with this work; if not, write to the Free Software Foundation,
1042N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1042N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
1042N/A#
1042N/A# @test
1042N/A# @bug 4735126
4638N/A# @summary (cl) ClassLoader.loadClass locks all instances in chain
1042N/A# when delegating
4638N/A#
1042N/A# @run shell/timeout=10 TestOneWayDelegate.sh
1042N/A
1042N/A# if running by hand on windows, change TESTSRC and TESTCLASSES to "."
1042N/Aif [ "${TESTSRC}" = "" ] ; then
1042N/A TESTSRC=`pwd`
1042N/Afi
1042N/Aif [ "${TESTCLASSES}" = "" ] ; then
1042N/A TESTCLASSES=`pwd`
1042N/Afi
1042N/A
1042N/A# if running by hand on windows, change this to appropriate value
1042N/Aif [ "${TESTJAVA}" = "" ] ; then
1042N/A echo "TESTJAVA not set. Test cannot execute."
1042N/A echo "FAILED!!!"
1042N/A exit 1
1042N/Afi
1042N/Aecho TESTSRC=${TESTSRC}
1042N/Aecho TESTCLASSES=${TESTCLASSES}
1042N/Aecho TESTJAVA=${TESTJAVA}
1042N/Aecho ""
1042N/A
1042N/A# set platform-specific variables
1042N/AOS=`uname -s`
1042N/Acase "$OS" in
1042N/A SunOS )
1042N/A FS="/"
1042N/A ;;
1042N/A Linux )
1042N/A FS="/"
1042N/A ;;
4638N/A Darwin )
4638N/A FS="/"
4638N/A ;;
2076N/A Windows* | CYGWIN* )
1042N/A FS="\\"
1042N/A ;;
1042N/Aesac
1042N/A
1042N/A# compile test
1042N/A${TESTJAVA}${FS}bin${FS}javac \
1042N/A -d ${TESTCLASSES} \
1042N/A ${TESTSRC}${FS}Starter.java ${TESTSRC}${FS}DelegatingLoader.java
1042N/A
1042N/ASTATUS=$?
1042N/Aif [ ${STATUS} -ne 0 ]
1042N/Athen
1042N/A exit ${STATUS}
1042N/Afi
1042N/A
1042N/A# set up test
1042N/A${TESTJAVA}${FS}bin${FS}javac \
1042N/A -d ${TESTCLASSES}${FS} \
1042N/A ${TESTSRC}${FS}Alice.java ${TESTSRC}${FS}SupBob.java \
1042N/A ${TESTSRC}${FS}Bob.java ${TESTSRC}${FS}SupAlice.java
1042N/A
1042N/Acd ${TESTCLASSES}
1042N/ADIRS="SA SB"
1042N/Afor dir in $DIRS
1042N/Ado
1042N/A if [ -d ${dir} ]; then
1042N/A rm -rf ${dir}
1042N/A fi
1042N/A mkdir ${dir}
1042N/A mv com${dir} ${dir}
1042N/Adone
1042N/A
1042N/A# run test
1042N/A${TESTJAVA}${FS}bin${FS}java \
1042N/A -verbose:class -XX:+TraceClassLoading -cp . \
1042N/A -Dtest.classes=${TESTCLASSES} \
1042N/A Starter one-way
1042N/A# -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \
1042N/A
1042N/A# save error status
1042N/ASTATUS=$?
1042N/A
1042N/A# clean up
1042N/Arm -rf ${TESTCLASSES}${FS}SA ${TESTCLASSES}${FS}SB
1042N/A
1042N/A# return
1042N/Aexit ${STATUS}