Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh
38861 views
#! /bin/sh12#3# Copyright (c) 2001, 2012, 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" in53SunOS )54PS=":"55FS="/"56;;57Linux )58PS=":"59FS="/"60;;61Darwin )62PS=":"63FS="/"64;;65AIX )66PS=":"67FS="/"68;;69CYGWIN* )70PS=";"71FS="/"72;;73Windows* )74PS=";"75FS="\\"76;;77* )78echo "Unrecognized system!"79exit 1;80;;81esac8283if [ ! -d ${TESTCLASSES}${FS}boot ]; then84mkdir -p ${TESTCLASSES}${FS}boot85fi86if [ ! -d ${TESTCLASSES}${FS}app ]; then87mkdir -p ${TESTCLASSES}${FS}app88fi8990cd ${TESTSRC}${FS}91${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \92${TESTSRC}${FS}NoArgPermission.java93${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \94${TESTSRC}${FS}OneArgPermission.java95${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \96${TESTSRC}${FS}TwoArgPermission.java97${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \98${TESTSRC}${FS}TwoArgNullActionsPermission.java99${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}app \100${TESTSRC}${FS}GetInstance.java101102${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \103-Xbootclasspath/a:"${TESTCLASSES}${FS}boot" \104-classpath "${TESTCLASSES}${FS}app" -Djava.security.manager \105-Djava.security.policy=GetInstance.policy \106GetInstance107108# Save error status109status1=$?110111# print error message112if [ $status1 -ne 0 ]; then113echo "Failed on first test"114fi115116${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \117-classpath "${TESTCLASSES}${FS}boot${PS}${TESTCLASSES}${FS}app" \118-Djava.security.manager \119-Djava.security.policy=GetInstance.policy \120GetInstance121122# Save error status123status2=$?124125# print error message126if [ $status2 -ne 0 ]; then127echo "Failed on second test"128fi129130#131# Exit ok?132#133if [ $status1 -ne 0 ]; then134exit $status1135fi136137if [ $status2 -ne 0 ]; then138exit $status2139fi140141142