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