view j2se/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh @ 7:807dfe9c366c trunk

[svn] Load openjdk/jdk7/b19 into jdk/trunk.
author xiomara
date Fri, 31 Aug 2007 00:44:13 +0000
parents 5937f8212f93
children 37f131a4a8e7
line wrap: on
line source

#! /bin/sh

#
# Copyright 2001-2003 Sun Microsystems, Inc.  All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
# CA 95054 USA or visit www.sun.com if you need additional information or
# have any questions.
#

# @test 1.9 07/08/30
# @author  Ram Marti
# @bug 4350951 
# @summary 4350951 assumes permission constructor with 2 string params 

# set a few environment variables so that the shell-script can run stand-alone
# in the source directory
if [ "${TESTSRC}" = "" ] ; then
   TESTSRC="."
fi

if [ "${TESTCLASSES}" = "" ] ; then
   TESTCLASSES="."
fi

if [ "${TESTJAVA}" = "" ] ; then
   echo "TESTJAVA not set.  Test cannot execute."
   echo "FAILED!!!"
   exit 1
fi

# set platform-dependent variables
OS=`uname -s`
case "$OS" in
  SunOS )
    PS=":"
    FS="/"
    ;;
  Linux )
    PS=":"
    FS="/"
    ;;
  Windows* )
    PS=";"
    FS="\\"
    ;;
  * )
    echo "Unrecognized system!"
    exit 1;
    ;;
esac

if [ ! -d ${TESTCLASSES}${FS}boot ]; then 
	mkdir -p ${TESTCLASSES}${FS}boot
fi
if [ ! -d ${TESTCLASSES}${FS}app ]; then 
	mkdir -p ${TESTCLASSES}${FS}app
fi

cd ${TESTSRC}${FS}
${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}boot \
	${TESTSRC}${FS}NoArgPermission.java
${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}boot \
	${TESTSRC}${FS}OneArgPermission.java
${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}boot \
	${TESTSRC}${FS}TwoArgPermission.java
${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}boot \
	${TESTSRC}${FS}TwoArgNullActionsPermission.java
${TESTJAVA}${FS}bin${FS}javac -d ${TESTCLASSES}${FS}app \
	${TESTSRC}${FS}GetInstance.java

${TESTJAVA}${FS}bin${FS}java  \
-Xbootclasspath/a:"${TESTCLASSES}${FS}boot" \
-classpath "${TESTCLASSES}${FS}app" -Djava.security.manager \
-Djava.security.policy=GetInstance.policy \
GetInstance

# Save error status
status1=$?

# print error message
if [ $status1 -ne 0 ]; then
     echo "Failed on first test"
fi

${TESTJAVA}${FS}bin${FS}java  \
-classpath "${TESTCLASSES}${FS}boot${PS}${TESTCLASSES}${FS}app" \
-Djava.security.manager \
-Djava.security.policy=GetInstance.policy \
GetInstance

# Save error status
status2=$?

# print error message
if [ $status2 -ne 0 ]; then
     echo "Failed on second test"
fi

#
# Exit ok?
#
if [ $status1 -ne 0 ]; then
     exit $status1
fi

if [ $status2 -ne 0 ]; then
     exit $status2
fi