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

sys/net/gnrc/sock: use ztimer_usec or xtimer for timeout #17852

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

fjmolinas
Copy link
Contributor

Contribution description

Split as from #17836 as requested in #17836 (comment).

Sure with ztimer_usec being no the default I could have just removed xtimer, but this works as well, and I already did it, so its less work to keep as is.

Testing procedure

  • murdock should be enough

  • local tests for app in tests/gnrc_sock_udp tests/gnrc_sock_ip; do USEMODULE=ztimer_usec RIOT_CI_BUILD=1 make -C ${app} flash test test-as-root -j; done

Building application "tests_gnrc_sock_udp" for "native" with MCU "native".

   text	   data	    bss	    dec	    hex	filename
 129899	    756	  67848	 198503	  30767	/home/francisco/workspace/RIOT/tests/gnrc_sock_udp/bin/native/tests_gnrc_sock_udp.elf
r
/home/francisco/workspace/RIOT/tests/gnrc_sock_udp/bin/native/tests_gnrc_sock_udp.elf /dev/ttyACM0 
RIOT native interrupts/signals initialized.
RIOT native board initialized.
RIOT native hardware initialization complete.

Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: buildtest)
Calling test_sock_udp_create__EADDRINUSE()
Calling test_sock_udp_create__EAFNOSUPPORT()
Calling test_sock_udp_create__EINVAL_addr()
Calling test_sock_udp_create__EINVAL_netif()
Calling test_sock_udp_create__no_endpoints()
Calling test_sock_udp_create__only_local()
Calling test_sock_udp_create__only_local_port0()
Calling test_sock_udp_create__only_local_reuse_ep()
Calling test_sock_udp_create__only_remote()
Calling test_sock_udp_create__full()
Calling test_sock_udp_recv__EADDRNOTAVAIL()
Calling test_sock_udp_recv__EAGAIN()
Calling test_sock_udp_recv__ENOBUFS()
Calling test_sock_udp_recv__EPROTO()
Calling test_sock_udp_recv__ETIMEDOUT()
 * Calling sock_udp_recv()
 * (timed out with timeout 1000000)
Calling test_sock_udp_recv__socketed()
Calling test_sock_udp_recv__socketed_with_remote()
Calling test_sock_udp_recv__socketed_with_port0()
Calling test_sock_udp_recv__unsocketed()
Calling test_sock_udp_recv__unsocketed_with_remote()
Calling test_sock_udp_recv__with_timeout()
Calling test_sock_udp_recv__non_blocking()
Calling test_sock_udp_recv__aux()
Calling test_sock_udp_recv_buf__success()
Calling test_sock_udp_send__EAFNOSUPPORT()
Calling test_sock_udp_send__EINVAL_addr()
Calling test_sock_udp_send__EINVAL_netif()
Calling test_sock_udp_send__EINVAL_port()
Calling test_sock_udp_send__ENOTCONN()
Calling test_sock_udp_send__socketed_no_local_no_netif()
Calling test_sock_udp_send__socketed_no_netif()
Calling test_sock_udp_send__socketed_no_local()
Calling test_sock_udp_send__socketed()
Calling test_sock_udp_sendv__socketed()
Calling test_sock_udp_send__socketed_other_remote()
Calling test_sock_udp_send__unsocketed_no_local_no_netif()
Calling test_sock_udp_send__unsocketed_no_netif()
Calling test_sock_udp_send__unsocketed_no_local()
Calling test_sock_udp_send__unsocketed()
Calling test_sock_udp_send__no_sock_no_netif()
Calling test_sock_udp_send__no_sock()
ALL TESTS SUCCESSFUL

Building application "tests_gnrc_sock_ip" for "native" with MCU "native".

   text	   data	    bss	    dec	    hex	filename
 123763	    756	  59592	 184111	  2cf2f	/home/francisco/workspace/RIOT/tests/gnrc_sock_ip/bin/native/tests_gnrc_sock_ip.elf
