Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/lang/ClassLoader/deadlock/TestCrossDelegate.sh
38828 views
1
#
2
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
# or visit www.oracle.com if you need additional information or have any
21
# 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=300 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
45
if [ "${COMPILEJAVA}" = "" ] ; then
46
COMPILEJAVA="${TESTJAVA}"
47
fi
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
Darwin )
59
FS="/"
60
;;
61
AIX )
62
FS="/"
63
;;
64
Windows*)
65
FS="\\"
66
;;
67
CYGWIN* )
68
FS="\\"
69
TESTCLASSES=`/usr/bin/cygpath -a -s -m ${TESTCLASSES}`
70
;;
71
esac
72
73
echo TESTSRC=${TESTSRC}
74
echo TESTCLASSES=${TESTCLASSES}
75
echo TESTJAVA=${TESTJAVA}
76
echo ""
77
78
# compile test
79
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
80
-d ${TESTCLASSES} \
81
${TESTSRC}${FS}Starter.java ${TESTSRC}${FS}DelegatingLoader.java
82
83
STATUS=$?
84
if [ ${STATUS} -ne 0 ]
85
then
86
exit ${STATUS}
87
fi
88
89
# set up test
90
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
91
-d ${TESTCLASSES}${FS} \
92
${TESTSRC}${FS}Alice.java ${TESTSRC}${FS}SupBob.java \
93
${TESTSRC}${FS}Bob.java ${TESTSRC}${FS}SupAlice.java
94
95
cd ${TESTCLASSES}
96
DIRS="SA SB"
97
for dir in $DIRS
98
do
99
if [ -d ${dir} ]; then
100
rm -rf ${dir}
101
fi
102
mkdir ${dir}
103
mv com${dir} ${dir}
104
done
105
106
# run test
107
${TESTJAVA}${FS}bin${FS}java \
108
${TESTVMOPTS} \
109
-verbose:class -XX:+TraceClassLoading -cp . \
110
-Dtest.classes=${TESTCLASSES} \
111
Starter cross
112
# -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass \
113
114
# save error status
115
STATUS=$?
116
117
# clean up
118
rm -rf ${TESTCLASSES}${FS}SA ${TESTCLASSES}${FS}SB
119
120
# return
121
exit ${STATUS}
122
123