author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 40261 | jdk/test/java/util/PluggableLocale/ExecTest.sh@86a49ba76f52 |
permissions | -rw-r--r-- |
17933 | 1 |
#!/bin/sh |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
7668
diff
changeset
|
2 |
# |
30047
63b6a16968d5
8075545: Add permission check for locale service provider implementations
naoto
parents:
28093
diff
changeset
|
3 |
# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. |
2 | 4 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
7668
diff
changeset
|
5 |
# |
2 | 6 |
# This code is free software; you can redistribute it and/or modify it |
7 |
# under the terms of the GNU General Public License version 2 only, as |
|
8 |
# published by the Free Software Foundation. |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
7668
diff
changeset
|
9 |
# |
2 | 10 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
11 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
14 |
# accompanied this code). |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
7668
diff
changeset
|
15 |
# |
2 | 16 |
# You should have received a copy of the GNU General Public License version |
17 |
# 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. |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
7668
diff
changeset
|
19 |
# |
5506 | 20 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
21 |
# or visit www.oracle.com if you need additional information or have any |
|
22 |
# questions. |
|
2 | 23 |
# |
24 |
# |
|
25 |
# |
|
26 |
# |
|
27 |
# This script is the actual launcher of each locale service provider test. |
|
28 |
# fooprovider.jar contains localized object providers and barprovider.jar |
|
29 |
# contains localized name providers. This way, we can test providers that |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
7668
diff
changeset
|
30 |
# can relate to each other (such as, DateFormatSymbolsProvider and |
2 | 31 |
# TimeZoneNameProvider) separately. |
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
7668
diff
changeset
|
32 |
# |
2 | 33 |
# Parameters: |
34 |
# providersToTest: [foo|bar|foobar] |
|
35 |
# java class name: <class name> |
|
30047
63b6a16968d5
8075545: Add permission check for locale service provider implementations
naoto
parents:
28093
diff
changeset
|
36 |
# java security policy file: (Optional. Installs security manager if exists) |
2 | 37 |
|
38 |
if [ "${TESTSRC}" = "" ] |
|
39 |
then |
|
40 |
echo "TESTSRC not set. Test cannot execute. Failed." |
|
41 |
exit 1 |
|
42 |
fi |
|
43 |
echo "TESTSRC=${TESTSRC}" |
|
44 |
if [ "${TESTJAVA}" = "" ] |
|
45 |
then |
|
46 |
echo "TESTJAVA not set. Test cannot execute. Failed." |
|
47 |
exit 1 |
|
48 |
fi |
|
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14786
diff
changeset
|
49 |
if [ "${COMPILEJAVA}" = "" ] |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14786
diff
changeset
|
50 |
then |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14786
diff
changeset
|
51 |
COMPILEJAVA="${TESTJAVA}" |
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14786
diff
changeset
|
52 |
fi |
2 | 53 |
echo "TESTJAVA=${TESTJAVA}" |
54 |
if [ "${TESTCLASSES}" = "" ] |
|
55 |
then |
|
56 |
echo "TESTCLASSES not set. Test cannot execute. Failed." |
|
57 |
exit 1 |
|
58 |
fi |
|
59 |
echo "TESTCLASSES=${TESTCLASSES}" |
|
60 |
echo "CLASSPATH=${CLASSPATH}" |
|
61 |
||
62 |
# set platform-dependent variables |
|
63 |
OS=`uname -s` |
|
64 |
case "$OS" in |
|
22602
0d9a07b0d7e9
8028537: PPC64: Updated the JDK regression tests to run on AIX
simonis
parents:
17933
diff
changeset
|
65 |
SunOS | Linux | Darwin | AIX ) |
2 | 66 |
PS=":" |
67 |
FS="/" |
|
68 |
;; |
|
4662
49b8cbe45e6a
6911108: These tests do not work with CYGWIN: java/util
ohair
parents:
2
diff
changeset
|
69 |
Windows* | CYGWIN* ) |
2 | 70 |
PS=";" |
71 |
FS="\\" |
|
72 |
;; |
|
73 |
* ) |
|
74 |
echo "Unrecognized system!" |
|
75 |
exit 1; |
|
76 |
;; |
|
77 |
esac |
|
78 |
||
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
7668
diff
changeset
|
79 |
case "$1" in |
2 | 80 |
"foo" ) |
81 |
cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES} |
|
82 |
CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar" |
|
83 |
;; |
|
84 |
"bar" ) |
|
85 |
cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES} |
|
86 |
CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar" |
|
87 |
;; |
|
88 |
"foobar" ) |
|
89 |
cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES} |
|
90 |
cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES} |
|
91 |
CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar" |
|
92 |
;; |
|
93 |
esac |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
7668
diff
changeset
|
94 |
|
36511 | 95 |
|
40261
86a49ba76f52
8136930: Simplify use of module-system options by custom launchers
mchung
parents:
36928
diff
changeset
|
96 |
EXTRA_OPTS="--add-exports java.base/sun.util.locale.provider=ALL-UNNAMED \ |
86a49ba76f52
8136930: Simplify use of module-system options by custom launchers
mchung
parents:
36928
diff
changeset
|
97 |
--add-exports java.base/sun.util.resources=ALL-UNNAMED" |
36511 | 98 |
|
2 | 99 |
# compile |
100 |
cp ${TESTSRC}${FS}ProviderTest.java . |
|
101 |
cp ${TESTSRC}${FS}$2.java . |
|
36511 | 102 |
COMPILE="${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRA_OPTS} \ |
15254
3997a6f357cb
8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents:
14786
diff
changeset
|
103 |
-XDignore.symbol.file -d . -classpath ${CLASSPATHARG} $2.java" |
2 | 104 |
echo ${COMPILE} |
105 |
${COMPILE} |
|
106 |
result=$? |
|
107 |
||
108 |
if [ $result -eq 0 ] |
|
109 |
then |
|
110 |
echo "Compilation of the test case was successful." |
|
12047
320a714614e9
7113349: Initial changeset for Macosx port to jdk
michaelm
parents:
7668
diff
changeset
|
111 |
else |
2 | 112 |
echo "Compilation of the test case failed." |
113 |
# Cleanup |
|
114 |
rm -f ${TESTCLASSES}${FS}$2*.class |
|
115 |
rm -f ${TESTCLASSES}${FS}fooprovider.jar |
|
116 |
rm -f ${TESTCLASSES}${FS}barprovider.jar |
|
117 |
exit $result |
|
118 |
fi |
|
119 |
||
30047
63b6a16968d5
8075545: Add permission check for locale service provider implementations
naoto
parents:
28093
diff
changeset
|
120 |
# security options |
63b6a16968d5
8075545: Add permission check for locale service provider implementations
naoto
parents:
28093
diff
changeset
|
121 |
if [ "$3" != "" ] |
63b6a16968d5
8075545: Add permission check for locale service provider implementations
naoto
parents:
28093
diff
changeset
|
122 |
then |
63b6a16968d5
8075545: Add permission check for locale service provider implementations
naoto
parents:
28093
diff
changeset
|
123 |
SECURITYOPTS="-Djava.security.manager -Djava.security.policy=${TESTSRC}${FS}$3" |
63b6a16968d5
8075545: Add permission check for locale service provider implementations
naoto
parents:
28093
diff
changeset
|
124 |
fi |
63b6a16968d5
8075545: Add permission check for locale service provider implementations
naoto
parents:
28093
diff
changeset
|
125 |
|
2 | 126 |
# run |
36511 | 127 |
RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRA_OPTS} ${SECURITYOPTS} -classpath ${CLASSPATHARG} -Djava.locale.providers=JRE,SPI $2 " |
2 | 128 |
|
129 |
echo ${RUNCMD} |
|
130 |
${RUNCMD} |
|
131 |
result=$? |
|
132 |
||
133 |
if [ $result -eq 0 ] |
|
134 |
then |
|
135 |
echo "Execution successful" |
|
136 |
else |
|
137 |
echo "Execution of the test case failed." |
|
138 |
fi |
|
139 |
||
140 |
# Cleanup |
|
141 |
rm -f ${TESTCLASSES}${FS}$2*.class |
|
142 |
rm -f ${TESTCLASSES}${FS}fooprovider.jar |
|
143 |
rm -f ${TESTCLASSES}${FS}barprovider.jar |
|
144 |
||
145 |
exit $result |