Skip to content

Commit

Permalink
fix some test for FreeBSD (#64426)
Browse files Browse the repository at this point in the history
* fix some test for FreeBSD

* remove changes in IPGlobalPropertiesTest

* disable AddLongHeader_DoesNotThrow

* update description for skip
  • Loading branch information
wfurt committed Feb 4, 2022
1 parent 2757293 commit 8b94165
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ public static IEnumerable<object[]> InvalidPrefix_TestData()

[Theory]
[MemberData(nameof(InvalidPrefix_TestData))]
[SkipOnPlatform(TestPlatforms.FreeBSD, "FreeBSD accepts some inputs as valid and test hangs")]
public void Add_InvalidPrefixNotStarted_ThrowsHttpListenerExceptionOnStart(string uriPrefix)
{
var listener = new HttpListener();
Expand All @@ -371,6 +372,7 @@ public void Add_InvalidPrefixNotStarted_ThrowsHttpListenerExceptionOnStart(strin

[Theory]
[MemberData(nameof(InvalidPrefix_TestData))]
[SkipOnPlatform(TestPlatforms.FreeBSD, "FreeBSD accepts some inputs as valid and test hangs")]
public void Add_InvalidPrefixAlreadyStarted_ThrowsHttpListenerExceptionOnAdd(string uriPrefix)
{
using (var factory = new HttpListenerFactory())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ public async Task CloseResponseEntity_SendToClosedConnection_DoesNotThrow(bool w
}

[Fact]
[SkipOnPlatform(TestPlatforms.FreeBSD, "unreliable on FreeBSD")]
public async Task AddLongHeader_DoesNotThrow()
{
string longString = new string('a', 65536);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ public async Task Write_ContentToClosedConnectionAsynchronously_ThrowsHttpListen
[InlineData(true)]
[InlineData(false)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/21022", platforms: TestPlatforms.Windows)] // Indeterminate failure - socket not always fully disconnected.
[ActiveIssue("https://github.com/dotnet/runtime/issues/21590", TestPlatforms.OSX)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/21590", TestPlatforms.OSX | TestPlatforms.FreeBSD)]
public async Task Write_ContentToClosedConnectionSynchronously_ThrowsHttpListenerException(bool ignoreWriteExceptions)
{
const string Text = "Some-String";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal static class TestConfiguration
public const string NtlmUserFilePath = "/var/tmp/ntlm_user_file";

public static bool SupportsNullEncryption { get { return s_supportsNullEncryption.Value; } }
public static bool SupportsHandshakeAlerts { get { return OperatingSystem.IsLinux() || OperatingSystem.IsWindows(); } }
public static bool SupportsHandshakeAlerts { get { return OperatingSystem.IsLinux() || OperatingSystem.IsWindows() || OperatingSystem.IsFreeBSD(); } }
public static bool SupportsRenegotiation { get { return (OperatingSystem.IsWindows() && !PlatformDetection.IsWindows7) || ((OperatingSystem.IsLinux() || OperatingSystem.IsFreeBSD()) && PlatformDetection.OpenSslVersion >= new Version(1, 1, 1)); } }

public static Task WhenAllOrAnyFailedWithTimeout(params Task[] tasks)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public async Task Datagram_UDP_ShouldImplicitlyBindLocalEndpoint()
}

[Fact]
[SkipOnPlatform(TestPlatforms.FreeBSD, "FreeBSD allows sendto() to broadcast")]
public async Task Datagram_UDP_AccessDenied_Throws_DoesNotBind()
{
IPEndPoint invalidEndpoint = new IPEndPoint(IPAddress.Broadcast, 1234);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ public void SetIPProtectionLevel_ArgumentException(AddressFamily family)
}
}

[Theory]
[ConditionalTheory]
[InlineData(AddressFamily.InterNetwork)]
[InlineData(AddressFamily.InterNetworkV6)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/50568", TestPlatforms.Android)]
Expand All @@ -515,6 +515,7 @@ public void GetSetRawSocketOption_Roundtrips(AddressFamily family)
int SO_RCVBUF;

if (OperatingSystem.IsWindows() ||
OperatingSystem.IsFreeBSD() ||
OperatingSystem.IsMacOS())
{
SOL_SOCKET = 0xffff;
Expand Down Expand Up @@ -558,7 +559,7 @@ public void Get_AcceptConnection_Succeeds()
s.Bind(new IPEndPoint(IPAddress.Loopback, 0));
s.Listen();

Assert.Equal(1, s.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.AcceptConnection));
Assert.NotEqual(0, s.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.AcceptConnection));
}
}

Expand Down

0 comments on commit 8b94165

Please sign in to comment.