提交 3ade2cbc 编写于 作者: B bchristi

8005962: TEST_BUG: java/util/Properties/MacJNUEncoding can fail in certain environments

Summary: Test script now sets LC_ALL, other small changes, relocate test
Reviewed-by: naoto, alanb
上级 c7dab817
...@@ -31,6 +31,7 @@ public class ExpectedEncoding { ...@@ -31,6 +31,7 @@ public class ExpectedEncoding {
if (args.length != 2) { if (args.length != 2) {
System.out.println("Usage:"); System.out.println("Usage:");
System.out.println("$ java ExpectedEncoding <expected file.encoding> <expected sun.jnu.encoding>"); System.out.println("$ java ExpectedEncoding <expected file.encoding> <expected sun.jnu.encoding>");
System.exit(1);
} }
String expectFileEnc = args[0]; String expectFileEnc = args[0];
String expectSunJnuEnc = args[1]; String expectSunJnuEnc = args[1];
...@@ -49,8 +50,7 @@ public class ExpectedEncoding { ...@@ -49,8 +50,7 @@ public class ExpectedEncoding {
failed = true; failed = true;
} }
if (failed) { if (failed) {
System.err.println("Test Failed"); throw new RuntimeException("Test Failed");
System.exit(1);
} }
} }
} }
...@@ -63,14 +63,16 @@ echo "Building test classes..." ...@@ -63,14 +63,16 @@ echo "Building test classes..."
"$JAVAC" -d "${TESTCLASSES}" "${TESTSRC}"/ExpectedEncoding.java "$JAVAC" -d "${TESTCLASSES}" "${TESTSRC}"/ExpectedEncoding.java
echo "" echo ""
echo "Running test for LANG=C" echo "Running test for C locale"
export LANG=C export LANG=C
export LC_ALL=C
"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding US-ASCII UTF-8 "${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding US-ASCII UTF-8
result1=$? result1=$?
echo "" 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 LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
"${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding UTF-8 UTF-8 "${JAVA}" ${TESTVMOPTS} -classpath "${TESTCLASSES}" ExpectedEncoding UTF-8 UTF-8
result2=$? result2=$?
...@@ -79,11 +81,15 @@ echo "Cleanup" ...@@ -79,11 +81,15 @@ echo "Cleanup"
rm ${TESTCLASSES}/ExpectedEncoding.class rm ${TESTCLASSES}/ExpectedEncoding.class
if [ ${result1} -ne 0 ] ; then 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} exit ${result1}
fi fi
if [ ${result2} -ne 0 ] ; then 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} exit ${result2}
fi fi
exit 0 exit 0
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册