Merge "Make test_isReachable_by_ICMP() more tolerant."
am: 4f0f24101c
Change-Id: I2b2b80b9381b3facd84e02a34bc5f3a25d71298b
diff --git a/luni/src/test/java/libcore/java/net/InetAddressTest.java b/luni/src/test/java/libcore/java/net/InetAddressTest.java
index 88f03d4..6bbfe01 100644
--- a/luni/src/test/java/libcore/java/net/InetAddressTest.java
+++ b/luni/src/test/java/libcore/java/net/InetAddressTest.java
@@ -282,10 +282,17 @@
public void test_isReachable_by_ICMP() throws Exception {
InetAddress[] inetAddresses = InetAddress.getAllByName("www.google.com");
for (InetAddress ia : inetAddresses) {
- // ICMP is not reliable, allow 5 attempts before failing.
- assertTrue(ia.isReachableByICMP(5 * 1000 /* ICMP timeout */));
+ // ICMP is not reliable, allow 5 attempts to each IP address before failing.
+ // If any address is reachable then that's sufficient.
+ if (ia.isReachableByICMP(5 * 1000 /* ICMP timeout */)) {
+ return;
+ }
}
+ fail();
+ }
+ @Test
+ public void test_inUnreachable() throws Exception {
// IPv6 discard prefix. RFC 6666.
final InetAddress blackholeAddress = InetAddress.getByName("100::1");
assertFalse(blackholeAddress.isReachable(1000));