annotate test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh @ 1042:45ff1a9d4edb

4735126: (cl) ClassLoader.loadClass locks all instances in chain when delegating Summary: Added support for parallel-capable class loaders Reviewed-by: alanb
author valeriep
date Mon, 06 Apr 2009 18:46:20 -0700
parents
children 00cd9dc3c2b5
rev   line source
valeriep@1042 1 #
valeriep@1042 2 # Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
valeriep@1042 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
valeriep@1042 4 #
valeriep@1042 5 # This code is free software; you can redistribute it and/or modify it
valeriep@1042 6 # under the terms of the GNU General Public License version 2 only, as
valeriep@1042 7 # published by the Free Software Foundation.
valeriep@1042 8 #
valeriep@1042 9 # This code is distributed in the hope that it will be useful, but WITHOUT
valeriep@1042 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
valeriep@1042 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
valeriep@1042 12 # version 2 for more details (a copy is included in the LICENSE file that
valeriep@1042 13 # accompanied this code).
valeriep@1042 14 #
valeriep@1042 15 # You should have received a copy of the GNU General Public License version
valeriep@1042 16 # 2 along with this work; if not, write to the Free Software Foundation,
valeriep@1042 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
valeriep@1042 18 #
valeriep@1042 19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
valeriep@1042 20 # CA 95054 USA or visit www.sun.com if you need additional information or
valeriep@1042 21 # have any questions.
valeriep@1042 22 #
valeriep@1042 23 # @test
valeriep@1042 24 # @bug 4735126
valeriep@1042 25 # @summary (cl) ClassLoader.loadClass locks all instances in chain
valeriep@1042 26 # when delegating
valeriep@1042 27 #
valeriep@1042 28 # @run shell/timeout=10 TestCrossDelegate.sh
valeriep@1042 29
valeriep@1042 30 # if running by hand on windows, change TESTSRC and TESTCLASSES to "."
valeriep@1042 31 if [ "${TESTSRC}" = "" ] ; then
valeriep@1042 32 TESTSRC=`pwd`
valeriep@1042 33 fi
valeriep@1042 34 if [ "${TESTCLASSES}" = "" ] ; then
valeriep@1042 35 TESTCLASSES=`pwd`
valeriep@1042 36 fi
valeriep@1042 37
valeriep@1042 38 # if running by hand on windows, change this to appropriate value
valeriep@1042 39 if [ "${TESTJAVA}" = "" ] ; then
valeriep@1042 40 echo "TESTJAVA not set. Test cannot execute."
valeriep@1042 41 echo "FAILED!!!"
valeriep@1042 42 exit 1
valeriep@1042 43 fi
valeriep@1042 44 echo TESTSRC=${TESTSRC}
valeriep@1042 45 echo TESTCLASSES=${TESTCLASSES}
valeriep@1042 46 echo TESTJAVA=${TESTJAVA}
valeriep@1042 47 echo ""
valeriep@1042 48
valeriep@1042 49 # set platform-specific variables
valeriep@1042 50 OS=`uname -s`
valeriep@1042 51 case "$OS" in
valeriep@1042 52 SunOS )
valeriep@1042 53 FS="/"
valeriep@1042 54 ;;
valeriep@1042 55 Linux )
valeriep@1042 56 FS="/"
valeriep@1042 57 ;;
valeriep@1042 58 Windows* )
valeriep@1042 59 FS="\\"
valeriep@1042 60 ;;
valeriep@1042 61 esac
valeriep@1042 62
valeriep@1042 63 # compile test
valeriep@1042 64 ${TESTJAVA}${FS}bin${FS}javac \
valeriep@1042 65 -d ${TESTCLASSES} \
valeriep@1042 66 ${TESTSRC}${FS}Starter.java ${TESTSRC}${FS}DelegatingLoader.java
valeriep@1042 67
valeriep@1042 68 STATUS=$?
valeriep@1042 69 if [ ${STATUS} -ne 0 ]
valeriep@1042 70 then
valeriep@1042 71 exit ${STATUS}
valeriep@1042 72 fi
valeriep@1042 73
valeriep@1042 74 # set up test
valeriep@1042 75 ${TESTJAVA}${FS}bin${FS}javac \
valeriep@1042 76 -d ${TESTCLASSES}${FS} \
valeriep@1042 77 ${TESTSRC}${FS}Alice.java ${TESTSRC}${FS}SupBob.java \
valeriep@1042 78 ${TESTSRC}${FS}Bob.java ${TESTSRC}${FS}SupAlice.java
valeriep@1042 79
valeriep@1042 80 cd ${TESTCLASSES}
valeriep@1042 81 DIRS="SA SB"
valeriep@1042 82 for dir in $DIRS
valeriep@1042 83 do
valeriep@1042 84 if [ -d ${dir} ]; then
valeriep@1042 85 rm -rf ${dir}
valeriep@1042 86 fi
valeriep@1042 87 mkdir ${dir}
valeriep@1042 88 mv com${dir} ${dir}
valeriep@1042 89 done
valeriep@1042 90
valeriep@1042 91 # run test
valeriep@1042 92 ${TESTJAVA}${FS}bin${FS}java \
valeriep@1042 93 -verbose:class -XX:+TraceClassLoading -cp . \
valeriep@1042 94 -Dtest.classes=${TESTCLASSES} \
valeriep@1042 95 Starter cross
valeriep@1042 96 # -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \
valeriep@1042 97
valeriep@1042 98 # save error status
valeriep@1042 99 STATUS=$?
valeriep@1042 100
valeriep@1042 101 # clean up
valeriep@1042 102 rm -rf ${TESTCLASSES}${FS}SA ${TESTCLASSES}${FS}SB
valeriep@1042 103
valeriep@1042 104 # return
valeriep@1042 105 exit ${STATUS}