8247463: java/nio/channels/etc/OpenAndConnect.java fails due to IPv6 not available

Reviewed-by: dfuchs, alanb
This commit is contained in:
Jie Fu 2020-06-13 14:29:08 +08:00
parent ca85c5ab15
commit fd7123b268

View File

@ -94,12 +94,23 @@ public class OpenAndConnect {
@DataProvider(name = "openConnect")
public Object[][] openConnect() {
LinkedList<Object[]> l = new LinkedList<>();
l.addAll(openConnectGenTests);
if (IA4LOCAL != null) {
l.addAll(openConnectV4LocalTests);
if (IPSupport.hasIPv4()) {
l.addAll(openConnectV4Tests);
if (IA4LOCAL != null) {
l.addAll(openConnectV4LocalTests);
}
}
if (IA6LOCAL != null) {
l.addAll(openConnectV6LocalTests);
if (IPSupport.hasIPv6()) {
l.addAll(openConnectV6Tests);
if (IA6LOCAL != null) {
l.addAll(openConnectV6LocalTests);
}
}
if (IPSupport.hasIPv4() && IPSupport.hasIPv6()) {
l.addAll(openConnectV4AndV6Tests);
if (IA4LOCAL != null) {
l.addAll(openConnectV4LocalAndV6Tests);
}
}
return l.toArray(new Object[][]{});
}
@ -122,40 +133,20 @@ public class OpenAndConnect {
// + + + +
// { sfam, saddr, cfam, caddr, }
public static List<Object[]> openConnectGenTests =
// Basic tests for when an IPv4 is available
public static List<Object[]> openConnectV4Tests =
Arrays.asList(new Object[][] {
{ INET, IA4LOOPBACK, INET, IA4LOOPBACK },
{ INET, IA4LOOPBACK, null, IA4LOOPBACK },
{ INET, IA4ANYLOCAL, null, IA4LOOPBACK },
{ INET, IA4ANYLOCAL, INET, IA4LOOPBACK },
{ INET6, IA6ANYLOCAL, null, IA6LOOPBACK },
{ INET6, IA6ANYLOCAL, INET6, IA6LOOPBACK },
{ INET6, IA6LOOPBACK, INET6, IA6LOOPBACK },
{ null, IA4LOOPBACK, INET, IA4ANYLOCAL },
{ null, IA4LOOPBACK, INET, IA4LOOPBACK },
{ null, IA4LOOPBACK, INET, null },
{ null, IA4LOOPBACK, INET6, IA6ANYLOCAL },
{ null, IA6LOOPBACK, INET6, IA6ANYLOCAL },
{ null, IA6LOOPBACK, INET6, IA6LOOPBACK },
{ null, IA6LOOPBACK, INET6, DONT_BIND },
{ null, IA4LOOPBACK, INET6, DONT_BIND },
{ null, IA4LOOPBACK, INET6, null },
{ null, IA6LOOPBACK, INET6, null },
{ null, IA4LOOPBACK, null, IA6ANYLOCAL },
{ null, IA6LOOPBACK, null, IA6ANYLOCAL },
{ null, IA6LOOPBACK, null, IA6LOOPBACK },
{ null, IA4LOOPBACK, null, null },
{ null, IA6LOOPBACK, null, null },
{ null, IA6ANYLOCAL, null, IA6LOCAL },
{ null, IA6ANYLOCAL, null, IA6LOOPBACK },
{ null, IA6ANYLOCAL, INET6, IA6LOCAL },
{ null, IA6ANYLOCAL, INET6, IA6LOOPBACK },
{ INET6, IA6LOOPBACK, INET6, IA6LOOPBACK }
{ null, IA4LOOPBACK, null, null }
});
// Additional tests for when an IPv4 local address or V6
// local address is available
// Additional tests for when an IPv4 local address is available
public List<Object[]> openConnectV4LocalTests =
Arrays.asList(new Object[][] {
{ INET, IA4LOCAL, INET, IA4LOCAL },
@ -166,11 +157,28 @@ public class OpenAndConnect {
{ null, IA4LOCAL, INET, IA4ANYLOCAL },
{ null, IA4LOCAL, INET, IA4LOCAL },
{ null, IA4LOCAL, INET, null },
{ null, IA4LOCAL, INET6, IA6ANYLOCAL },
{ null, IA4LOCAL, INET6, null },
{ null, IA4LOCAL, null, IA6ANYLOCAL }
{ null, IA4LOCAL, null, null }
});
// Basic tests for when an IPv6 is available
public List<Object[]> openConnectV6Tests =
Arrays.asList(new Object[][] {
{ INET6, IA6ANYLOCAL, null, IA6LOOPBACK },
{ INET6, IA6ANYLOCAL, INET6, IA6LOOPBACK },
{ INET6, IA6LOOPBACK, INET6, IA6LOOPBACK },
{ INET6, IA6LOOPBACK, INET6, IA6LOOPBACK },
{ null, IA6ANYLOCAL, null, IA6LOOPBACK },
{ null, IA6ANYLOCAL, INET6, IA6LOOPBACK },
{ null, IA6LOOPBACK, INET6, IA6LOOPBACK },
{ null, IA6LOOPBACK, INET6, DONT_BIND },
{ null, IA6LOOPBACK, INET6, null },
{ null, IA6LOOPBACK, null, IA6LOOPBACK },
{ null, IA6LOOPBACK, null, null },
{ null, IA6LOOPBACK, INET6, IA6ANYLOCAL },
{ null, IA6LOOPBACK, null, IA6ANYLOCAL }
});
// Additional tests for when an IPv6 local address is available
public List<Object[]> openConnectV6LocalTests =
Arrays.asList(new Object[][] {
{ INET6, IA6ANYLOCAL, null, IA6LOCAL },
@ -178,16 +186,33 @@ public class OpenAndConnect {
{ INET6, IA6LOCAL, INET6, IA6LOCAL },
{ INET6, IA6LOCAL, null, IA6LOCAL },
{ INET6, IA6LOCAL, null, DONT_BIND },
{ INET6, IA6LOCAL, INET6, IA6LOCAL },
{ null, IA6ANYLOCAL, null, IA6LOCAL },
{ null, IA6ANYLOCAL, INET6, IA6LOCAL },
{ null, IA6LOCAL, INET6, IA6LOCAL },
{ null, IA6LOCAL, INET6, IA6ANYLOCAL },
{ null, IA6LOCAL, null, IA6ANYLOCAL },
{ null, IA6LOCAL, null, IA6LOCAL },
{ null, IA6LOCAL, INET6, null },
{ null, IA6LOCAL, null, null },
{ null, IA4LOCAL, null, null },
{ INET6, IA6LOCAL, INET6, IA6LOCAL }
{ null, IA6LOCAL, null, null }
});
// Additional tests for when IPv4 and IPv6 are available
public List<Object[]> openConnectV4AndV6Tests =
Arrays.asList(new Object[][] {
{ null, IA4LOOPBACK, INET6, IA6ANYLOCAL },
{ null, IA4LOOPBACK, null, IA6ANYLOCAL },
{ null, IA4LOOPBACK, INET6, DONT_BIND },
{ null, IA4LOOPBACK, INET6, null }
});
// Additional tests for when IPv4 local address and IPv6 are available
public List<Object[]> openConnectV4LocalAndV6Tests =
Arrays.asList(new Object[][] {
{ null, IA4LOCAL, INET6, IA6ANYLOCAL },
{ null, IA4LOCAL, INET6, null },
{ null, IA4LOCAL, null, IA6ANYLOCAL }
});
/**
* If the destination address is the wildcard, it is replaced by the alternate