Path: blob/master/test/jdk/sun/security/provider/PolicyFile/getinstance/getinstance.sh
41159 views
#! /bin/sh12#3# Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.5#6# This code is free software; you can redistribute it and/or modify it7# under the terms of the GNU General Public License version 2 only, as8# published by the Free Software Foundation.9#10# This code is distributed in the hope that it will be useful, but WITHOUT11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13# version 2 for more details (a copy is included in the LICENSE file that14# accompanied this code).15#16# You should have received a copy of the GNU General Public License version17# 2 along with this work; if not, write to the Free Software Foundation,18# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19#20# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21# or visit www.oracle.com if you need additional information or have any22# questions.23#2425# @test26# @author Ram Marti27# @bug 435095128# @summary 4350951 assumes permission constructor with 2 string params2930# set a few environment variables so that the shell-script can run stand-alone31# in the source directory32if [ "${TESTSRC}" = "" ] ; then33TESTSRC="."34fi3536if [ "${TESTCLASSES}" = "" ] ; then37TESTCLASSES="."38fi3940if [ "${TESTJAVA}" = "" ] ; then41echo "TESTJAVA not set. Test cannot execute."42echo "FAILED!!!"43exit 144fi4546if [ "${COMPILEJAVA}" = "" ]; then47COMPILEJAVA="${TESTJAVA}"48fi4950# set platform-dependent variables51OS=`uname -s`52case "$OS" in53Linux )54PS=":"55FS="/"56;;57Darwin )58PS=":"59FS="/"60;;61AIX )62PS=":"63FS="/"64;;65CYGWIN* )66PS=";"67FS="/"68;;69Windows* )70PS=";"71FS="\\"72;;73* )74echo "Unrecognized system!"75exit 1;76;;77esac7879if [ ! -d ${TESTCLASSES}${FS}boot ]; then80mkdir -p ${TESTCLASSES}${FS}boot81fi82if [ ! -d ${TESTCLASSES}${FS}app ]; then83mkdir -p ${TESTCLASSES}${FS}app84fi8586cd ${TESTSRC}${FS}87${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \88${TESTSRC}${FS}NoArgPermission.java89${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \90${TESTSRC}${FS}OneArgPermission.java91${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \92${TESTSRC}${FS}TwoArgPermission.java93${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \94${TESTSRC}${FS}TwoArgNullActionsPermission.java95${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}app \96${TESTSRC}${FS}GetInstance.java9798${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \99-Xbootclasspath/a:"${TESTCLASSES}${FS}boot" \100-classpath "${TESTCLASSES}${FS}app" -Djava.security.manager \101-Djava.security.policy=GetInstance.policy \102GetInstance103104# Save error status105status1=$?106107# print error message108if [ $status1 -ne 0 ]; then109echo "Failed on first test"110fi111112${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \113-classpath "${TESTCLASSES}${FS}boot${PS}${TESTCLASSES}${FS}app" \114-Djava.security.manager \115-Djava.security.policy=GetInstance.policy \116GetInstance117118# Save error status119status2=$?120121# print error message122if [ $status2 -ne 0 ]; then123echo "Failed on second test"124fi125126#127# Exit ok?128#129if [ $status1 -ne 0 ]; then130exit $status1131fi132133if [ $status2 -ne 0 ]; then134exit $status2135fi136137138