5860N/A#!/bin/sh
5860N/A
5860N/A#
5860N/A# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
5860N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5860N/A#
5860N/A# This code is free software; you can redistribute it and/or modify it
5860N/A# under the terms of the GNU General Public License version 2 only, as
5860N/A# published by the Free Software Foundation.
5860N/A#
5860N/A# This code is distributed in the hope that it will be useful, but WITHOUT
5860N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5860N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5860N/A# version 2 for more details (a copy is included in the LICENSE file that
5860N/A# accompanied this code).
5860N/A#
5860N/A# You should have received a copy of the GNU General Public License version
5860N/A# 2 along with this work; if not, write to the Free Software Foundation,
5860N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5860N/A#
5860N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5860N/A# or visit www.oracle.com if you need additional information or have any
5860N/A# questions.
5860N/A
5860N/A# @test
5860N/A# @bug 8003228
5860N/A# @summary Test the value of sun.jnu.encoding on Mac
5860N/A# @author Brent Christian
5860N/A#
5860N/A# @run shell MacJNUEncoding.sh
5860N/A
5860N/A# Only run test on Mac
5860N/AOS=`uname -s`
5860N/Acase "$OS" in
5860N/A Darwin ) ;;
5860N/A * )
5860N/A exit 0
5860N/A ;;
5860N/Aesac
5860N/A
5860N/Aif [ "${TESTJAVA}" = "" ]
5860N/Athen
5860N/A echo "TESTJAVA not set. Test cannot execute. Failed."
5860N/A exit 1
5860N/Afi
5860N/A
5860N/Aif [ "${TESTSRC}" = "" ]
5860N/Athen
5860N/A echo "TESTSRC not set. Test cannot execute. Failed."
5860N/A exit 1
5860N/Afi
5860N/A
5860N/Aif [ "${TESTCLASSES}" = "" ]
5860N/Athen
5860N/A echo "TESTCLASSES not set. Test cannot execute. Failed."
5860N/A exit 1
5860N/Afi
5860N/A
5860N/AJAVAC="${TESTJAVA}"/bin/javac
5860N/AJAVA="${TESTJAVA}"/bin/java
5860N/A
5860N/Aecho "Building test classes..."
5860N/A"$JAVAC" -d "${TESTCLASSES}" "${TESTSRC}"/ExpectedEncoding.java
5860N/A
5860N/Aecho ""
5860N/Aecho "Running test for C locale"
5860N/Aexport LANG=C
5860N/Aexport LC_ALL=C
5860N/A"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding US-ASCII UTF-8
5860N/Aresult1=$?
5860N/A
5860N/Aecho ""
5860N/Aecho "Running test for en_US.UTF-8 locale"
5860N/Aexport LANG=en_US.UTF-8
5860N/Aexport LC_ALL=en_US.UTF-8
5860N/A"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding UTF-8 UTF-8
5860N/Aresult2=$?
5860N/A
5860N/Aecho ""
5860N/Aecho "Cleanup"
5860N/Arm ${TESTCLASSES}/ExpectedEncoding.class
5860N/A
5860N/Aif [ ${result1} -ne 0 ] ; then
5860N/A echo "Test failed for C locale"
5860N/A echo " LANG=\"${LANG}\""
5860N/A echo " LC_ALL=\"${LC_ALL}\""
5860N/A exit ${result1}
5860N/Afi
5860N/Aif [ ${result2} -ne 0 ] ; then
5860N/A echo "Test failed for en_US.UTF-8 locale"
5860N/A echo " LANG=\"${LANG}\""
5860N/A echo " LC_ALL=\"${LC_ALL}\""
5860N/A exit ${result2}
5860N/Afi
5860N/Aexit 0
5860N/A