1 #
   2 # Copyright (c) 2002, 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 
  24 # @test
  25 # @bug 4673442
  26 # @summary remove doPrivileged when creatingting the NotifyHandshakeThread
  27 # @run shell NotifyHandshakeTest.sh
  28 # @author Brad Wetmore
  29 #
  30 # To run independently:  sh NotifyHandshakeTest.sh
  31 
  32 if [ "${TESTJAVA}" = "" ]
  33 then
  34         echo "TESTJAVA not set.  Test cannot execute.  Failed."
  35         exit 1
  36 fi
  37 
  38 if [ "${COMPILEJAVA}" = "" ]; then
  39         COMPILEJAVA="${TESTJAVA}"
  40 fi
  41 
  42 if [ "${TESTSRC}" = "" ]
  43 then
  44         TESTSRC="."
  45 fi
  46 
  47 OS=`uname -s`
  48 case "$OS" in
  49     SunOS | Linux | Darwin | AIX )
  50         FILESEP="/"
  51         PATHSEP=":"
  52         ;;
  53 
  54     CYGWIN* )
  55         FILESEP="/"
  56         PATHSEP=";"
  57         ;;
  58 
  59     Windows* )
  60         FILESEP="\\"
  61         PATHSEP=";"
  62         ;;
  63 esac
  64 
  65 set -ex
  66 
  67 #
  68 # Compile the tests, package into their respective jars
  69 #
  70 ${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . \
  71     ${TESTSRC}${FILESEP}NotifyHandshakeTest.java \
  72     ${TESTSRC}${FILESEP}NotifyHandshakeTestHeyYou.java
  73 ${COMPILEJAVA}${FILESEP}bin${FILESEP}jar ${TESTTOOLVMOPTS} -cvf com.jar \
  74     com${FILESEP}NotifyHandshakeTest*.class
  75 ${COMPILEJAVA}${FILESEP}bin${FILESEP}jar ${TESTTOOLVMOPTS} -cvf edu.jar \
  76     edu${FILESEP}NotifyHandshakeTestHeyYou.class
  77 
  78 #
  79 # Don't want the original class files to be used, because
  80 # we want the jar files with the associated contexts to
  81 # be used.
  82 #
  83 rm -rf com edu
  84 
  85 #
  86 # This is the only thing we really care about as far as
  87 # test status goes.
  88 #
  89 ${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
  90     -Dtest.src=${TESTSRC} \
  91     -classpath "com.jar${PATHSEP}edu.jar" \
  92     -Djava.security.manager \
  93     -Djava.security.policy=${TESTSRC}${FILESEP}NotifyHandshakeTest.policy \
  94     com.NotifyHandshakeTest
  95 retval=$?
  96 
  97 rm com.jar edu.jar
  98 
  99 exit $retval