jdk/test/tools/launcher/UnicodeTest.sh
author ohair
Tue, 28 Dec 2010 15:53:50 -0800
changeset 7668 d4a77089c587
parent 5999 035006c50f21
permissions -rw-r--r--
6962318: Update copyright year Reviewed-by: xdono
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7668
d4a77089c587 6962318: Update copyright year
ohair
parents: 5999
diff changeset
     1
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
# published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4663
diff changeset
    18
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4663
diff changeset
    19
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4663
diff changeset
    20
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
# @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
# @bug 5030265
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
# @summary Verify that the J2RE can handle all legal Unicode characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
#          in class names unless limited by the file system encoding
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#          or the encoding used for command line arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
# @author Norbert Lindenberg
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
# Verify directory context variables are set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
if [ "${TESTJAVA}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
  echo "TESTJAVA not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
if [ "${TESTSRC}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
  echo "TESTSRC not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
if [ "${TESTCLASSES}" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
  echo "TESTCLASSES not set.  Test cannot execute.  Failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
JAVAC="${TESTJAVA}"/bin/javac
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
JAVA="${TESTJAVA}"/bin/java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
JAR="${TESTJAVA}"/bin/jar
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
mkdir UnicodeTest-src UnicodeTest-classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
echo "creating test source files"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
"$JAVAC" -d . "${TESTSRC}"/UnicodeTest.java
5999
035006c50f21 6954517: Testcase failure tools/launcher/UnicodeTest.sh
ohair
parents: 5506
diff changeset
    57
if [ "`uname -s | grep CYGWIN`" != "" ] ; then
035006c50f21 6954517: Testcase failure tools/launcher/UnicodeTest.sh
ohair
parents: 5506
diff changeset
    58
  CLASS_NAME=`"$JAVA" UnicodeTest | sed -e 's@\\r@@g' `
035006c50f21 6954517: Testcase failure tools/launcher/UnicodeTest.sh
ohair
parents: 5506
diff changeset
    59
else
035006c50f21 6954517: Testcase failure tools/launcher/UnicodeTest.sh
ohair
parents: 5506
diff changeset
    60
  CLASS_NAME=`"$JAVA" UnicodeTest`
035006c50f21 6954517: Testcase failure tools/launcher/UnicodeTest.sh
ohair
parents: 5506
diff changeset
    61
fi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
if [ "$CLASS_NAME" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
  echo "CLASS_NAME not generated.  Test failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
echo "building test apps"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
"$JAVAC" -encoding UTF-8 -sourcepath UnicodeTest-src \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    -d UnicodeTest-classes UnicodeTest-src/"${CLASS_NAME}".java || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
"$JAR" -cvfm UnicodeTest.jar UnicodeTest-src/MANIFEST.MF \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    -C UnicodeTest-classes . || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
echo "running test app using class file"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
"$JAVA" -classpath UnicodeTest-classes "$CLASS_NAME" || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
echo "delete generated files with non-ASCII names"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
# do it now because on Unix they may not be accessible when locale changes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
# do it in Java because shells on Windows can't handle full Unicode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
"$JAVAC" -d . "${TESTSRC}"/UnicodeCleanup.java || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
"$JAVA" UnicodeCleanup UnicodeTest-src UnicodeTest-classes || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
echo "running test app using newly built jar file"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
"$JAVA" -jar UnicodeTest.jar || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
echo "running test app using jar file built in Solaris UTF-8 locale"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
"$JAVA" -jar "${TESTSRC}"/UnicodeTest.jar || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
# if we can switch to a C locale, then test whether jar files with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
# non-ASCII characters in the manifest still work in this crippled
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
# environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
if test -n "`locale -a 2>/dev/null | grep '^C$'`"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    LC_ALL=C
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    export LC_ALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    echo "running test app using newly built jar file in C locale"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    "$JAVA" -jar UnicodeTest.jar || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    echo "running test app using premade jar file in C locale"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    "$JAVA" -jar "${TESTSRC}"/UnicodeTest.jar || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
exit 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106