Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/lang/System/MacEncoding/MacJNUEncoding.sh
46842 views
1
#!/bin/sh
2
3
#
4
# Copyright (c) 2012, 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
# @test
26
# @bug 8003228
27
# @summary Test the value of sun.jnu.encoding on Mac
28
# @author Brent Christian
29
#
30
# @run shell MacJNUEncoding.sh
31
32
# Only run test on Mac
33
OS=`uname -s`
34
case "$OS" in
35
Darwin ) ;;
36
* )
37
exit 0
38
;;
39
esac
40
41
if [ "${TESTJAVA}" = "" ]
42
then
43
echo "TESTJAVA not set. Test cannot execute. Failed."
44
exit 1
45
fi
46
47
if [ "${COMPILEJAVA}" = "" ]; then
48
COMPILEJAVA="${TESTJAVA}"
49
fi
50
51
52
if [ "${TESTSRC}" = "" ]
53
then
54
echo "TESTSRC not set. Test cannot execute. Failed."
55
exit 1
56
fi
57
58
if [ "${TESTCLASSES}" = "" ]
59
then
60
echo "TESTCLASSES not set. Test cannot execute. Failed."
61
exit 1
62
fi
63
64
JAVAC="${COMPILEJAVA}"/bin/javac
65
JAVA="${TESTJAVA}"/bin/java
66
67
echo "Building test classes..."
68
"$JAVAC" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d "${TESTCLASSES}" "${TESTSRC}"/ExpectedEncoding.java
69
70
echo ""
71
echo "Running test for C locale"
72
export LANG=C
73
export LC_ALL=C
74
"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding US-ASCII UTF-8
75
result1=$?
76
77
echo ""
78
echo "Running test for en_US.UTF-8 locale"
79
export LANG=en_US.UTF-8
80
export LC_ALL=en_US.UTF-8
81
"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding UTF-8 UTF-8
82
result2=$?
83
84
echo ""
85
echo "Cleanup"
86
rm ${TESTCLASSES}/ExpectedEncoding.class
87
88
if [ ${result1} -ne 0 ] ; then
89
echo "Test failed for C locale"
90
echo " LANG=\"${LANG}\""
91
echo " LC_ALL=\"${LC_ALL}\""
92
exit ${result1}
93
fi
94
if [ ${result2} -ne 0 ] ; then
95
echo "Test failed for en_US.UTF-8 locale"
96
echo " LANG=\"${LANG}\""
97
echo " LC_ALL=\"${LC_ALL}\""
98
exit ${result2}
99
fi
100
exit 0
101
102
103