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
|
---|
31 | if [ "${TESTJAVA}" = "" ]
|
---|
32 | then
|
---|
33 | echo "TESTJAVA not set. Test cannot execute. Failed."
|
---|
34 | exit 1
|
---|
35 | fi
|
---|
36 |
|
---|
37 | if [ "${TESTSRC}" = "" ]
|
---|
38 | then
|
---|
39 | echo "TESTSRC not set. Test cannot execute. Failed."
|
---|
40 | exit 1
|
---|
41 | fi
|
---|
42 |
|
---|
43 | if [ "${TESTCLASSES}" = "" ]
|
---|
44 | then
|
---|
45 | echo "TESTCLASSES not set. Test cannot execute. Failed."
|
---|
46 | exit 1
|
---|
47 | fi
|
---|
48 |
|
---|
49 | JAVAC="${TESTJAVA}"/bin/javac
|
---|
50 | JAVA="${TESTJAVA}"/bin/java
|
---|
51 | JAR="${TESTJAVA}"/bin/jar
|
---|
52 |
|
---|
53 | mkdir UnicodeTest-src UnicodeTest-classes
|
---|
54 |
|
---|
55 | echo "creating test source files"
|
---|
56 | "$JAVAC" -d . "${TESTSRC}"/UnicodeTest.java
|
---|
57 | CLASS_NAME=`"$JAVA" UnicodeTest`
|
---|
58 |
|
---|
59 | if [ "$CLASS_NAME" = "" ]
|
---|
60 | then
|
---|
61 | echo "CLASS_NAME not generated. Test failed."
|
---|
62 | exit 1
|
---|
63 | fi
|
---|
64 |
|
---|
65 | echo "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 |
|
---|
71 | echo "running test app using class file"
|
---|
72 | "$JAVA" -classpath UnicodeTest-classes "$CLASS_NAME" || exit 1
|
---|
73 |
|
---|
74 | echo "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 |
|
---|
80 | echo "running test app using newly built jar file"
|
---|
81 | "$JAVA" -jar UnicodeTest.jar || exit 1
|
---|
82 |
|
---|
83 | echo "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
|
---|
89 | if test -n "`locale -a 2>/dev/null | grep '^C$'`"
|
---|
90 | then
|
---|
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
|
---|
99 | fi
|
---|
100 |
|
---|
101 | exit 0
|
---|
102 |
|
---|