From 136977337e3da1e02308519befd175a5975f9c7d Mon Sep 17 00:00:00 2001 From: Felix Yang <xiaofeya@openjdk.org> Date: Mon, 4 Sep 2017 17:46:59 -0700 Subject: [PATCH] 8134989: java/net/MulticastSocket/TestInterfaces.java failed due to unexpected IP address Reviewed-by: rriggs, chegar, msheppar --- .../java/net/MulticastSocket/TestInterfaces.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/jdk/test/java/net/MulticastSocket/TestInterfaces.java b/jdk/test/java/net/MulticastSocket/TestInterfaces.java index 2d90cb8a58e..80ab98f594b 100644 --- a/jdk/test/java/net/MulticastSocket/TestInterfaces.java +++ b/jdk/test/java/net/MulticastSocket/TestInterfaces.java @@ -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!!!"); }