1 #
   2 # Copyright (c) 2002, 2012, 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 [ "${TESTSRC}" = "" ]
  39 then
  40         TESTSRC="."
  41 fi
  42 
  43 OS=`uname -s`
  44 case "$OS" in
  45     SunOS | Linux | Darwin )
  46         FILESEP="/"
  47         PATHSEP=":"
  48         ;;
  49 
  50     CYGWIN* )
  51         FILESEP="/"
  52         PATHSEP=";"
  53         ;;
  54 
  55     Windows* )
  56         FILESEP="\\"
  57         PATHSEP=";"
  58         ;;
  59 esac
  60 
  61 set -ex
  62 
  63 #
  64 # Compile the tests, package into their respective jars
  65 #
  66 ${TESTJAVA}${FILESEP}bin${FILESEP}javac -d . \
  67     ${TESTSRC}${FILESEP}NotifyHandshakeTest.java \
  68     ${TESTSRC}${FILESEP}NotifyHandshakeTestHeyYou.java
  69 ${TESTJAVA}${FILESEP}bin${FILESEP}jar -cvf com.jar \
  70     com${FILESEP}NotifyHandshakeTest*.class
  71 ${TESTJAVA}${FILESEP}bin${FILESEP}jar -cvf edu.jar \
  72     edu${FILESEP}NotifyHandshakeTestHeyYou.class
  73 
  74 #
  75 # Don't want the original class files to be used, because
  76 # we want the jar files with the associated contexts to
  77 # be used.
  78 #
  79 rm -rf com edu
  80 
  81 #
  82 # This is the only thing we really care about as far as
  83 # test status goes.
  84 #
  85 ${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
  86     -Dtest.src=${TESTSRC} \
  87     -classpath "com.jar${PATHSEP}edu.jar" \
  88     -Djava.security.manager \
  89     -Djava.security.policy=${TESTSRC}${FILESEP}NotifyHandshakeTest.policy \
  90     com.NotifyHandshakeTest
  91 retval=$?
  92 
  93 rm com.jar edu.jar
  94 
  95 exit $retval