1043N/A#!/bin/sh
1043N/A
1043N/A#
5359N/A# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
1043N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1043N/A#
1043N/A# This code is free software; you can redistribute it and/or modify it
1043N/A# under the terms of the GNU General Public License version 2 only, as
1043N/A# published by the Free Software Foundation.
1043N/A#
1043N/A# This code is distributed in the hope that it will be useful, but WITHOUT
1043N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1043N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1043N/A# version 2 for more details (a copy is included in the LICENSE file that
1043N/A# accompanied this code).
1043N/A#
1043N/A# You should have received a copy of the GNU General Public License version
1043N/A# 2 along with this work; if not, write to the Free Software Foundation,
1043N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1043N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
2362N/A# questions.
1043N/A#
1043N/A
1043N/A
1043N/A# @test
1043N/A# @bug 6440846
1043N/A# @summary make sure we do not deadlock between ExtClassLoader and AppClassLoader
1043N/A# @author Valerie Peng
1043N/A# @run shell/timeout=20 Deadlock2.sh
1043N/A
1043N/A# set a few environment variables so that the shell-script can run stand-alone
1043N/A# in the source directory
1043N/A
1043N/Aif [ "${TESTSRC}" = "" ] ; then
1043N/A TESTSRC="."
1043N/Afi
1043N/A
1043N/Aif [ "${TESTCLASSES}" = "" ] ; then
1043N/A TESTCLASSES="."
1043N/Afi
1043N/A
1043N/Aif [ "${TESTJAVA}" = "" ] ; then
1043N/A echo "TESTJAVA not set. Test cannot execute."
1043N/A echo "FAILED!!!"
1043N/A exit 1
1043N/Afi
1043N/A
1043N/A# set platform-dependent variables
1043N/AOS=`uname -s`
1043N/Acase "$OS" in
1043N/A SunOS )
1043N/A PATHSEP=":"
1043N/A FILESEP="/"
1043N/A ;;
1043N/A Linux )
1043N/A PATHSEP=":"
1043N/A FILESEP="/"
1043N/A ;;
5359N/A CYGWIN* )
5359N/A PATHSEP=";"
5359N/A FILESEP="/"
5359N/A ;;
4638N/A Darwin )
4638N/A PATHSEP=":"
4638N/A FILESEP="/"
4638N/A ;;
1043N/A Windows* )
1043N/A PATHSEP=";"
1043N/A FILESEP="\\"
1043N/A ;;
1043N/A * )
1043N/A echo "Unrecognized system!"
1043N/A exit 1;
1043N/A ;;
1043N/Aesac
1043N/A
1043N/A# remove old class files
1043N/Acd ${TESTCLASSES}
1043N/Aif [ -d testlib ] ; then
1043N/A rm -rf testlib
1043N/Afi
3119N/Aif [ -d ${TESTJAVA}${FILESEP}lib${FILESEP}ext ] ; then
3119N/A cp -r ${TESTJAVA}${FILESEP}lib${FILESEP}ext testlib
3119N/Aelse
3119N/A cp -r ${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}ext testlib
3119N/Afi
1043N/A
1043N/A# compile and package the test program
1043N/A${TESTJAVA}${FILESEP}bin${FILESEP}javac \
1043N/A -d ${TESTCLASSES} \
1043N/A ${TESTSRC}${FILESEP}CreateSerialized.java \
1043N/A ${TESTSRC}${FILESEP}Deadlock2.java
1043N/A
1043N/A${TESTJAVA}${FILESEP}bin${FILESEP}jar \
1043N/A -cvf testlib${FILESEP}Deadlock2.jar \
1043N/A Deadlock2*.class
1043N/A
1043N/Arm Deadlock2*.class
1043N/A
1043N/A# create serialized object and run the test
1043N/A${TESTJAVA}${FILESEP}bin${FILESEP}java CreateSerialized
1043N/A${TESTJAVA}${FILESEP}bin${FILESEP}java -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2
1043N/ASTATUS=$?
1043N/A
1043N/A# clean up
1043N/Arm object.tmp CreateSerialized.class
1043N/Arm -rf testlib
1043N/Aexit ${STATUS}