test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh

Print this page




  30 # @author Valerie Peng
  31 # @run shell/timeout=20 Deadlock2.sh
  32 
  33 # set a few environment variables so that the shell-script can run stand-alone
  34 # in the source directory
  35 
  36 if [ "${TESTSRC}" = "" ] ; then
  37    TESTSRC="."
  38 fi
  39 
  40 if [ "${TESTCLASSES}" = "" ] ; then
  41    TESTCLASSES="."
  42 fi
  43 
  44 if [ "${TESTJAVA}" = "" ] ; then
  45    echo "TESTJAVA not set.  Test cannot execute."
  46    echo "FAILED!!!"
  47    exit 1
  48 fi
  49 




  50 # set platform-dependent variables
  51 OS=`uname -s`
  52 case "$OS" in
  53   SunOS )
  54     PATHSEP=":"
  55     FILESEP="/"
  56     ;;
  57   Linux )
  58     PATHSEP=":"
  59     FILESEP="/"
  60     ;;
  61   CYGWIN* )
  62     PATHSEP=";"
  63     FILESEP="/"
  64     ;;
  65   Darwin )
  66     PATHSEP=":"
  67     FILESEP="/"
  68     ;;
  69   Windows* )


  71     FILESEP="\\"
  72     ;;
  73   * )
  74     echo "Unrecognized system!"
  75     exit 1;
  76     ;;
  77 esac
  78 
  79 # remove old class files
  80 cd ${TESTCLASSES}
  81 if [ -d testlib ] ; then
  82     rm -rf testlib
  83 fi
  84 if [ -d ${TESTJAVA}${FILESEP}lib${FILESEP}ext ] ; then
  85     cp -r ${TESTJAVA}${FILESEP}lib${FILESEP}ext testlib
  86 else
  87     cp -r ${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}ext testlib
  88 fi
  89 
  90 # compile and package the test program
  91 ${TESTJAVA}${FILESEP}bin${FILESEP}javac \
  92     -d ${TESTCLASSES} \
  93     ${TESTSRC}${FILESEP}CreateSerialized.java \
  94     ${TESTSRC}${FILESEP}Deadlock2.java
  95 
  96 ${TESTJAVA}${FILESEP}bin${FILESEP}jar \
  97     -cvf testlib${FILESEP}Deadlock2.jar \
  98     Deadlock2*.class
  99 
 100 rm Deadlock2*.class
 101 
 102 # create serialized object and run the test
 103 ${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} CreateSerialized
 104 ${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2
 105 STATUS=$?
 106 
 107 # clean up
 108 rm object.tmp CreateSerialized.class
 109 rm -rf testlib
 110 exit ${STATUS}


  30 # @author Valerie Peng
  31 # @run shell/timeout=20 Deadlock2.sh
  32 
  33 # set a few environment variables so that the shell-script can run stand-alone
  34 # in the source directory
  35 
  36 if [ "${TESTSRC}" = "" ] ; then
  37    TESTSRC="."
  38 fi
  39 
  40 if [ "${TESTCLASSES}" = "" ] ; then
  41    TESTCLASSES="."
  42 fi
  43 
  44 if [ "${TESTJAVA}" = "" ] ; then
  45    echo "TESTJAVA not set.  Test cannot execute."
  46    echo "FAILED!!!"
  47    exit 1
  48 fi
  49 
  50 if [ "${COMPILEJAVA}" = "" ]; then
  51    COMPILEJAVA="${TESTJAVA}"
  52 fi
  53 
  54 # set platform-dependent variables
  55 OS=`uname -s`
  56 case "$OS" in
  57   SunOS )
  58     PATHSEP=":"
  59     FILESEP="/"
  60     ;;
  61   Linux )
  62     PATHSEP=":"
  63     FILESEP="/"
  64     ;;
  65   CYGWIN* )
  66     PATHSEP=";"
  67     FILESEP="/"
  68     ;;
  69   Darwin )
  70     PATHSEP=":"
  71     FILESEP="/"
  72     ;;
  73   Windows* )


  75     FILESEP="\\"
  76     ;;
  77   * )
  78     echo "Unrecognized system!"
  79     exit 1;
  80     ;;
  81 esac
  82 
  83 # remove old class files
  84 cd ${TESTCLASSES}
  85 if [ -d testlib ] ; then
  86     rm -rf testlib
  87 fi
  88 if [ -d ${TESTJAVA}${FILESEP}lib${FILESEP}ext ] ; then
  89     cp -r ${TESTJAVA}${FILESEP}lib${FILESEP}ext testlib
  90 else
  91     cp -r ${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}ext testlib
  92 fi
  93 
  94 # compile and package the test program
  95 ${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
  96     -d ${TESTCLASSES} \
  97     ${TESTSRC}${FILESEP}CreateSerialized.java \
  98     ${TESTSRC}${FILESEP}Deadlock2.java
  99 
 100 ${COMPILEJAVA}${FILESEP}bin${FILESEP}jar ${TESTTOOLVMOPTS} \
 101     -cvf testlib${FILESEP}Deadlock2.jar \
 102     Deadlock2*.class
 103 
 104 rm Deadlock2*.class
 105 
 106 # create serialized object and run the test
 107 ${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} CreateSerialized
 108 ${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2
 109 STATUS=$?
 110 
 111 # clean up
 112 rm object.tmp CreateSerialized.class
 113 rm -rf testlib
 114 exit ${STATUS}