jdk/test/tools/launcher/UnicodeTest.sh
author ksrini
Fri, 20 Nov 2009 11:01:32 -0800
changeset 4340 ec6ba551fa78
parent 2 90ce3da70b43
child 4663 dfea6ffdb0dc
permissions -rw-r--r--
6367077: Purge LD_LIBRARY_PATH usage from the launcher 6899834: (launcher) remove the solaris libjvm.so symlink Summary: Fixes other related issues as well. Reviewed-by: darcy, ohair, xlu, martin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
# Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
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
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
# have any questions.
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
CLASS_NAME=`"$JAVA" UnicodeTest`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
if [ "$CLASS_NAME" = "" ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
  echo "CLASS_NAME not generated.  Test failed."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
  exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
echo "building test apps"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
"$JAVAC" -encoding UTF-8 -sourcepath UnicodeTest-src \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    -d UnicodeTest-classes UnicodeTest-src/"${CLASS_NAME}".java || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
"$JAR" -cvfm UnicodeTest.jar UnicodeTest-src/MANIFEST.MF \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    -C UnicodeTest-classes . || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
echo "running test app using class file"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
"$JAVA" -classpath UnicodeTest-classes "$CLASS_NAME" || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
echo "delete generated files with non-ASCII names"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
# do it now because on Unix they may not be accessible when locale changes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
# do it in Java because shells on Windows can't handle full Unicode
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
"$JAVAC" -d . "${TESTSRC}"/UnicodeCleanup.java || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
"$JAVA" UnicodeCleanup UnicodeTest-src UnicodeTest-classes || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
echo "running test app using newly built jar file"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
"$JAVA" -jar UnicodeTest.jar || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
echo "running test app using jar file built in Solaris UTF-8 locale"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
"$JAVA" -jar "${TESTSRC}"/UnicodeTest.jar || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
# if we can switch to a C locale, then test whether jar files with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
# non-ASCII characters in the manifest still work in this crippled
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
# environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
if test -n "`locale -a 2>/dev/null | grep '^C$'`"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    LC_ALL=C
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    export LC_ALL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    echo "running test app using newly built jar file in C locale"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    "$JAVA" -jar UnicodeTest.jar || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    echo "running test app using premade jar file in C locale"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    "$JAVA" -jar "${TESTSRC}"/UnicodeTest.jar || exit 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
exit 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102