6963156: TEST_BUG: Several tests under sun/nio/cs failed
Summary: Updated the test cases and removed them from ProblemList.txt
Reviewed-by: alanb
--- a/jdk/test/ProblemList.txt Mon Jun 21 15:02:47 2010 -0700
+++ b/jdk/test/ProblemList.txt Tue Jun 22 14:04:36 2010 -0400
@@ -533,18 +533,12 @@
# Failed on OpenSolaris, java.lang.AssertionError: Unknown event type
com/sun/nio/sctp/SctpChannel/Receive.java generic-all
-# Triggers a hotspot crash on Fedora 9 32bit -server and Windows X64 samevm
-sun/nio/cs/TestUTF8.java generic-all
-
# Runtime exception on windows X64, samevm mode
java/nio/channels/Selector/WakeupNow.java generic-all
# Occasional errors, solarix x86, address already in use, othervm mode
java/nio/channels/Selector/SelectorTest.java generic-all
-# Fails on Linux Fedora 9 X64
-sun/nio/cs/FindDecoderBugs.java generic-all
-
# Solaris 11 gave assert error and "connection refused", samevm issues?
com/sun/nio/sctp/SctpServerChannel/NonBlockingAccept.java generic-all
@@ -595,9 +589,6 @@
# Fails on all platforms due to overlap of JDK jar file contents:
sun/nio/cs/Test4200310.sh generic-all
-# Depends on motif packages that do not exist all the time:
-sun/nio/cs/TestX11CNS.java generic-all
-
############################################################################
# jdk_rmi
--- a/jdk/test/sun/nio/cs/FindDecoderBugs.java Mon Jun 21 15:02:47 2010 -0700
+++ b/jdk/test/sun/nio/cs/FindDecoderBugs.java Tue Jun 22 14:04:36 2010 -0400
@@ -298,7 +298,7 @@
void testRandomly(byte[] prefix, int n) {
int len = prefix.length;
byte[] ia = Arrays.copyOf(prefix, len + n);
- for (int i = 0; i < 10000; i++) {
+ for (int i = 0; i < 5000; i++) {
for (int j = 0; j < n; j++)
ia[len + j] = randomByte();
test(ia);
@@ -435,6 +435,9 @@
static void equal(Object x, Object y) {
if (x == null ? y == null : x.equals(y)) pass();
else fail(x + " not equal to " + y);}
+ static void equal(int x, int y) {
+ if (x == y) pass();
+ else fail(x + " not equal to " + y);}
public static void main(String[] args) throws Throwable {
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
--- a/jdk/test/sun/nio/cs/TestX11CNS.java Mon Jun 21 15:02:47 2010 -0700
+++ b/jdk/test/sun/nio/cs/TestX11CNS.java Tue Jun 22 14:04:36 2010 -0400
@@ -94,6 +94,8 @@
}
static void compare(Charset newCS, Charset oldCS) throws Exception {
+ if (newCS == null)
+ return; // does not exist on this platform
char[] cc = getChars(newCS, oldCS);
System.out.printf(" Diff <%s> <%s>...%n", newCS.name(), oldCS.name());
@@ -120,14 +122,22 @@
}
}
+ private static Charset getCharset(String czName)
+ throws Exception {
+ try {
+ return (Charset)Class.forName(czName).newInstance();
+ } catch (ClassNotFoundException e){}
+ return null; // does not exist
+ }
+
public static void main(String[] args) throws Exception {
- compare(new sun.awt.motif.X11CNS11643P1(),
+ compare(getCharset("sun.awt.motif.X11CNS11643P1"),
new X11CNS11643P1());
- compare(new sun.awt.motif.X11CNS11643P2(),
+ compare(getCharset("sun.awt.motif.X11CNS11643P2"),
new X11CNS11643P2());
- compare(new sun.awt.motif.X11CNS11643P3(),
+ compare(getCharset("sun.awt.motif.X11CNS11643P3"),
new X11CNS11643P3());
}