source: trunk/openjdk/jdk/test/tools/launcher/UnicodeTest.sh

Last change on this file was 278, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b22 from branches/vendor/oracle.

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