Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/lang/System/MacEncoding/MacJNUEncoding.sh
46842 views
#!/bin/sh12#3# Copyright (c) 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.2324# @test25# @bug 800322826# @summary Test the value of sun.jnu.encoding on Mac27# @author Brent Christian28#29# @run shell MacJNUEncoding.sh3031# Only run test on Mac32OS=`uname -s`33case "$OS" in34Darwin ) ;;35* )36exit 037;;38esac3940if [ "${TESTJAVA}" = "" ]41then42echo "TESTJAVA not set. Test cannot execute. Failed."43exit 144fi4546if [ "${COMPILEJAVA}" = "" ]; then47COMPILEJAVA="${TESTJAVA}"48fi495051if [ "${TESTSRC}" = "" ]52then53echo "TESTSRC not set. Test cannot execute. Failed."54exit 155fi5657if [ "${TESTCLASSES}" = "" ]58then59echo "TESTCLASSES not set. Test cannot execute. Failed."60exit 161fi6263JAVAC="${COMPILEJAVA}"/bin/javac64JAVA="${TESTJAVA}"/bin/java6566echo "Building test classes..."67"$JAVAC" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d "${TESTCLASSES}" "${TESTSRC}"/ExpectedEncoding.java6869echo ""70echo "Running test for C locale"71export LANG=C72export LC_ALL=C73"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding US-ASCII UTF-874result1=$?7576echo ""77echo "Running test for en_US.UTF-8 locale"78export LANG=en_US.UTF-879export LC_ALL=en_US.UTF-880"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding UTF-8 UTF-881result2=$?8283echo ""84echo "Cleanup"85rm ${TESTCLASSES}/ExpectedEncoding.class8687if [ ${result1} -ne 0 ] ; then88echo "Test failed for C locale"89echo " LANG=\"${LANG}\""90echo " LC_ALL=\"${LC_ALL}\""91exit ${result1}92fi93if [ ${result2} -ne 0 ] ; then94echo "Test failed for en_US.UTF-8 locale"95echo " LANG=\"${LANG}\""96echo " LC_ALL=\"${LC_ALL}\""97exit ${result2}98fi99exit 0100101102103