Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/lang/ClassLoader/deadlock/TestOneWayDelegate.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 TestOneWayDelegate.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 142fi43if [ "${COMPILEJAVA}" = "" ] ; then44COMPILEJAVA="${TESTJAVA}"45fi4647echo TESTSRC=${TESTSRC}48echo TESTCLASSES=${TESTCLASSES}49echo TESTJAVA=${TESTJAVA}50echo COMPILEJAVA=${COMPILEJAVA}51echo ""5253# set platform-specific variables54OS=`uname -s`55case "$OS" in56SunOS )57FS="/"58;;59Linux )60FS="/"61;;62Darwin )63FS="/"64;;65AIX )66FS="/"67;;68Windows* | CYGWIN* )69FS="\\"70;;71esac7273# compile test74${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \75-d ${TESTCLASSES} \76${TESTSRC}${FS}Starter.java ${TESTSRC}${FS}DelegatingLoader.java7778STATUS=$?79if [ ${STATUS} -ne 0 ]80then81exit ${STATUS}82fi8384# set up test85${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \86-d ${TESTCLASSES}${FS} \87${TESTSRC}${FS}Alice.java ${TESTSRC}${FS}SupBob.java \88${TESTSRC}${FS}Bob.java ${TESTSRC}${FS}SupAlice.java8990cd ${TESTCLASSES}91DIRS="SA SB"92for dir in $DIRS93do94if [ -d ${dir} ]; then95rm -rf ${dir}96fi97mkdir ${dir}98mv com${dir} ${dir}99done100101# run test102${TESTJAVA}${FS}bin${FS}java \103${TESTVMOPTS} \104-verbose:class -XX:+TraceClassLoading -cp . \105-Dtest.classes=${TESTCLASSES} \106Starter one-way107# -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \108109# save error status110STATUS=$?111112# clean up113rm -rf ${TESTCLASSES}${FS}SA ${TESTCLASSES}${FS}SB114115# return116exit ${STATUS}117118119