jdk/test/java/lang/System/MacJNUEncoding/MacJNUEncoding.sh
author chegar
Fri, 02 Aug 2013 11:11:03 +0100
changeset 20988 03755a93b83f
parent 16748 ed60b6527f64
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15018
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
     1
#!/bin/sh
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
     2
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
     3
#
16748
ed60b6527f64 8012048: JDK8 b85 source with GPL header errors
katleman
parents: 15254
diff changeset
     4
# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
15018
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
     6
#
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
     9
# published by the Free Software Foundation.
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    10
#
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    15
# accompanied this code).
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    16
#
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    20
#
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    23
# questions.
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    24
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    25
# @test
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    26
# @bug 8003228
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    27
# @summary Test the value of sun.jnu.encoding on Mac
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    28
# @author Brent Christian
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    29
#
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    30
# @run shell MacJNUEncoding.sh
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    31
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    32
# Only run test on Mac
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    33
OS=`uname -s`
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    34
case "$OS" in
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    35
  Darwin )  ;;
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    36
  * )
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    37
    exit 0
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    38
    ;;
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    39
esac
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    40
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    41
if [ "${TESTJAVA}" = "" ]
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    42
then
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    43
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    44
  exit 1
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    45
fi
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    46
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 15018
diff changeset
    47
if [ "${COMPILEJAVA}" = "" ]; then
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 15018
diff changeset
    48
  COMPILEJAVA="${TESTJAVA}"
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 15018
diff changeset
    49
fi
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 15018
diff changeset
    50
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 15018
diff changeset
    51
15018
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    52
if [ "${TESTSRC}" = "" ]
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    53
then
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    54
  echo "TESTSRC not set.  Test cannot execute.  Failed."
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    55
  exit 1
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    56
fi
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    57
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    58
if [ "${TESTCLASSES}" = "" ]
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    59
then
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    60
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    61
  exit 1
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    62
fi
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    63
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 15018
diff changeset
    64
JAVAC="${COMPILEJAVA}"/bin/javac
15018
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    65
JAVA="${TESTJAVA}"/bin/java
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    66
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    67
echo "Building test classes..."
15254
3997a6f357cb 8005978: shell tests need to use the $COMPILEJDK for javac, jar and other tools
alanb
parents: 15018
diff changeset
    68
"$JAVAC" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d "${TESTCLASSES}" "${TESTSRC}"/ExpectedEncoding.java 
15018
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    69
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    70
echo ""
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    71
echo "Running test for C locale"
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    72
export LANG=C
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    73
export LC_ALL=C
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    74
"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding US-ASCII UTF-8
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    75
result1=$?
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    76
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    77
echo ""
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    78
echo "Running test for en_US.UTF-8 locale"
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    79
export LANG=en_US.UTF-8
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    80
export LC_ALL=en_US.UTF-8
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    81
"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding UTF-8 UTF-8
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    82
result2=$?
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    83
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    84
echo ""
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    85
echo "Cleanup"
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    86
rm ${TESTCLASSES}/ExpectedEncoding.class
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    87
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    88
if [ ${result1} -ne 0 ] ; then
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    89
    echo "Test failed for C locale"
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    90
    echo "  LANG=\"${LANG}\""
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    91
    echo "  LC_ALL=\"${LC_ALL}\""
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    92
    exit ${result1}
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    93
fi
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    94
if [ ${result2} -ne 0 ] ; then
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    95
    echo "Test failed for en_US.UTF-8 locale"
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    96
    echo "  LANG=\"${LANG}\""
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    97
    echo "  LC_ALL=\"${LC_ALL}\""
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    98
    exit ${result2}
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
    99
fi
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
   100
exit 0
bb8ed40fd9ec 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments
bchristi
parents:
diff changeset
   101