Skip to content

Commit

Permalink
8334600: TEST java/net/MulticastSocket/IPMulticastIF.java fails on li…
Browse files Browse the repository at this point in the history
…nux-aarch64

Backport-of: f23295ec1dde58d239a2625c9b1645534a2bb625
  • Loading branch information
SendaoYan authored and jerboaa committed Jul 4, 2024
1 parent 4f82229 commit c8fe1a1
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions test/jdk/java/net/MulticastSocket/IPMulticastIF.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, 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
Expand Down Expand Up @@ -63,9 +63,25 @@ public Object[][] positive() throws Exception {
InetAddress.getLoopbackAddress());
List<Object[]> list = new ArrayList<>();
NetworkConfiguration nc = NetworkConfiguration.probe();
// retains only network interface whose bound addresses match
addrs.stream().forEach(a -> nc.multicastInterfaces(true)
.map(nif -> new Object[] { new InetSocketAddress(a, 0), nif })
.forEach(list::add) );
.filter(nif -> nif.inetAddresses().toList().contains(a))
.map(nif -> new Object[] { new InetSocketAddress(a, 0), nif })
.forEach(list::add) );
// any network interface should work with the wildcard address
nc.multicastInterfaces(true)
.map(nif -> new Object[] {new InetSocketAddress(0), nif})
.forEach(list::add);
return list.stream().toArray(Object[][]::new);
}

@DataProvider(name = "interfaces")
public Object[][] interfaces() throws Exception {
List<Object[]> list = new ArrayList<>();
NetworkConfiguration nc = NetworkConfiguration.probe();
nc.multicastInterfaces(true)
.map(nif -> new Object[] {nif})
.forEach(list::add);

return list.stream().toArray(Object[][]::new);
}
Expand All @@ -82,8 +98,8 @@ public void testSetGetInterfaceBound(InetSocketAddress bindAddr, NetworkInterfac
}
}

@Test(dataProvider = "scenarios")
public void testSetGetInterfaceUnbound(InetSocketAddress ignore, NetworkInterface nif)
@Test(dataProvider = "interfaces")
public void testSetGetInterfaceUnbound(NetworkInterface nif)
throws Exception
{
out.println(format("\n\n--- testSetGetInterfaceUnbound nif=[%s]", nif));
Expand All @@ -106,8 +122,8 @@ public void testSetGetOptionBound(InetSocketAddress bindAddr, NetworkInterface n
}
}

@Test(dataProvider = "scenarios")
public void testSetGetOptionUnbound(InetSocketAddress ignore, NetworkInterface nif)
@Test(dataProvider = "interfaces")
public void testSetGetOptionUnbound(NetworkInterface nif)
throws Exception
{
out.println(format("\n\n--- testSetGetOptionUnbound nif=[%s]", nif));
Expand Down Expand Up @@ -139,8 +155,8 @@ public void testGetInterfaceBound(InetSocketAddress bindAddr)
}

@Test
public void testGettInterfaceUnbound() throws Exception {
out.println("\n\n--- testGettInterfaceUnbound ");
public void testGetInterfaceUnbound() throws Exception {
out.println("\n\n--- testGetInterfaceUnbound ");
try (MulticastSocket ms = new MulticastSocket()) {
assertPlaceHolder(ms.getNetworkInterface());
}
Expand Down

1 comment on commit c8fe1a1

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.