Skip to content

Commit 68d3699

Browse files
committed
Fix failing tests
1 parent 1df0a43 commit 68d3699

File tree

1 file changed

+7
-3
lines changed
  • src/libraries/System.Net.Ping/tests/FunctionalTests

1 file changed

+7
-3
lines changed

src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,11 @@ public async Task SendPingWithIPAddressAndBigSize()
565565
{
566566
IPAddress localIpAddress = TestSettings.GetLocalIPAddress();
567567

568+
if (!(Capability.CanUseRawSockets(localIpAddress.AddressFamily) || PlatformDetection.IsOSXLike))
569+
{
570+
throw new SkipTestException("Underprivileged process cannot specify ping payload.");
571+
}
572+
568573
using (Ping p = new Ping())
569574
{
570575
// Assert.DoesNotThrow
@@ -575,8 +580,7 @@ public async Task SendPingWithIPAddressAndBigSize()
575580
//
576581
// On Windows 10 the maximum ping size seems essentially limited to 65500 bytes and thus any buffer
577582
// size on the loopback ping succeeds. On macOS anything bigger than 8184 will report packet too
578-
// big error. On Linux/Unix the result differs for privileged and unprivileged processes and may
579-
// change with different platform versions.
583+
// big error.
580584
if (OperatingSystem.IsMacOS())
581585
{
582586
Assert.Equal(IPStatus.PacketTooBig, pingReply.Status);
@@ -753,7 +757,7 @@ public async Task SendPingAsyncWithHostAndTtlAndFragmentPingOptions(bool fragmen
753757
{
754758
IPAddress[] localIpAddresses = await TestSettings.GetLocalIPAddressesAsync();
755759

756-
byte[] buffer = TestSettings.PayloadAsBytes;
760+
byte[] buffer = GetPingPayloadForUnix(localIpAddresses[0].AddressFamily);
757761

758762
PingOptions options = new PingOptions();
759763
options.Ttl = 32;

0 commit comments

Comments
 (0)