Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh
38828 views
#1# Copyright (c) 2009, 2013, 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#22# @test23# @bug 473512624# @summary (cl) ClassLoader.loadClass locks all instances in chain25# when delegating26#27# @run shell/timeout=300 TestCrossDelegate.sh2829# if running by hand on windows, change TESTSRC and TESTCLASSES to "."30if [ "${TESTSRC}" = "" ] ; then31TESTSRC=`pwd`32fi33if [ "${TESTCLASSES}" = "" ] ; then34TESTCLASSES=`pwd`35fi3637# if running by hand on windows, change this to appropriate value38if [ "${TESTJAVA}" = "" ] ; then39echo "TESTJAVA not set. Test cannot execute."40echo "FAILED!!!"41exit 142fi4344if [ "${COMPILEJAVA}" = "" ] ; then45COMPILEJAVA="${TESTJAVA}"46fi4748# set platform-specific variables49OS=`uname -s`50case "$OS" in51SunOS )52FS="/"53;;54Linux )55FS="/"56;;57Darwin )58FS="/"59;;60AIX )61FS="/"62;;63Windows*)64FS="\\"65;;66CYGWIN* )67FS="\\"68TESTCLASSES=`/usr/bin/cygpath -a -s -m ${TESTCLASSES}`69;;70esac7172echo TESTSRC=${TESTSRC}73echo TESTCLASSES=${TESTCLASSES}74echo TESTJAVA=${TESTJAVA}75echo ""7677# compile test78${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \79-d ${TESTCLASSES} \80${TESTSRC}${FS}Starter.java ${TESTSRC}${FS}DelegatingLoader.java8182STATUS=$?83if [ ${STATUS} -ne 0 ]84then85exit ${STATUS}86fi8788# set up test89${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \90-d ${TESTCLASSES}${FS} \91${TESTSRC}${FS}Alice.java ${TESTSRC}${FS}SupBob.java \92${TESTSRC}${FS}Bob.java ${TESTSRC}${FS}SupAlice.java9394cd ${TESTCLASSES}95DIRS="SA SB"96for dir in $DIRS97do98if [ -d ${dir} ]; then99rm -rf ${dir}100fi101mkdir ${dir}102mv com${dir} ${dir}103done104105# run test106${TESTJAVA}${FS}bin${FS}java \107${TESTVMOPTS} \108-verbose:class -XX:+TraceClassLoading -cp . \109-Dtest.classes=${TESTCLASSES} \110Starter cross111# -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \112113# save error status114STATUS=$?115116# clean up117rm -rf ${TESTCLASSES}${FS}SA ${TESTCLASSES}${FS}SB118119# return120exit ${STATUS}121122123