changeset 47125:46ab150d59cd

8134989: java/net/MulticastSocket/TestInterfaces.java failed due to unexpected IP address Reviewed-by: rriggs, chegar, msheppar
author xiaofeya
date Mon, 04 Sep 2017 17:46:59 -0700
parents 81c5d19469c0
children 5b4ba31ce49b
files jdk/test/java/net/MulticastSocket/TestInterfaces.java
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/java/net/MulticastSocket/TestInterfaces.java	Sun Sep 03 14:19:45 2017 +0200
+++ b/jdk/test/java/net/MulticastSocket/TestInterfaces.java	Mon Sep 04 17:46:59 2017 -0700
@@ -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 @@
             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 @@
         }
 
         if (failures > 0) {
+            System.err.println("********************************");
+            NetworkConfiguration.printSystemConfiguration(System.err);
             System.out.println("********************************");
             throw new Exception(failures + " test(s) failed!!!");
         }