annotate test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh @ 5663:4afe5648fc4b

7054918: jdk_security1 test target cleanup Reviewed-by: xuelei, weijun
author juh
date Fri, 28 Sep 2012 11:20:31 +0800
parents 12819477ce5a
children ce83f5dff245 4e4e6c375cb0
rev   line source
valeriep@1093 1 #!/bin/sh
valeriep@1093 2
valeriep@1093 3 #
juh@5663 4 # Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
valeriep@1093 5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
valeriep@1093 6 #
valeriep@1093 7 # This code is free software; you can redistribute it and/or modify it
valeriep@1093 8 # under the terms of the GNU General Public License version 2 only, as
valeriep@1093 9 # published by the Free Software Foundation.
valeriep@1093 10 #
valeriep@1093 11 # This code is distributed in the hope that it will be useful, but WITHOUT
valeriep@1093 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
valeriep@1093 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
valeriep@1093 14 # version 2 for more details (a copy is included in the LICENSE file that
valeriep@1093 15 # accompanied this code).
valeriep@1093 16 #
valeriep@1093 17 # You should have received a copy of the GNU General Public License version
valeriep@1093 18 # 2 along with this work; if not, write to the Free Software Foundation,
valeriep@1093 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
valeriep@1093 20 #
ohair@2486 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@2486 22 # or visit www.oracle.com if you need additional information or have any
ohair@2486 23 # questions.
valeriep@1093 24 #
valeriep@1093 25
valeriep@1093 26
valeriep@1093 27 # @test
valeriep@1093 28 # @bug 6440846
valeriep@1093 29 # @summary make sure we do not deadlock between ExtClassLoader and AppClassLoader
valeriep@1093 30 # @author Valerie Peng
valeriep@1093 31 # @run shell/timeout=20 Deadlock2.sh
valeriep@1093 32
valeriep@1093 33 # set a few environment variables so that the shell-script can run stand-alone
valeriep@1093 34 # in the source directory
valeriep@1093 35
valeriep@1093 36 if [ "${TESTSRC}" = "" ] ; then
valeriep@1093 37 TESTSRC="."
valeriep@1093 38 fi
valeriep@1093 39
valeriep@1093 40 if [ "${TESTCLASSES}" = "" ] ; then
valeriep@1093 41 TESTCLASSES="."
valeriep@1093 42 fi
valeriep@1093 43
valeriep@1093 44 if [ "${TESTJAVA}" = "" ] ; then
valeriep@1093 45 echo "TESTJAVA not set. Test cannot execute."
valeriep@1093 46 echo "FAILED!!!"
valeriep@1093 47 exit 1
valeriep@1093 48 fi
valeriep@1093 49
valeriep@1093 50 # set platform-dependent variables
valeriep@1093 51 OS=`uname -s`
valeriep@1093 52 case "$OS" in
valeriep@1093 53 SunOS )
valeriep@1093 54 PATHSEP=":"
valeriep@1093 55 FILESEP="/"
valeriep@1093 56 ;;
valeriep@1093 57 Linux )
valeriep@1093 58 PATHSEP=":"
valeriep@1093 59 FILESEP="/"
valeriep@1093 60 ;;
juh@5663 61 CYGWIN* )
juh@5663 62 PATHSEP=";"
juh@5663 63 FILESEP="/"
juh@5663 64 ;;
michaelm@4840 65 Darwin )
michaelm@4840 66 PATHSEP=":"
michaelm@4840 67 FILESEP="/"
michaelm@4840 68 ;;
valeriep@1093 69 Windows* )
valeriep@1093 70 PATHSEP=";"
valeriep@1093 71 FILESEP="\\"
valeriep@1093 72 ;;
valeriep@1093 73 * )
valeriep@1093 74 echo "Unrecognized system!"
valeriep@1093 75 exit 1;
valeriep@1093 76 ;;
valeriep@1093 77 esac
valeriep@1093 78
valeriep@1093 79 # remove old class files
valeriep@1093 80 cd ${TESTCLASSES}
valeriep@1093 81 if [ -d testlib ] ; then
valeriep@1093 82 rm -rf testlib
valeriep@1093 83 fi
valeriep@3267 84 if [ -d ${TESTJAVA}${FILESEP}lib${FILESEP}ext ] ; then
valeriep@3267 85 cp -r ${TESTJAVA}${FILESEP}lib${FILESEP}ext testlib
valeriep@3267 86 else
valeriep@3267 87 cp -r ${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}ext testlib
valeriep@3267 88 fi
valeriep@1093 89
valeriep@1093 90 # compile and package the test program
valeriep@1093 91 ${TESTJAVA}${FILESEP}bin${FILESEP}javac \
valeriep@1093 92 -d ${TESTCLASSES} \
valeriep@1093 93 ${TESTSRC}${FILESEP}CreateSerialized.java \
valeriep@1093 94 ${TESTSRC}${FILESEP}Deadlock2.java
valeriep@1093 95
valeriep@1093 96 ${TESTJAVA}${FILESEP}bin${FILESEP}jar \
valeriep@1093 97 -cvf testlib${FILESEP}Deadlock2.jar \
valeriep@1093 98 Deadlock2*.class
valeriep@1093 99
valeriep@1093 100 rm Deadlock2*.class
valeriep@1093 101
valeriep@1093 102 # create serialized object and run the test
valeriep@1093 103 ${TESTJAVA}${FILESEP}bin${FILESEP}java CreateSerialized
valeriep@1093 104 ${TESTJAVA}${FILESEP}bin${FILESEP}java -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2
valeriep@1093 105 STATUS=$?
valeriep@1093 106
valeriep@1093 107 # clean up
valeriep@1093 108 rm object.tmp CreateSerialized.class
valeriep@1093 109 rm -rf testlib
valeriep@1093 110 exit ${STATUS}