From f7eb6cd55615feeda2c28cc38f800dbbfed996af Mon Sep 17 00:00:00 2001 From: Brent Christian Date: Thu, 10 Jan 2013 10:21:44 -0800 Subject: [PATCH] 8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments Test script now sets LC_ALL, other small changes, relocate test Reviewed-by: naoto, alanb --- .../System}/MacJNUEncoding/ExpectedEncoding.java | 4 ++-- .../System}/MacJNUEncoding/MacJNUEncoding.sh | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) rename jdk/test/java/{util/Properties => lang/System}/MacJNUEncoding/ExpectedEncoding.java (97%) rename jdk/test/java/{util/Properties => lang/System}/MacJNUEncoding/MacJNUEncoding.sh (86%) diff --git a/jdk/test/java/util/Properties/MacJNUEncoding/ExpectedEncoding.java b/jdk/test/java/lang/System/MacJNUEncoding/ExpectedEncoding.java similarity index 97% rename from jdk/test/java/util/Properties/MacJNUEncoding/ExpectedEncoding.java rename to jdk/test/java/lang/System/MacJNUEncoding/ExpectedEncoding.java index b8835b8edb7..723d45c677f 100644 --- a/jdk/test/java/util/Properties/MacJNUEncoding/ExpectedEncoding.java +++ b/jdk/test/java/lang/System/MacJNUEncoding/ExpectedEncoding.java @@ -31,6 +31,7 @@ public class ExpectedEncoding { if (args.length != 2) { System.out.println("Usage:"); System.out.println("$ java ExpectedEncoding "); + System.exit(1); } String expectFileEnc = args[0]; String expectSunJnuEnc = args[1]; @@ -49,8 +50,7 @@ public class ExpectedEncoding { failed = true; } if (failed) { - System.err.println("Test Failed"); - System.exit(1); + throw new RuntimeException("Test Failed"); } } } diff --git a/jdk/test/java/util/Properties/MacJNUEncoding/MacJNUEncoding.sh b/jdk/test/java/lang/System/MacJNUEncoding/MacJNUEncoding.sh similarity index 86% rename from jdk/test/java/util/Properties/MacJNUEncoding/MacJNUEncoding.sh rename to jdk/test/java/lang/System/MacJNUEncoding/MacJNUEncoding.sh index 0131467dba1..a03bdd91f17 100644 --- a/jdk/test/java/util/Properties/MacJNUEncoding/MacJNUEncoding.sh +++ b/jdk/test/java/lang/System/MacJNUEncoding/MacJNUEncoding.sh @@ -63,14 +63,16 @@ echo "Building test classes..." "$JAVAC" -d "${TESTCLASSES}" "${TESTSRC}"/ExpectedEncoding.java echo "" -echo "Running test for LANG=C" +echo "Running test for C locale" export LANG=C +export LC_ALL=C "${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding US-ASCII UTF-8 result1=$? echo "" -echo "Running test for LANG=en_US.UTF-8" +echo "Running test for en_US.UTF-8 locale" export LANG=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 "${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding UTF-8 UTF-8 result2=$? @@ -79,11 +81,15 @@ echo "Cleanup" rm ${TESTCLASSES}/ExpectedEncoding.class if [ ${result1} -ne 0 ] ; then - echo "Test failed for LANG=C" + echo "Test failed for C locale" + echo " LANG=\"${LANG}\"" + echo " LC_ALL=\"${LC_ALL}\"" exit ${result1} fi if [ ${result2} -ne 0 ] ; then - echo "Test failed for LANG=en_US.UTF-8" + echo "Test failed for en_US.UTF-8 locale" + echo " LANG=\"${LANG}\"" + echo " LC_ALL=\"${LC_ALL}\"" exit ${result2} fi exit 0