Skip to content

Commit f23295e

Browse files
committed
8334600: TEST java/net/MulticastSocket/IPMulticastIF.java fails on linux-aarch64
Reviewed-by: alanb
1 parent 741a0f3 commit f23295e

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

test/jdk/java/net/MulticastSocket/IPMulticastIF.java

+25-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -63,9 +63,25 @@ public Object[][] positive() throws Exception {
6363
InetAddress.getLoopbackAddress());
6464
List<Object[]> list = new ArrayList<>();
6565
NetworkConfiguration nc = NetworkConfiguration.probe();
66+
// retains only network interface whose bound addresses match
6667
addrs.stream().forEach(a -> nc.multicastInterfaces(true)
67-
.map(nif -> new Object[] { new InetSocketAddress(a, 0), nif })
68-
.forEach(list::add) );
68+
.filter(nif -> nif.inetAddresses().toList().contains(a))
69+
.map(nif -> new Object[] { new InetSocketAddress(a, 0), nif })
70+
.forEach(list::add) );
71+
// any network interface should work with the wildcard address
72+
nc.multicastInterfaces(true)
73+
.map(nif -> new Object[] {new InetSocketAddress(0), nif})
74+
.forEach(list::add);
75+
return list.stream().toArray(Object[][]::new);
76+
}
77+
78+
@DataProvider(name = "interfaces")
79+
public Object[][] interfaces() throws Exception {
80+
List<Object[]> list = new ArrayList<>();
81+
NetworkConfiguration nc = NetworkConfiguration.probe();
82+
nc.multicastInterfaces(true)
83+
.map(nif -> new Object[] {nif})
84+
.forEach(list::add);
6985

7086
return list.stream().toArray(Object[][]::new);
7187
}
@@ -82,8 +98,8 @@ public void testSetGetInterfaceBound(InetSocketAddress bindAddr, NetworkInterfac
8298
}
8399
}
84100

85-
@Test(dataProvider = "scenarios")
86-
public void testSetGetInterfaceUnbound(InetSocketAddress ignore, NetworkInterface nif)
101+
@Test(dataProvider = "interfaces")
102+
public void testSetGetInterfaceUnbound(NetworkInterface nif)
87103
throws Exception
88104
{
89105
out.println(format("\n\n--- testSetGetInterfaceUnbound nif=[%s]", nif));
@@ -106,8 +122,8 @@ public void testSetGetOptionBound(InetSocketAddress bindAddr, NetworkInterface n
106122
}
107123
}
108124

109-
@Test(dataProvider = "scenarios")
110-
public void testSetGetOptionUnbound(InetSocketAddress ignore, NetworkInterface nif)
125+
@Test(dataProvider = "interfaces")
126+
public void testSetGetOptionUnbound(NetworkInterface nif)
111127
throws Exception
112128
{
113129
out.println(format("\n\n--- testSetGetOptionUnbound nif=[%s]", nif));
@@ -139,8 +155,8 @@ public void testGetInterfaceBound(InetSocketAddress bindAddr)
139155
}
140156

141157
@Test
142-
public void testGettInterfaceUnbound() throws Exception {
143-
out.println("\n\n--- testGettInterfaceUnbound ");
158+
public void testGetInterfaceUnbound() throws Exception {
159+
out.println("\n\n--- testGetInterfaceUnbound ");
144160
try (MulticastSocket ms = new MulticastSocket()) {
145161
assertPlaceHolder(ms.getNetworkInterface());
146162
}

0 commit comments

Comments
 (0)