From 182841c338dc67a3dc94f94af9cb79dfa26a394f Mon Sep 17 00:00:00 2001 From: sherman Date: Tue, 22 Jun 2010 14:04:36 -0400 Subject: [PATCH] 6963156: TEST_BUG: Several tests under sun/nio/cs failed Summary: Updated the test cases and removed them from ProblemList.txt Reviewed-by: alanb --- test/ProblemList.txt | 9 --------- test/sun/nio/cs/FindDecoderBugs.java | 5 ++++- test/sun/nio/cs/TestX11CNS.java | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/test/ProblemList.txt b/test/ProblemList.txt index 76d34d85b..4a5abd15b 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -533,18 +533,12 @@ com/sun/nio/sctp/SctpChannel/Bind.java generic-all # 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 @@ java/nio/channels/SocketChannel/FinishConnect.java windows-all # 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 diff --git a/test/sun/nio/cs/FindDecoderBugs.java b/test/sun/nio/cs/FindDecoderBugs.java index 2e52e6018..f0f9d258b 100644 --- a/test/sun/nio/cs/FindDecoderBugs.java +++ b/test/sun/nio/cs/FindDecoderBugs.java @@ -298,7 +298,7 @@ public class FindDecoderBugs { 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 @@ public class FindDecoderBugs { 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); diff --git a/test/sun/nio/cs/TestX11CNS.java b/test/sun/nio/cs/TestX11CNS.java index 5ba3c8b39..9d276a8ef 100644 --- a/test/sun/nio/cs/TestX11CNS.java +++ b/test/sun/nio/cs/TestX11CNS.java @@ -94,6 +94,8 @@ public class TestX11CNS { } 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 @@ public class TestX11CNS { } } + 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()); } -- GitLab