Skip to content

tests/net: use random, free port for socket_zep&gnrc_netif_ieeee802154#21853

Merged
benpicco merged 2 commits intoRIOT-OS:masterfrom
crasbe:pr/tests_zep_random_port
Nov 6, 2025
Merged

tests/net: use random, free port for socket_zep&gnrc_netif_ieeee802154#21853
benpicco merged 2 commits intoRIOT-OS:masterfrom
crasbe:pr/tests_zep_random_port

Conversation

@crasbe
Copy link
Copy Markdown
Contributor

@crasbe crasbe commented Nov 6, 2025

Contribution description

We are currently experiencing issues that the ports chosen by tests/net/socket_zep appear to be in use already. This might be because of an issue with our code or the fact that 12345 might have been chosen by another application as well.

image

This PR adds a small function that connects to localhost using a socket chosen by the OS (by selecting port 0) and then returning it for use in the program.

Testing procedure

Run the test.

cbuec@W11nMate:~/RIOTstuff/riot-guides/RIOT$ make -C tests/net/socket_zep all test -j
make: Entering directory '/home/cbuec/RIOTstuff/riot-guides/RIOT/tests/net/socket_zep'
using BOARD="native64" as "native" on a 64-bit system
Building application "tests_socket_zep" for "native64" with CPU "native".

"make" -C /home/cbuec/RIOTstuff/riot-guides/RIOT/boards
...
"make" -C /home/cbuec/RIOTstuff/riot-guides/RIOT/sys/ztimer
   text    data     bss     dec     hex filename
  62239    1648   60168  124055   1e497 /home/cbuec/RIOTstuff/riot-guides/RIOT/tests/net/socket_zep/bin/native64/tests_socket_zep.elf
/home/cbuec/RIOTstuff/riot-guides/RIOT/tests/net/socket_zep/bin/native64/tests_socket_zep.elf --eui64=00:5a:45:50:0a:00:30:38 -z [127.0.0.1]:35967,[127.0.0.1]:60949  tap0
RIOT native interrupts/signals initialized.
TZ not set, setting UTC
RIOT native64 board initialized.
RIOT native hardware initialization complete.

main(): This is RIOT! (Version: 2025.10-devel-545-g03862d-pr/tests_zep_random_port)
Socket ZEP device driver test
Initializing socket ZEP with (local: [127.0.0.1]:35967, remote: [127.0.0.1]:60949)
(Hwaddrs: 3038, 005a45500a003038)
Send 'Hello\0World\0'
Waiting for an incoming message (use `make test`)
RSSI: 4294967271, LQI: 255, Data:
00000000  41  DC  02  23  00  38  30  00  0A  50  45  5A  00  5B  45  00
00000010  0A  50  45  5A  00  48  65  6C  6C  6F  20  57  6F  72  6C  64

Run tests successful
make: Leaving directory '/home/cbuec/RIOTstuff/riot-guides/RIOT/tests/net/socket_zep'

Issues/PRs references

None.

@crasbe crasbe requested a review from maribu November 6, 2025 10:55
@crasbe crasbe added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 6, 2025
@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Nov 6, 2025
Copy link
Copy Markdown
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.

This won't fix the issue to 100% due to TOC/TOU, but it will certainly reduce the chance of the issue triggering by a huge margin.

Thx!

@riot-ci
Copy link
Copy Markdown

riot-ci commented Nov 6, 2025

Murdock results

✔️ PASSED

8e3a6ee tests/net: use random, free port for gnrc_netif_ieee802154

Success Failures Total Runtime
13 0 16 02m:01s

Artifacts

@crasbe crasbe force-pushed the pr/tests_zep_random_port branch from 0d2f0d0 to 6a89fe5 Compare November 6, 2025 11:33
@crasbe crasbe requested a review from miri64 as a code owner November 6, 2025 12:01
@crasbe crasbe changed the title tests/net: use random, free port for socket_zep tests/net: use random, free port for socket_zep&gnrc_netif_ieeee802154 Nov 6, 2025
@crasbe crasbe force-pushed the pr/tests_zep_random_port branch from 223361c to 8e3a6ee Compare November 6, 2025 12:04
@crasbe crasbe requested a review from maribu November 6, 2025 12:09
@benpicco benpicco added this pull request to the merge queue Nov 6, 2025
@crasbe crasbe added the Process: needs backport Integration Process: The PR is required to be backported to a release or feature branch label Nov 6, 2025
Merged via the queue into RIOT-OS:master with commit a8f0171 Nov 6, 2025
26 checks passed
@crasbe crasbe deleted the pr/tests_zep_random_port branch November 6, 2025 13:54
@leandrolanzieri leandrolanzieri added this to the Release 2026.01 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants