Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some test for FreeBSD #64426

Merged
merged 4 commits into from
Feb 4, 2022
Merged

fix some test for FreeBSD #64426

merged 4 commits into from
Feb 4, 2022

Conversation

wfurt
Copy link
Member

@wfurt wfurt commented Jan 28, 2022

contributes to #14537 and fixes some test sets reported as broken:

  • System.Net.HttpListener.Tests
    I just disabled failing tests. When the code does not throws as expected whole set hangs. I see no reason investing into HttpListener
  • System.Net.NetworkInformation.Functional.Tests
    I opened separate issue for tracing and disabled two tests with ActiveIssue. We are lacking ability to get listening connections at the moment.
  • System.Net.Security.Tests
    Adjusted expectation around Alerts - We use OpenSSL so the behavior is same as Linux.
  • System.Net.Sockets.Tests
    This is the curious one. The test expects we would throw when sending to broadcast without SO_BROADCAST.
    The documentation has references to it as well but that is not what I see happening
16448: socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC,IPPROTO_UDP) = 175 (0xaf)
16448: fcntl(175,F_GETFL,)                       = 2 (0x2)
16448: fcntl(175,F_SETFL,O_RDWR|O_NONBLOCK)      = 0 (0x0)
16448: sendmsg(175,{{ AF_INET 255.255.255.255:1234 },16,[{"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,32}],1,{},0,0},0) = 32 (0x20)
16448: close(175)                                = 0 (0x0)

Since this does not seems critical, I simply disabled Datagram_UDP_AccessDenied_Throws_DoesNotBind

and Get_AcceptConnection_Succeeds was expecting value of one. The man page did mentioned something about boolean and the implementation really just returns the flag if set:

/usr/include/sys/socketvar.h:#define	SOLISTENING(sol)	(((sol)->so_options & SO_ACCEPTCONN) != 0)
/usr/include/sys/socket.h:#define	SO_ACCEPTCONN	0x00000002	/* socket has had listen() */

and the test was failing because it would get 2 instead of 1. Since the value is really not meaningful as counter I adjusted the test to expect non-zero value. (e.g true vs 0 -> false)

And the SkipTestException in GetSetRawSocketOption_Roundtrips makes the test fail if we do not use ConditionalTheory attribute. Since the fix was simple, I also added values for FreeBSD

All the networking tests are passing now

   Discovering: System.Net.Sockets.Tests (method display = ClassAndMethod, method display options = None)
    Discovered:  System.Net.Sockets.Tests (found 1215 of 1685 test cases)
    Starting:    System.Net.Sockets.Tests (parallel test collections = on, max threads = 2)
      System.Net.Sockets.Tests.CreateSocket.Ctor_Raw_Supported_Success [SKIP]
        Condition(s) not met: "SupportsRawSockets"
    Finished:    System.Net.Sockets.Tests
  === TEST EXECUTION SUMMARY ===
     System.Net.Sockets.Tests  Total: 1908, Errors: 0, Failed: 0, Skipped: 1, Time: 17.084s

@wfurt wfurt added this to the 7.0.0 milestone Jan 28, 2022
@wfurt wfurt requested a review from a team January 28, 2022 02:08
@wfurt wfurt self-assigned this Jan 28, 2022
@ghost
Copy link

ghost commented Jan 28, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

contributes to #14537 and fixes some test sets reported as broken:

  • System.Net.HttpListener.Tests
    I just disabled failing tests. When the code does not throws as expected whole set hangs. I see no reason investing into HttpListener
  • System.Net.NetworkInformation.Functional.Tests
    I opened separate issue for tracing and disabled two tests with ActiveIssue. We are lacking ability to get listening connections at the moment.
  • System.Net.Security.Tests
    Adjusted expectation around Alerts - We use OpenSSL so the behavior is same as Linux.
  • System.Net.Sockets.Tests
    This is the curious one. The test expects we would throw when sending to broadcast without SO_BROADCAST.
    The documentation has references to it as well but that is not what I see happening
16448: socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC,IPPROTO_UDP) = 175 (0xaf)
16448: fcntl(175,F_GETFL,)                       = 2 (0x2)
16448: fcntl(175,F_SETFL,O_RDWR|O_NONBLOCK)      = 0 (0x0)
16448: sendmsg(175,{{ AF_INET 255.255.255.255:1234 },16,[{"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,32}],1,{},0,0},0) = 32 (0x20)
16448: close(175)                                = 0 (0x0)

Since this does not seems critical, I simply disabled Datagram_UDP_AccessDenied_Throws_DoesNotBind

and Get_AcceptConnection_Succeeds was expecting value of one. The man page did mentioned something about boolean and the implementation really just returns the flag if set:

/usr/include/sys/socketvar.h:#define	SOLISTENING(sol)	(((sol)->so_options & SO_ACCEPTCONN) != 0)
/usr/include/sys/socket.h:#define	SO_ACCEPTCONN	0x00000002	/* socket has had listen() */

and the test was failing because it would get 2 instead of 1. Since the value is really not meaningful as counter I adjusted the test to expect non-zero value. (e.g true vs 0 -> false)

And the SkipTestException in GetSetRawSocketOption_Roundtrips makes the test fail if we do not use ConditionalTheory attribute. Since the fix was simple, I also added values for FreeBSD

All the networking tests are passing now

   Discovering: System.Net.Sockets.Tests (method display = ClassAndMethod, method display options = None)
    Discovered:  System.Net.Sockets.Tests (found 1215 of 1685 test cases)
    Starting:    System.Net.Sockets.Tests (parallel test collections = on, max threads = 2)
      System.Net.Sockets.Tests.CreateSocket.Ctor_Raw_Supported_Success [SKIP]
        Condition(s) not met: "SupportsRawSockets"
    Finished:    System.Net.Sockets.Tests
  === TEST EXECUTION SUMMARY ===
     System.Net.Sockets.Tests  Total: 1908, Errors: 0, Failed: 0, Skipped: 1, Time: 17.084s
Author: wfurt
Assignees: wfurt
Labels:

area-System.Net, os-freebsd

Milestone: 7.0.0

@Thefrank
Copy link
Contributor

I am still getting a hang in System.Net.HttpListener.Tests from System.Net.Tests.HttpListenerResponseTests.AddLongHeader_DoesNotThrow under FreeBSD 12.2. I will run 12.3 and 13.0 later this weekend when I get a chance

@wfurt
Copy link
Member Author

wfurt commented Jan 31, 2022

I did more runs and I see occasional failure @Thefrank. So I disabled that test as well.

@@ -359,6 +359,7 @@ public static IEnumerable<object[]> InvalidPrefix_TestData()

[Theory]
[MemberData(nameof(InvalidPrefix_TestData))]
[SkipOnPlatform(TestPlatforms.FreeBSD, "FreeBSD accepts some as valid and test hangs")]
Copy link
Member

Choose a reason for hiding this comment

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

"accepts some as valid"... some what? I'm not understanding the comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

some items from InvalidPrefix_TestData. http://192./ for example. I did not dig deeper why that is happening.

@wfurt wfurt merged commit 8b94165 into dotnet:main Feb 4, 2022
@wfurt wfurt deleted the bsdTests branch February 4, 2022 01:40
@ghost ghost locked as resolved and limited conversation to collaborators Mar 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants