jdk/test/java/nio/charset/Charset/default.sh
changeset 45606 9f69dd961bf3
parent 45605 8d019eee3515
parent 45598 5e0712d61fbc
child 45607 a1fb7c733328
equal deleted inserted replaced
45605:8d019eee3515 45606:9f69dd961bf3
     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 
       
    36 if [ -z "$TESTJAVA" ]; then
       
    37   if [ $# -lt 1 ]; then exit 1; fi
       
    38   TESTJAVA=$1; shift
       
    39   TESTSRC=`pwd`
       
    40   TESTCLASSES=`pwd`
       
    41 fi
       
    42 
       
    43 s="`uname -s`"
       
    44 if [ "$s" != Linux -a "$s" != SunOS ]; then
       
    45   echo "$s: locale command not supported on this system, skipping..."
       
    46   exit 0
       
    47 fi
       
    48 
       
    49 JAVA=$TESTJAVA/bin/java
       
    50 
       
    51 tolower() {
       
    52   echo "$1" | tr '[A-Z]' '[a-z]'
       
    53 }
       
    54 
       
    55 go() {
       
    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 
       
    79 go  en_US       iso-8859-1
       
    80 go  ja_JP.utf8  utf-8
       
    81 go  tr_TR       iso-8859-9
       
    82 go  C           us-ascii
       
    83 
       
    84 if [ "$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
       
    89 fi
       
    90 
       
    91 # Solaris
       
    92 if [ "$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
       
    97 fi