1#!/bin/sh 2 3# 4# Copyright (c) 2010, 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# @bug 4772857 28# @summary Unit test for Charset.defaultCharset 29# 30# @build Default 31# @run shell default.sh 32# 33 34# Command-line usage: sh default.sh [/path/to/build] 35 36if [ -z "$TESTJAVA" ]; then 37 if [ $# -lt 1 ]; then exit 1; fi 38 TESTJAVA=$1; shift 39 TESTSRC=`pwd` 40 TESTCLASSES=`pwd` 41fi 42 43s="`uname -s`" 44if [ "$s" != Linux -a "$s" != SunOS ]; then 45 echo "$s: locale command not supported on this system, skipping..." 46 exit 0 47fi 48 49JAVA=$TESTJAVA/bin/java 50 51tolower() { 52 echo "$1" | tr '[A-Z]' '[a-z]' 53} 54 55go() { 56 57 L="$1" 58 shift 59 if [ "x`locale -a | grep \^$L\$`" != "x$L" ]; then 60 echo "$L: Locale not supported, skipping..." 61 return 62 fi 63 64 ecs="$1"; shift 65 66 echo -n "$L: " 67 cs="`LC_ALL=$L $JAVA ${TESTVMOPTS} -cp $TESTCLASSES Default`" 68 if [ $? != 0 ]; then 69 exit 1 70 elif [ "`tolower $cs`" != "`tolower $ecs`" ]; then 71 echo "$cs, expected $ecs -- ERROR" 72 exit 1 73 else 74 echo "$cs, as expected" 75 fi 76 77} 78 79go en_US iso-8859-1 80go ja_JP.utf8 utf-8 81go tr_TR iso-8859-9 82go C us-ascii 83 84if [ "$s" = Linux ]; then 85 go ja_JP x-euc-jp-linux 86 go ja_JP.eucjp x-euc-jp-linux 87 go ja_JP.ujis x-euc-jp-linux 88 go ja_JP.utf8 utf-8 89fi 90 91# Solaris 92if [ "$s" = SunOS ]; then 93 go ja x-eucjp-open 94 go ja_JP.eucJP x-eucjp-open 95 go ja_JP.PCK x-PCK 96 go ja_JP.UTF-8 utf-8 97fi 98