6934923: test/java/net/ipv6tests/TcpTest.java hangs on Solaris 10

Reviewed-by: alanb
This commit is contained in:
Chris Hegarty 2010-03-16 10:05:51 +00:00
parent 7fbd8c28c1
commit f2034e6bba
2 changed files with 29 additions and 12 deletions

View file

@ -47,9 +47,11 @@ public class TcpTest extends Tests {
try { try {
ia4any = InetAddress.getByName ("0.0.0.0"); ia4any = InetAddress.getByName ("0.0.0.0");
ia6any = InetAddress.getByName ("::0"); ia6any = InetAddress.getByName ("::0");
int scope = ia6addr.getScopeId(); if (ia6addr != null) {
if (scope != 0) { int scope = ia6addr.getScopeId();
ia6bad = InetAddress.getByName ("fe80::1:2:3:4:5:6%"+scope); if (scope != 0) {
ia6bad = InetAddress.getByName ("fe80::1:2:3:4:5:6%"+scope);
}
} else { } else {
ia6bad = InetAddress.getByName ("fe80::1:2:3:4:5:6"); ia6bad = InetAddress.getByName ("fe80::1:2:3:4:5:6");
} }

View file

@ -38,12 +38,25 @@ public class Tests {
OutputStream o1 = s1.getOutputStream(); OutputStream o1 = s1.getOutputStream();
OutputStream o2 = s2.getOutputStream(); OutputStream o2 = s2.getOutputStream();
simpleWrite (o1, 100); startSimpleWriter("SimpleWriter-1", o1, 100);
simpleWrite (o2, 200); startSimpleWriter("SimpleWriter-2", o2, 200);
simpleRead (i2, 100); simpleRead (i2, 100);
simpleRead (i1, 200); simpleRead (i1, 200);
} }
static void startSimpleWriter(String threadName, final OutputStream os, final int start) {
(new Thread(new Runnable() {
public void run() {
try { simpleWrite(os, start); }
catch (Exception e) {unexpected(e); }
}}, threadName)).start();
}
static void unexpected(Exception e ) {
System.out.println("Unexcepted Exception: " + e);
e.printStackTrace();
}
/** /**
* Send a packet from s1 to s2 (ia2/s2.localPort) and check it * Send a packet from s1 to s2 (ia2/s2.localPort) and check it
* Send a packet from s2 to s1 (ia1/s1.localPort) and check it * Send a packet from s2 to s1 (ia1/s1.localPort) and check it
@ -247,13 +260,15 @@ public class Tests {
} }
private NetworkInterface getNextIf () { private NetworkInterface getNextIf () {
while (ifs.hasMoreElements()) { if (ifs != null) {
NetworkInterface nic = (NetworkInterface)ifs.nextElement(); while (ifs.hasMoreElements()) {
try { NetworkInterface nic = (NetworkInterface)ifs.nextElement();
if (nic.isUp() && !nic.isLoopback()) try {
return nic; if (nic.isUp() && !nic.isLoopback())
} catch (SocketException e) { return nic;
// ignore } catch (SocketException e) {
// ignore
}
} }
} }