Submitted By: DJ Lucas <dj AT linuxfromscratch DOT org>
Date: 2010-09-08
Initial Package Version: 1.9
Upstream Status: pending review
Origin: http://icedtea.classpath.org/hg/icedtea/ and self
Description: Corrects one test with upstream testcase and disable tests with
             known failures on JDK6.

diff -Naurp icedtea6-1.9-orig/Makefile.am icedtea6-1.9/Makefile.am
--- icedtea6-1.9-orig/Makefile.am	2010-09-07 18:31:51.000000000 -0500
+++ icedtea6-1.9/Makefile.am	2010-09-07 18:43:30.000000000 -0500
@@ -292,7 +292,8 @@ ICEDTEA_PATCHES = \
 	patches/icedtea-too-many-args.patch \
 	patches/icedtea-jtreg-OpenGLContextInit.patch \
 	patches/openjdk/6969395-net_bugs.patch \
-	patches/openjdk/6510892-httpserver_test.patch
+	patches/openjdk/6510892-httpserver_test.patch \
+	patches/openjdk/4742177-fix_no_loopback_test.patch
 
 if WITH_RHINO
 ICEDTEA_PATCHES += \
@@ -2031,6 +2032,7 @@ check-langtools: stamps/jtreg.stamp
 		-w:test/langtools/JTwork -r:test/langtools/JTreport \
 		$${ICEDTEA_JTREG_OTHERVM:--samevm} \
 		-jdk:$(BUILD_OUTPUT_DIR)/j2sdk-image \
+	        -exclude:$(abs_top_srcdir)/test/jtreg/excludelist.langtools.jtx \
 		$(ICEDTEA_JTREG_OPTIONS) \
 		`pwd`/openjdk/langtools/test \
 	    | tee test/$@.log
diff -Naurp icedtea6-1.9-orig/Makefile.in icedtea6-1.9/Makefile.in
--- icedtea6-1.9-orig/Makefile.in	2010-09-07 18:31:51.000000000 -0500
+++ icedtea6-1.9/Makefile.in	2010-09-07 18:43:53.000000000 -0500
@@ -595,11 +595,12 @@ ICEDTEA_PATCHES = patches/shark_do_nothi
 	patches/icedtea-too-many-args.patch \
 	patches/icedtea-jtreg-OpenGLContextInit.patch \
 	patches/openjdk/6969395-net_bugs.patch \
-	patches/openjdk/6510892-httpserver_test.patch $(am__append_1) \
-	$(am__append_2) $(am__append_3) $(am__append_4) \
-	$(am__append_5) $(am__append_6) $(am__append_7) \
-	$(am__append_8) $(am__append_9) $(am__append_10) \
-	$(am__append_11) $(DISTRIBUTION_PATCHES)
+	patches/openjdk/6510892-httpserver_test.patch \
+	patches/openjdk/4742177-fix_no_loopback_test.patch \
+	$(am__append_1) $(am__append_2) $(am__append_3) \
+	$(am__append_4) $(am__append_5) $(am__append_6) \
+	$(am__append_7) $(am__append_8) $(am__append_9) \
+	$(am__append_10) $(am__append_11) $(DISTRIBUTION_PATCHES)
 
 # Bootstrapping patches
 ICEDTEA_ECJ_PATCHES = patches/ecj/icedtea.patch \
@@ -2393,6 +2394,7 @@ check-langtools: stamps/jtreg.stamp
 		-w:test/langtools/JTwork -r:test/langtools/JTreport \
 		$${ICEDTEA_JTREG_OTHERVM:--samevm} \
 		-jdk:$(BUILD_OUTPUT_DIR)/j2sdk-image \
+	        -exclude:$(abs_top_srcdir)/test/jtreg/excludelist.langtools.jtx \
 		$(ICEDTEA_JTREG_OPTIONS) \
 		`pwd`/openjdk/langtools/test \
 	    | tee test/$@.log
