annotate test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh @ 13721:2b292ab0ed9a

8073347: javadoc of Formattable messed up by JDK-8019857 Summary: Change sample code formatting to the currently blessed idiom. Reviewed-by: martin
author bpb
date Tue, 17 Feb 2015 12:02:38 -0800
parents 07beb32265e9 1a3de3cdc684
children
rev   line source
valeriep@1042 1 #
lana@9000 2 # Copyright (c) 2009, 2013, Oracle and/or its affiliates. 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 #
ohair@2362 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@2362 20 # or visit www.oracle.com if you need additional information or have any
ohair@2362 21 # questions.
valeriep@1042 22 #
valeriep@1042 23 # @test
valeriep@1042 24 # @bug 4735126
michaelm@5116 25 # @summary (cl) ClassLoader.loadClass locks all instances in chain
valeriep@1042 26 # when delegating
michaelm@5116 27 #
mchung@2729 28 # @run shell/timeout=300 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
alanb@6383 45 if [ "${COMPILEJAVA}" = "" ] ; then
alanb@6383 46 COMPILEJAVA="${TESTJAVA}"
alanb@6383 47 fi
alanb@6383 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 ;;
michaelm@5116 58 Darwin )
michaelm@5116 59 FS="/"
michaelm@5116 60 ;;
simonis@9300 61 AIX )
simonis@9300 62 FS="/"
simonis@9300 63 ;;
mchung@2729 64 Windows*)
valeriep@1042 65 FS="\\"
valeriep@1042 66 ;;
mchung@2729 67 CYGWIN* )
mchung@2729 68 FS="\\"
mchung@2729 69 TESTCLASSES=`/usr/bin/cygpath -a -s -m ${TESTCLASSES}`
mchung@2729 70 ;;
valeriep@1042 71 esac
valeriep@1042 72
mchung@2729 73 echo TESTSRC=${TESTSRC}
mchung@2729 74 echo TESTCLASSES=${TESTCLASSES}
mchung@2729 75 echo TESTJAVA=${TESTJAVA}
mchung@2729 76 echo ""
mchung@2729 77
valeriep@1042 78 # compile test
alanb@6383 79 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
valeriep@1042 80 -d ${TESTCLASSES} \
valeriep@1042 81 ${TESTSRC}${FS}Starter.java ${TESTSRC}${FS}DelegatingLoader.java
valeriep@1042 82
valeriep@1042 83 STATUS=$?
valeriep@1042 84 if [ ${STATUS} -ne 0 ]
valeriep@1042 85 then
valeriep@1042 86 exit ${STATUS}
valeriep@1042 87 fi
valeriep@1042 88
valeriep@1042 89 # set up test
alanb@6383 90 ${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
valeriep@1042 91 -d ${TESTCLASSES}${FS} \
valeriep@1042 92 ${TESTSRC}${FS}Alice.java ${TESTSRC}${FS}SupBob.java \
valeriep@1042 93 ${TESTSRC}${FS}Bob.java ${TESTSRC}${FS}SupAlice.java
valeriep@1042 94
valeriep@1042 95 cd ${TESTCLASSES}
valeriep@1042 96 DIRS="SA SB"
valeriep@1042 97 for dir in $DIRS
valeriep@1042 98 do
valeriep@1042 99 if [ -d ${dir} ]; then
valeriep@1042 100 rm -rf ${dir}
valeriep@1042 101 fi
valeriep@1042 102 mkdir ${dir}
valeriep@1042 103 mv com${dir} ${dir}
valeriep@1042 104 done
valeriep@1042 105
valeriep@1042 106 # run test
valeriep@1042 107 ${TESTJAVA}${FS}bin${FS}java \
chegar@6252 108 ${TESTVMOPTS} \
valeriep@1042 109 -verbose:class -XX:+TraceClassLoading -cp . \
valeriep@1042 110 -Dtest.classes=${TESTCLASSES} \
valeriep@1042 111 Starter cross
valeriep@1042 112 # -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \
valeriep@1042 113
valeriep@1042 114 # save error status
valeriep@1042 115 STATUS=$?
valeriep@1042 116
valeriep@1042 117 # clean up
valeriep@1042 118 rm -rf ${TESTCLASSES}${FS}SA ${TESTCLASSES}${FS}SB
valeriep@1042 119
valeriep@1042 120 # return
valeriep@1042 121 exit ${STATUS}