Skip to content

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Jul 31, 2020

Contribution description

When compiled with LWIP_IPV4=1 LWIP_IPV6=1 this test currently fails in current master. This "regression" was introduced with 035acc2. However, after some debugging I think that commit actually revealed a problem with the test rather than introducing a bug.

The test starts the central server, and then checks if opening a listening socket on the same port causes an -EADDRINUSE error. The server, on the other hand, starts with SOCK_FLAGS_REUSE_EP, so of course the listening operation may succeed. Instead, let's just call sock_tcp_listen twice with two distinct queue objects. Way easier and also more correct.

Testing procedure

LWIP_IPV4=1 LWIP_IPV6=1 make -C tests/lwip_sock_tcp -j16 flash test

should succeed (but fails in master)

Issues/PRs references

See #14665 (comment)

When compiled with `LWIP_IPV4=1 LWIP_IPV6=1` this test currently fails
in current master. This "regression" was introduced with 035acc2.
However, after some debugging I think that commit actually revealed a
problem with the test rather than introducing a bug.

The test starts the central server, and then checks if opening a
listening socket on the same port causes an `-EADDRINUSE` error.
The server, on the other hand, starts with `SOCK_FLAGS_REUSE_EP`, so of
course the listening operation may succeed. Instead, let's just call
`sock_tcp_listen` twice with two distinct queue objects. Way easier and
also more correct.
@miri64 miri64 added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: network Area: Networking Area: tests Area: tests and testing framework Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Jul 31, 2020
@miri64 miri64 requested a review from maribu July 31, 2020 11:45
Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

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

ACK.

The test indeed fails in master and no more with this PR.

The reasoning that indeed the test is testing for incorrect behavior makes sense.

The new test checks if a call after to sock_tcp_listen() (this time without SOCK_FLAGS_REUSE_EP) does not fail after SOCK_FLAGS_REUSE_EP was set, and then a second call to sock_tcp_listen() due to the absence of SOCK_FLAGS_REUSE_EP now fails with -EADDRINUSE. This is exactly the expected behavior according to the API doc.

@maribu maribu merged commit ee1a10f into RIOT-OS:master Jul 31, 2020
@miri64 miri64 deleted the tests/fix/sock_tcp branch July 31, 2020 13:08
@miri64
Copy link
Member Author

miri64 commented Jul 31, 2020

Backport provided in #14670

@miri64 miri64 added the Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch label Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Area: pkg Area: External package ports Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants