8134989: java/net/MulticastSocket/TestInterfaces.java failed due to unexpected IP address

Reviewed-by: rriggs, chegar, msheppar
This commit is contained in:
Felix Yang 2017-09-04 17:46:59 -07:00
parent d674c7a75f
commit 136977337e

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,10 +24,15 @@
/*
* @test
* @bug 4422122
* @key intermittent
* @summary Test that MulticastSocket.getInterface returns the
* same InetAddress set by MulticastSocket.setInterface
* @library /test/lib
* @build jdk.test.lib.NetworkConfiguration
* jdk.test.lib.Platform
* @run main TestInterfaces
*/
import jdk.test.lib.NetworkConfiguration;
import java.net.*;
import java.util.Arrays;
import java.util.Collections;
@ -52,6 +57,10 @@ public class TestInterfaces {
if (isWindows && dName != null && dName.contains("Teredo"))
continue;
// Skip those interfaces not up or not support multicast
if (!ni.isUp() || !ni.supportsMulticast())
continue;
/*
* Test MulticastSocket.getInterface
*/
@ -115,6 +124,8 @@ public class TestInterfaces {
}
if (failures > 0) {
System.err.println("********************************");
NetworkConfiguration.printSystemConfiguration(System.err);
System.out.println("********************************");
throw new Exception(failures + " test(s) failed!!!");
}