r
/home/francisco/workspace/RIOT/tests/gnrc_sock_ip/bin/native/tests_gnrc_sock_ip.elf /dev/ttyACM0 
RIOT native interrupts/signals initialized.
RIOT native board initialized.
RIOT native hardware initialization complete.

Help: Press s to start test, r to print it is ready
READY
s
START
main(): This is RIOT! (Version: buildtest)
Calling test_sock_ip_create__EAFNOSUPPORT()
Calling test_sock_ip_create__EINVAL_addr()
Calling test_sock_ip_create__EINVAL_netif()
Calling test_sock_ip_create__no_endpoints()
Calling test_sock_ip_create__only_local()
Calling test_sock_ip_create__only_local_reuse_ep()
Calling test_sock_ip_create__only_remote()
Calling test_sock_ip_create__full()
Calling test_sock_ip_recv__EADDRNOTAVAIL()
Calling test_sock_ip_recv__EAGAIN()
Calling test_sock_ip_recv__ENOBUFS()
Calling test_sock_ip_recv__EPROTO()
Calling test_sock_ip_recv__ETIMEDOUT()
 * Calling sock_ip_recv()
 * (timed out with timeout 1000000)
Calling test_sock_ip_recv__socketed()
Calling test_sock_ip_recv__socketed_with_remote()
Calling test_sock_ip_recv__unsocketed()
Calling test_sock_ip_recv__unsocketed_with_remote()
Calling test_sock_ip_recv__with_timeout()
Calling test_sock_ip_recv__non_blocking()
Calling test_sock_ip_recv__aux()
Calling test_sock_ip_recv_buf__success()
Calling test_sock_ip_send__EAFNOSUPPORT_INET()
Calling test_sock_ip_send__EAFNOSUPPORT_UNSPEC()
Calling test_sock_ip_send__EINVAL_addr()
Calling test_sock_ip_send__EINVAL_netif()
Calling test_sock_ip_send__ENOTCONN()
Calling test_sock_ip_send__socketed_no_local_no_netif()
Calling test_sock_ip_send__socketed_no_netif()
Calling test_sock_ip_send__socketed_no_local()
Calling test_sock_ip_send__socketed()
Calling test_sock_ip_send__socketed_other_remote()
Calling test_sock_ip_send__unsocketed_no_local_no_netif()
Calling test_sock_ip_send__unsocketed_no_netif()
Calling test_sock_ip_send__unsocketed_no_local()
Calling test_sock_ip_send__unsocketed()
Calling test_sock_ip_send__no_sock_no_netif()
Calling test_sock_ip_send__no_sock()
ALL TESTS SUCCESSFUL

Issues/PRs references

#17111

@fjmolinas fjmolinas added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Mar 24, 2022
@github-actions github-actions bot added Area: network Area: Networking Area: sys Area: System labels Mar 24, 2022
Copy link
Contributor

@kfessel kfessel left a comment

Choose a reason for hiding this comment

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

change matches ztimer for xtimer 1:1, murdock is green; and successful test results are provided

@fjmolinas
Copy link
Contributor Author

Go! thanks for the review!

@fjmolinas fjmolinas merged commit d53f375 into RIOT-OS:master Mar 24, 2022
@fjmolinas fjmolinas deleted the pr_gnrc_sock_ztimer_alt branch March 24, 2022 13:22
@@ -116,7 +119,14 @@ ssize_t gnrc_sock_recv(gnrc_sock_reg_t *reg, gnrc_pktsnip_t **pkt_out,
if (mbox_size(&reg->mbox) != GNRC_SOCK_MBOX_SIZE) {
return -EINVAL;
}
#ifdef MODULE_XTIMER
#if IS_USED(MODULE_ZTIMER_USEC)
ztimer_t timeout_timer;
Copy link
Member

Choose a reason for hiding this comment

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

This is a problem with xtimer as well, but this initialization might be with garbage in base.next ;-). Was about to provide a fix for that anyway any moment (just testing something before-hand), so I will just piggy-back an initializer here as well ;-)

Copy link
Member

Choose a reason for hiding this comment

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

See #17855

@OlegHahm OlegHahm added this to the Release 2022.04 milestone Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants