CheckSJISMappingProp.sh revision 9195:f04b825b1c0c
1#!/bin/sh 2 3# 4# Copyright (c) 2003, 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 26# @test 27# @summary Verify that sun.nio.cs.map property interpreted in ja multibyte locales 28# @bug 4879123 29# @build SJISPropTest 30# 31# @run shell/timeout=300 CheckSJISMappingProp.sh 32 33# set platform-dependent variables 34 35OS=`uname -s` 36case "$OS" in 37 SunOS | Linux | Darwin | AIX ) ;; 38 # Skip locale test for Windows 39 Windows* | CYGWIN* ) 40 echo "Passed"; exit 0 ;; 41 * ) echo "Unrecognized system!" ; exit 1 ;; 42esac 43 44expectPass() { 45 if [ $1 -eq 0 ] 46 then echo "--- passed as expected" 47 else 48 echo "--- failed" 49 exit $1 50 fi 51} 52 53 54JAVA="${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTCLASSES}" 55runTest() { 56 echo "Testing:" ${1} 57 LC_ALL="$1" ; export LC_ALL 58 locale 59 # Firstly, test with property set 60 # (shift_jis should map to windows-31J charset) 61 ${JAVA} -Dsun.nio.cs.map="Windows-31J/Shift_JIS" SJISPropTest MS932 62 expectPass $? 63 64 # Next, test without property set - "shift_jis" follows IANA conventions 65 # and should map to the sun.nio.cs.ext.Shift_JIS charset 66 ${JAVA} SJISPropTest Shift_JIS 67 expectPass $? 68} 69 70# Run the test in the common Solaris/Linux/Mac OS locales 71# Tests will simply run in current locale if locale isn't supported 72# on the test machine/platform 73 74for i in "ja" "ja_JP.PCK" "ja_JP.eucJP" ; do 75 runTest ${i} 76done 77