jdk/test/sun/security/provider/PolicyFile/getinstance/getinstance.sh
author simonis
Fri, 17 Jan 2014 21:54:30 +0100
changeset 22602 0d9a07b0d7e9
parent 15254 3997a6f357cb
permissions -rw-r--r--
8028537: PPC64: Updated the JDK regression tests to run on AIX Reviewed-by: alanb Contributed-by: luchsh@linux.vnet.ibm.com, spoole@linux.vnet.ibm.com, volker.simonis@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#! /bin/sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
#
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 12047
diff changeset
     4
# Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3433
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3433
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3433
diff changeset
    23
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
# @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
# @author  Ram Marti
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    28
# @bug 4350951
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    29
# @summary 4350951 assumes permission constructor with 2 string params
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
# set a few environment variables so that the shell-script can run stand-alone
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
# in the source directory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
if [ "${TESTSRC}" = "" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
   TESTSRC="."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
if [ "${TESTCLASSES}" = "" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
   TESTCLASSES="."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
if [ "${TESTJAVA}" = "" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
   echo "TESTJAVA not set.  Test cannot execute."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
   echo "FAILED!!!"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
   exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    47
if [ "${COMPILEJAVA}" = "" ]; then
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    48
    COMPILEJAVA="${TESTJAVA}"
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    49
fi
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    50
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
# set platform-dependent variables
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
OS=`uname -s`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
case "$OS" in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
  SunOS )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    PS=":"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    FS="/"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
  Linux )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    PS=":"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    FS="/"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    ;;
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    62
  Darwin )
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    63
    PS=":"
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    64
    FS="/"
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    65
    ;;
22602
0d9a07b0d7e9 8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents: 15254
diff changeset
    66
  AIX )
0d9a07b0d7e9 8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents: 15254
diff changeset
    67
    PS=":"
0d9a07b0d7e9 8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents: 15254
diff changeset
    68
    FS="/"
0d9a07b0d7e9 8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents: 15254
diff changeset
    69
    ;;
3433
3b2490b7a752 6867657: Many JSN tests do not run under cygwin
wetmore
parents: 2
diff changeset
    70
  CYGWIN* )
3b2490b7a752 6867657: Many JSN tests do not run under cygwin
wetmore
parents: 2
diff changeset
    71
    PS=";"
3b2490b7a752 6867657: Many JSN tests do not run under cygwin
wetmore
parents: 2
diff changeset
    72
    FS="/"
3b2490b7a752 6867657: Many JSN tests do not run under cygwin
wetmore
parents: 2
diff changeset
    73
    ;;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  Windows* )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    PS=";"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    FS="\\"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
  * )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    echo "Unrecognized system!"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    exit 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
esac
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    84
if [ ! -d ${TESTCLASSES}${FS}boot ]; then
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    85
        mkdir -p ${TESTCLASSES}${FS}boot
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
fi
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    87
if [ ! -d ${TESTCLASSES}${FS}app ]; then
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    88
        mkdir -p ${TESTCLASSES}${FS}app
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
cd ${TESTSRC}${FS}
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    92
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    93
        ${TESTSRC}${FS}NoArgPermission.java
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    94
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    95
        ${TESTSRC}${FS}OneArgPermission.java
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    96
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    97
        ${TESTSRC}${FS}TwoArgPermission.java
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
    98
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
    99
        ${TESTSRC}${FS}TwoArgNullActionsPermission.java
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 14786
diff changeset
   100
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}app \
12047
320a714614e9 7113349: Initial changeset for Macosx port to jdk
michaelm
parents: 5506
diff changeset
   101
        ${TESTSRC}${FS}GetInstance.java
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
14786
a9f61e0cbe61 8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents: 14342
diff changeset
   103
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS}  \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
-Xbootclasspath/a:"${TESTCLASSES}${FS}boot" \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
-classpath "${TESTCLASSES}${FS}app" -Djava.security.manager \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
-Djava.security.policy=GetInstance.policy \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
GetInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
# Save error status
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
status1=$?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
# print error message
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
if [ $status1 -ne 0 ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     echo "Failed on first test"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
14786
a9f61e0cbe61 8003890: corelibs test scripts should pass TESTVMOPTS
chegar
parents: 14342
diff changeset
   117
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS}  \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
-classpath "${TESTCLASSES}${FS}boot${PS}${TESTCLASSES}${FS}app" \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
-Djava.security.manager \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
-Djava.security.policy=GetInstance.policy \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
GetInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
# Save error status
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
status2=$?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
# print error message
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
if [ $status2 -ne 0 ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     echo "Failed on second test"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
# Exit ok?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
if [ $status1 -ne 0 ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     exit $status1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
if [ $status2 -ne 0 ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     exit $status2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
fi