diff -Naurp icedtea6-1.9-orig/patches/openjdk/4742177-fix_no_loopback_test.patch icedtea6-1.9/patches/openjdk/4742177-fix_no_loopback_test.patch
--- icedtea6-1.9-orig/patches/openjdk/4742177-fix_no_loopback_test.patch	1969-12-31 18:00:00.000000000 -0600
+++ icedtea6-1.9/patches/openjdk/4742177-fix_no_loopback_test.patch	2010-09-07 18:43:30.000000000 -0500
@@ -0,0 +1,418 @@
+--- openjdk/jdk/test/java/net/MulticastSocket/NoLoopbackPackets.java	2010-06-21 16:15:53.000000000 -0500
++++ openjdk/jdk/test/java/net/MulticastSocket/NoLoopbackPackets.java	2010-08-31 02:41:01.000000000 -0500
+@@ -29,9 +29,7 @@
+ import java.util.*;
+ import java.net.*;
+ 
+-
+ public class NoLoopbackPackets {
+-    private static int PORT = 9001;
+     private static String osname;
+ 
+     static boolean isWindows() {
+@@ -68,40 +66,47 @@ public class NoLoopbackPackets {
+             return;
+         }
+ 
+-        // we will send packets to three multicast groups :-
+-        // 224.1.1.1, ::ffff:224.1.1.2, and ff02::1:1
+-        //
+-        List<SocketAddress> groups = new ArrayList<SocketAddress>();
+-        groups.add(new InetSocketAddress(InetAddress.getByName("224.1.1.1"), PORT));
+-        groups.add(new InetSocketAddress(InetAddress.getByName("::ffff:224.1.1.2"), PORT));
+-        groups.add(new InetSocketAddress(InetAddress.getByName("ff02::1:1"), PORT));
+-
+-        Thread sender = new Thread(new Sender(groups));
+-        sender.setDaemon(true); // we want sender to stop when main thread exits
+-        sender.start();
+-
+-        // Now try to receive multicast packets. we should not see any of them
+-        // since we disable loopback mode.
+-        //
+-        MulticastSocket msock = new MulticastSocket(PORT);
+-        msock.setSoTimeout(5000);       // 5 seconds
+-
+-        byte[] buf = new byte[1024];
+-        DatagramPacket packet = new DatagramPacket(buf, 0, buf.length);
++        MulticastSocket msock = null;
+         List<SocketAddress> failedGroups = new ArrayList<SocketAddress>();
+-        for (SocketAddress group : groups) {
+-            msock.joinGroup(group, null);
++        try {
++            msock = new MulticastSocket();
++            int port = msock.getLocalPort();
+ 
+-            try {
+-                msock.receive(packet);
++            // we will send packets to three multicast groups :-
++            // 224.1.1.1, ::ffff:224.1.1.2, and ff02::1:1
++            //
++            List<SocketAddress> groups = new ArrayList<SocketAddress>();
++            groups.add(new InetSocketAddress(InetAddress.getByName("224.1.1.1"), port));
++            groups.add(new InetSocketAddress(InetAddress.getByName("::ffff:224.1.1.2"), port));
++            groups.add(new InetSocketAddress(InetAddress.getByName("ff02::1:1"), port));
++
++            Thread sender = new Thread(new Sender(groups));
++            sender.setDaemon(true); // we want sender to stop when main thread exits
++            sender.start();
++
++            // Now try to receive multicast packets. we should not see any of them
++            // since we disable loopback mode.
++            //
++            msock.setSoTimeout(5000);       // 5 seconds
++
++            byte[] buf = new byte[1024];
++            DatagramPacket packet = new DatagramPacket(buf, 0, buf.length);
++            for (SocketAddress group : groups) {
++                msock.joinGroup(group, null);
++
++                try {
++                    msock.receive(packet);
++
++                    // it is an error if we receive something
++                    failedGroups.add(group);
++                } catch (SocketTimeoutException e) {
++                    // we expect this
++                }
+ 
+-                // it is an error if we receive something
+-                failedGroups.add(group);
+-            } catch (SocketTimeoutException e) {
+-                // we expect this
++                msock.leaveGroup(group, null);
+             }
+-
+-            msock.leaveGroup(group, null);
++        } finally {
++            if (msock != null) try { msock.close(); } catch (Exception e) {}
+         }
+ 
+         if (failedGroups.size() > 0) {
+@@ -111,36 +116,36 @@ public class NoLoopbackPackets {
+             throw new RuntimeException("test failed.");
+         }
+     }
+-}
+-
+-class Sender implements Runnable {
+-    private List<SocketAddress> sendToGroups;
+ 
+-    public Sender(List<SocketAddress> groups) {
+-        sendToGroups = groups;
+-    }
++    static class Sender implements Runnable {
++        private List<SocketAddress> sendToGroups;
+ 
+-    public void run() {
+-        byte[] buf = "hello world".getBytes();
+-        List<DatagramPacket> packets = new ArrayList<DatagramPacket>();
++        public Sender(List<SocketAddress> groups) {
++            sendToGroups = groups;
++        }
+ 
+-        try {
+-            for (SocketAddress group : sendToGroups) {
+-                DatagramPacket packet = new DatagramPacket(buf, buf.length, group);
+-                packets.add(packet);
+-            }
++        public void run() {
++            byte[] buf = "hello world".getBytes();
++            List<DatagramPacket> packets = new ArrayList<DatagramPacket>();
+ 
+-            MulticastSocket msock = new MulticastSocket();
+-            msock.setLoopbackMode(true);    // disable loopback mode
+-            for (;;) {
+-                for (DatagramPacket packet : packets) {
+-                    msock.send(packet);
++            try {
++                for (SocketAddress group : sendToGroups) {
++                    DatagramPacket packet = new DatagramPacket(buf, buf.length, group);
++                    packets.add(packet);
+                 }
+ 
+-                Thread.currentThread().sleep(1000);     // 1 second
++                MulticastSocket msock = new MulticastSocket();
++                msock.setLoopbackMode(true);    // disable loopback mode
++                for (;;) {
++                    for (DatagramPacket packet : packets) {
++                        msock.send(packet);
++                    }
++
++                    Thread.sleep(1000);     // 1 second
++                }
++            } catch (Exception e) {
++                throw new RuntimeException(e);
+             }
+-        } catch (Exception e) {
+-            throw new RuntimeException(e);
+         }
+     }
+ }
+--- openjdk/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java	2010-06-21 16:15:53.000000000 -0500
++++ openjdk/jdk/test/java/net/MulticastSocket/SetOutgoingIf.java	2010-08-31 02:41:01.000000000 -0500
+@@ -67,38 +67,65 @@ public class SetOutgoingIf {
+ 
+         // We need 2 or more network interfaces to run the test
+         //
+-        List<NetworkInterface> nics = new ArrayList<NetworkInterface>();
++        List<NetIf> netIfs = new ArrayList<NetIf>();
++        int index = 1;
+         for (NetworkInterface nic : Collections.list(NetworkInterface.getNetworkInterfaces())) {
+             // we should use only network interfaces with multicast support which are in "up" state
+-            if (!nic.isLoopback() && nic.supportsMulticast() && nic.isUp())
+-                nics.add(nic);
++            if (!nic.isLoopback() && nic.supportsMulticast() && nic.isUp()) {
++                NetIf netIf = NetIf.create(nic);
++
++                // now determine what (if any) type of addresses are assigned to this interface
++                for (InetAddress addr : Collections.list(nic.getInetAddresses())) {
++                    if (addr.isAnyLocalAddress())
++                        continue;
++
++                    System.out.println("    addr " + addr);
++                    if (addr instanceof Inet4Address) {
++                        netIf.ipv4Address(true);
++                    } else if (addr instanceof Inet6Address) {
++                        netIf.ipv6Address(true);
++                    }
++                }
++                if (netIf.ipv4Address() || netIf.ipv6Address()) {
++                    netIf.index(index++);
++                    netIfs.add(netIf);
++                    debug("Using: " + nic);
++                }
++            }
+         }
+-        if (nics.size() <= 1) {
++        if (netIfs.size() <= 1) {
+             System.out.println("Need 2 or more network interfaces to run. Bye.");
+             return;
+         }
+ 
+-        // We will send packets to one ipv4, one ipv4-mapped, and one ipv6
++        // We will send packets to one ipv4, and one ipv6
+         // multicast group using each network interface :-
+         //      224.1.1.1        --|
+-        //      ::ffff:224.1.1.2 -----> using network interface #1
+-        //      ff02::1:1        --|
++        //      ff02::1:1        --|--> using network interface #1
+         //      224.1.2.1        --|
+-        //      ::ffff:224.1.2.2 -----> using network interface #2
+-        //      ff02::1:2        --|
++        //      ff02::1:2        --|--> using network interface #2
+         // and so on.
+         //
+-        List<InetAddress> groups = new ArrayList<InetAddress>();
+-        for (int i = 0; i < nics.size(); i++) {
+-            InetAddress groupv4 = InetAddress.getByName("224.1." + (i+1) + ".1");
+-            InetAddress groupv4mapped = InetAddress.getByName("::ffff:224.1." + (i+1) + ".2");
+-            InetAddress groupv6 = InetAddress.getByName("ff02::1:" + (i+1));
+-            groups.add(groupv4);
+-            groups.add(groupv4mapped);
+-            groups.add(groupv6);
++        for (NetIf netIf : netIfs) {
++            int NetIfIndex = netIf.index();
++            List<InetAddress> groups = new ArrayList<InetAddress>();
++
++            if (netIf.ipv4Address()) {
++                InetAddress groupv4 = InetAddress.getByName("224.1." + NetIfIndex + ".1");
++                groups.add(groupv4);
++            }
++            if (netIf.ipv6Address()) {
++                InetAddress groupv6 = InetAddress.getByName("ff02::1:" + NetIfIndex);
++                groups.add(groupv6);
++            }
++
++            debug("Adding " + groups + " groups for " + netIf.nic().getName());
++            netIf.groups(groups);
+ 
+-            // use a separated thread to send to those 3 groups
+-            Thread sender = new Thread(new Sender(nics.get(i), groupv4, groupv4mapped, groupv6, PORT));
++            // use a separated thread to send to those 2 groups
++            Thread sender = new Thread(new Sender(netIf,
++                                                  groups,
++                                                  PORT));
+             sender.setDaemon(true); // we want sender to stop when main thread exits
+             sender.start();
+         }
+@@ -107,70 +134,76 @@ public class SetOutgoingIf {
+         // from the expected network interface
+         //
+         byte[] buf = new byte[1024];
+-        for (InetAddress group : groups) {
+-        MulticastSocket mcastsock = new MulticastSocket(PORT);
+-        mcastsock.setSoTimeout(5000);   // 5 second
+-            DatagramPacket packet = new DatagramPacket(buf, 0, buf.length);
+-
+-            mcastsock.joinGroup(new InetSocketAddress(group, PORT), nics.get(groups.indexOf(group) / 3));
+-
+-            try {
+-                mcastsock.receive(packet);
+-            } catch (Exception e) {
+-                // test failed if any exception
+-                throw new RuntimeException(e);
+-            }
+-
+-            // now check which network interface this packet comes from
+-            NetworkInterface from = NetworkInterface.getByInetAddress(packet.getAddress());
+-            NetworkInterface shouldbe = nics.get(groups.indexOf(group) / 3);
+-            if (!from.equals(shouldbe)) {
+-                System.out.println("Packets on group "
+-                                    + group + " should come from "
+-                                    + shouldbe.getName() + ", but came from "
+-                                    + from.getName());
+-                //throw new RuntimeException("Test failed.");
+-            }
++        for (NetIf netIf : netIfs) {
++            NetworkInterface nic = netIf.nic();
++            for (InetAddress group : netIf.groups()) {
++                MulticastSocket mcastsock = new MulticastSocket(PORT);
++                mcastsock.setSoTimeout(5000);   // 5 second
++                DatagramPacket packet = new DatagramPacket(buf, 0, buf.length);
++
++                // the interface supports the IP multicast group
++                debug("Joining " + group + " on " + nic.getName());
++                mcastsock.joinGroup(new InetSocketAddress(group, PORT), nic);
++
++                try {
++                    mcastsock.receive(packet);
++                    debug("received packet on " + packet.getAddress());
++                } catch (Exception e) {
++                    // test failed if any exception
++                    throw new RuntimeException(e);
++                }
++
++                // now check which network interface this packet comes from
++                NetworkInterface from = NetworkInterface.getByInetAddress(packet.getAddress());
++                NetworkInterface shouldbe = nic;
++                if (!from.equals(shouldbe)) {
++                    System.out.println("Packets on group "
++                                        + group + " should come from "
++                                        + shouldbe.getName() + ", but came from "
++                                        + from.getName());
++                    //throw new RuntimeException("Test failed.");
++                }
+ 
+-            mcastsock.leaveGroup(new InetSocketAddress(group, PORT), nics.get(groups.indexOf(group) / 3));
++                mcastsock.leaveGroup(new InetSocketAddress(group, PORT), nic);
++            }
+         }
+     }
++
++    private static boolean debug = true;
++
++    static void debug(String message) {
++        if (debug)
++            System.out.println(message);
++    }
+ }
+ 
+ class Sender implements Runnable {
+-    private NetworkInterface nic;
+-    private InetAddress group1;
+-    private InetAddress group2;
+-    private InetAddress group3;
++    private NetIf netIf;
++    private List<InetAddress> groups;
+     private int port;
+ 
+-    public Sender(NetworkInterface nic,
+-                    InetAddress groupv4, InetAddress groupv4mapped, InetAddress groupv6,
+-                    int port) {
+-        this.nic = nic;
+-        group1 = groupv4;
+-        group2 = groupv4mapped;
+-        group3 = groupv6;
++    public Sender(NetIf netIf,
++                  List<InetAddress> groups,
++                  int port) {
++        this.netIf = netIf;
++        this.groups = groups;
+         this.port = port;
+     }
+ 
+     public void run() {
+         try {
+             MulticastSocket mcastsock = new MulticastSocket();
+-            mcastsock.setNetworkInterface(nic);
++            mcastsock.setNetworkInterface(netIf.nic());
++            List<DatagramPacket> packets = new LinkedList<DatagramPacket>();
+ 
+             byte[] buf = "hello world".getBytes();
+-            DatagramPacket packet1 = new DatagramPacket(buf, buf.length,
+-                                        new InetSocketAddress(group1, port));
+-            DatagramPacket packet2 = new DatagramPacket(buf, buf.length,
+-                                        new InetSocketAddress(group2, port));
+-            DatagramPacket packet3 = new DatagramPacket(buf, buf.length,
+-                                        new InetSocketAddress(group3, port));
++            for (InetAddress group : groups) {
++                packets.add(new DatagramPacket(buf, buf.length, new InetSocketAddress(group, port)));
++            }
+ 
+             for (;;) {
+-                mcastsock.send(packet1);
+-                mcastsock.send(packet2);
+-                mcastsock.send(packet3);
++                for (DatagramPacket packet : packets)
++                    mcastsock.send(packet);
+ 
+                 Thread.sleep(1000);   // sleep 1 second
+             }
+@@ -179,3 +212,57 @@ class Sender implements Runnable {
+         }
+     }
+ }
++
++@SuppressWarnings("unchecked")
++class NetIf {
++    private boolean ipv4Address; //false
++    private boolean ipv6Address; //false
++    private int index;
++    List<InetAddress> groups = Collections.EMPTY_LIST;
++    private final NetworkInterface nic;
++
++    private NetIf(NetworkInterface nic) {
++        this.nic = nic;
++    }
++
++    static NetIf create(NetworkInterface nic) {
++        return new NetIf(nic);
++    }
++
++    NetworkInterface nic() {
++        return nic;
++    }
++
++    boolean ipv4Address() {
++        return ipv4Address;
++    }
++
++    void ipv4Address(boolean ipv4Address) {
++        this.ipv4Address = ipv4Address;
++    }
++
++    boolean ipv6Address() {
++        return ipv6Address;
++    }
++
++    void ipv6Address(boolean ipv6Address) {
++        this.ipv6Address = ipv6Address;
++    }
++
++    int index() {
++        return index;
++    }
++
++    void index(int index) {
++        this.index = index;
++    }
++
++    List<InetAddress> groups() {
++        return groups;
++    }
++
++    void groups(List<InetAddress> groups) {
++        this.groups = groups;
++    }
++}
++
diff -Naurp icedtea6-1.9-orig/test/jtreg/excludelist.jdk.jtx icedtea6-1.9/test/jtreg/excludelist.jdk.jtx
--- icedtea6-1.9-orig/test/jtreg/excludelist.jdk.jtx	2010-08-06 06:05:39.000000000 -0500
+++ icedtea6-1.9/test/jtreg/excludelist.jdk.jtx	2010-09-07 18:43:30.000000000 -0500
@@ -27,3 +27,30 @@ java/nio/channels/DatagramChannel/AdaptD
 # test checks a bug in CUPS/PostScript that has been fixed
 # see https://bugs.openjdk.java.net/show_bug.cgi?id=100022
 javax/print/attribute/PSCopiesFlavorTest.java
+
+#
+# Expected failures on OpenJDK6
+#
+java/awt/Focus/ActualFocusedWindowTest/ActualFocusedWindowRetaining.java
+java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java
+java/awt/font/TextLayout/TextLayoutBounds.java
+java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java
+java/awt/Graphics2D/DrawString/RotTransText.java
+java/awt/Insets/WindowWithWarningTest/WindowWithWarningTest.html
+java/awt/Mouse/TitleBarDoubleClick/TitleBarDoubleClick.html
+java/awt/print/PrinterJob/ExceptionTest.java
+java/awt/xembed/server/RunTestXEmbed.java
+java/beans/XMLEncoder/javax_swing_tree_TreePath.java
+java/nio/charset/Charset/NIOCharsetAvailabilityTest.java
+javax/swing/plaf/synth/Test6933784.java
+sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java
+sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java
+sun/java2d/cmm/ColorConvertOp/MTColConvTest.java
+sun/java2d/DirectX/OnScreenRenderingResizeTest/OnScreenRenderingResizeTest.java
+sun/java2d/OpenGL/GradientPaints.java
+sun/java2d/SunGraphics2D/PolyVertTest.java
+sun/nio/cs/Test4200310.sh
+sun/nio/cs/TestSJIS0213.java
+sun/security/validator/CertReplace.java
+tools/launcher/MultipleJRE.sh
+
diff -Naurp icedtea6-1.9-orig/test/jtreg/excludelist.langtools.jtx icedtea6-1.9/test/jtreg/excludelist.langtools.jtx
--- icedtea6-1.9-orig/test/jtreg/excludelist.langtools.jtx	1969-12-31 18:00:00.000000000 -0600
+++ icedtea6-1.9/test/jtreg/excludelist.langtools.jtx	2010-09-07 18:43:30.000000000 -0500
@@ -0,0 +1,10 @@
+# Exclude list for langtools tests. These tests are incorrect/obsolete, or
+# require special setup.
+
+#
+# Require Special Setup
+#
+
+# Requires jtreg 4.1
+tools/javac/processing/6499119/ClassProcessor.java
+
