Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/sun/security/provider/PolicyFile/getinstance/getinstance.sh
41159 views
1
#! /bin/sh
2
3
#
4
# Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6
#
7
# This code is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License version 2 only, as
9
# published by the Free Software Foundation.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25
26
# @test
27
# @author Ram Marti
28
# @bug 4350951
29
# @summary 4350951 assumes permission constructor with 2 string params
30
31
# set a few environment variables so that the shell-script can run stand-alone
32
# in the source directory
33
if [ "${TESTSRC}" = "" ] ; then
34
TESTSRC="."
35
fi
36
37
if [ "${TESTCLASSES}" = "" ] ; then
38
TESTCLASSES="."
39
fi
40
41
if [ "${TESTJAVA}" = "" ] ; then
42
echo "TESTJAVA not set. Test cannot execute."
43
echo "FAILED!!!"
44
exit 1
45
fi
46
47
if [ "${COMPILEJAVA}" = "" ]; then
48
COMPILEJAVA="${TESTJAVA}"
49
fi
50
51
# set platform-dependent variables
52
OS=`uname -s`
53
case "$OS" in
54
Linux )
55
PS=":"
56
FS="/"
57
;;
58
Darwin )
59
PS=":"
60
FS="/"
61
;;
62
AIX )
63
PS=":"
64
FS="/"
65
;;
66
CYGWIN* )
67
PS=";"
68
FS="/"
69
;;
70
Windows* )
71
PS=";"
72
FS="\\"
73
;;
74
* )
75
echo "Unrecognized system!"
76
exit 1;
77
;;
78
esac
79
80
if [ ! -d ${TESTCLASSES}${FS}boot ]; then
81
mkdir -p ${TESTCLASSES}${FS}boot
82
fi
83
if [ ! -d ${TESTCLASSES}${FS}app ]; then
84
mkdir -p ${TESTCLASSES}${FS}app
85
fi
86
87
cd ${TESTSRC}${FS}
88
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \
89
${TESTSRC}${FS}NoArgPermission.java
90
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \
91
${TESTSRC}${FS}OneArgPermission.java
92
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \
93
${TESTSRC}${FS}TwoArgPermission.java
94
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}boot \
95
${TESTSRC}${FS}TwoArgNullActionsPermission.java
96
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${TESTCLASSES}${FS}app \
97
${TESTSRC}${FS}GetInstance.java
98
99
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
100
-Xbootclasspath/a:"${TESTCLASSES}${FS}boot" \
101
-classpath "${TESTCLASSES}${FS}app" -Djava.security.manager \
102
-Djava.security.policy=GetInstance.policy \
103
GetInstance
104
105
# Save error status
106
status1=$?
107
108
# print error message
109
if [ $status1 -ne 0 ]; then
110
echo "Failed on first test"
111
fi
112
113
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
114
-classpath "${TESTCLASSES}${FS}boot${PS}${TESTCLASSES}${FS}app" \
115
-Djava.security.manager \
116
-Djava.security.policy=GetInstance.policy \
117
GetInstance
118
119
# Save error status
120
status2=$?
121
122
# print error message
123
if [ $status2 -ne 0 ]; then
124
echo "Failed on second test"
125
fi
126
127
#
128
# Exit ok?
129
#
130
if [ $status1 -ne 0 ]; then
131
exit $status1
132
fi
133
134
if [ $status2 -ne 0 ]; then
135
exit $status2
136
fi
137
138