Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh
38828 views
#!/bin/sh12#3# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.5#6# This code is free software; you can redistribute it and/or modify it7# under the terms of the GNU General Public License version 2 only, as8# published by the Free Software Foundation.9#10# This code is distributed in the hope that it will be useful, but WITHOUT11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13# version 2 for more details (a copy is included in the LICENSE file that14# accompanied this code).15#16# You should have received a copy of the GNU General Public License version17# 2 along with this work; if not, write to the Free Software Foundation,18# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19#20# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21# or visit www.oracle.com if you need additional information or have any22# questions.23#242526# @test27# @bug 644084628# @summary make sure we do not deadlock between ExtClassLoader and AppClassLoader29# @author Valerie Peng30# @run shell/timeout=20 Deadlock2.sh3132# set a few environment variables so that the shell-script can run stand-alone33# in the source directory3435if [ "${TESTSRC}" = "" ] ; then36TESTSRC="."37fi3839if [ "${TESTCLASSES}" = "" ] ; then40TESTCLASSES="."41fi4243if [ "${TESTJAVA}" = "" ] ; then44echo "TESTJAVA not set. Test cannot execute."45echo "FAILED!!!"46exit 147fi4849if [ "${COMPILEJAVA}" = "" ]; then50COMPILEJAVA="${TESTJAVA}"51fi5253# set platform-dependent variables54OS=`uname -s`55case "$OS" in56SunOS )57PATHSEP=":"58FILESEP="/"59;;60Linux )61PATHSEP=":"62FILESEP="/"63;;64CYGWIN* )65PATHSEP=";"66FILESEP="/"67;;68Darwin )69PATHSEP=":"70FILESEP="/"71;;72AIX )73PATHSEP=":"74FILESEP="/"75;;76Windows* )77PATHSEP=";"78FILESEP="\\"79;;80* )81echo "Unrecognized system!"82exit 1;83;;84esac8586# remove old class files87cd ${TESTCLASSES}88if [ -d testlib ] ; then89rm -rf testlib90fi91if [ -d ${TESTJAVA}${FILESEP}lib${FILESEP}ext ] ; then92cp -r ${TESTJAVA}${FILESEP}lib${FILESEP}ext testlib93else94cp -r ${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}ext testlib95fi9697# compile and package the test program98${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \99-d ${TESTCLASSES} \100${TESTSRC}${FILESEP}CreateSerialized.java \101${TESTSRC}${FILESEP}Deadlock2.java102103${COMPILEJAVA}${FILESEP}bin${FILESEP}jar ${TESTTOOLVMOPTS} \104-cvf testlib${FILESEP}Deadlock2.jar \105Deadlock2*.class106107rm Deadlock2*.class108109# create serialized object and run the test110${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} CreateSerialized111${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2112STATUS=$?113114# clean up115rm object.tmp CreateSerialized.class116rm -rf testlib117exit ${STATUS}118119120