-
Notifications
You must be signed in to change notification settings - Fork 2k
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
tests/ztimer_periodic: iterate over clocks #16254
Conversation
I would say this is not a requirement, this yet might expose bugs, but this PR should not necessarily handle fixing them IMO. |
@maribu, the following is also needed to override de the default
|
0d0dce9
to
524f634
Compare
Rebased on top of master to include #16257 |
May I squash to safe one Murdock cycle? |
Sure, but since in #16257 I did not change the default frequency you might still want to include somewhere:
|
524f634
to
cc0d4e4
Compare
I ran the tes on a lsit of BOARDS the following failed: arduino-uno/failuresummaryFailures during test: z1/failuresummaryFailures during test: atmega256rfr2-xpro/failuresummaryFailures during test: All these succeeded nucleo-g071rb/failuresummarydwm1001/failuresummarypba-d-01-kw2x/failuresummarynucleo-f207zg/failuresummarynucleo-f334r8/failuresummarynucleo-g474re/failuresummarynrf52dk/failuresummaryfrdm-k64f/failuresummarynucleo-l152re/failuresummarynucleo-f767zi/failuresummarysamr21-xpro/failuresummaryp-nucleo-wb55/failuresummarynucleo-l496zg/failuresummarynucleo-l452re/failuresummarynucleo-l433rc/failuresummaryek-lm4f120xl/failuresummaryi-nucleo-lrwan1/failuresummaryopenmote-b/failuresummarynucleo-l4r5zi/failuresummarynucleo-f091rc/failuresummaryarduino-zero/failuresummarynucleo-f303k8/failuresummarynucleo-f103rb/failuresummaryb-l072z-lrwan1/failuresummarynucleo-f303re/failuresummaryslstk3402a/failuresummarynucleo-f446re/failuresummarynucleo-f030r8/failuresummarynucleo-l073rz/failuresummary |
cc0d4e4
to
e37cbd3
Compare
Looks to me like on the z1 the first period is missed by a to high offset for the usec clock. I guess this might just be the MSP430 being to slow in terms of CPU power to match the short period. I added a fixup to increase the period for the usec clock by factor 10. Maybe this makes the z1 pass? The kernel panic with the AVR seems to be a bug exposed by the test. I have the feeling that the AVR port is generally having some stability issues that are in need of fixing :-( |
In any case failing tests are not a blocker here. |
Maybe for the z1 it indeed is the tests fault: If it puts the poor CPU under more load than it can handle, we test for something the hardware just cannot deliver. But if it is indeed an unrelated bug, I totally agree. It is a pity that I haven't found the time yet to port RIOT to my MSP-EXP430FR5994 boards, so that I could test myself. |
Actually I think the issue is that calling |
It also would make it pass on |
@maribu ping :) |
I changed the behavior that a too high offset for the first timeout results in a warning, rather than a test failure. To compensate, I increased the number of tests. Generally, I would like not to lower the bar of the tests, but rather try to get the implementation passing it. But missing only the first timeout and none afterwards clearly a less severe test failure than missing random timeouts, so downgrading a miss of the first deadline could be considered a compromise to better match the severity of the different failure modes. |
tests/ztimer_periodic/main.c
Outdated
printf("Testing clock: %s\n", _names[j]); | ||
ztimer_clock_t *clock = clocks[j]; | ||
ztimer_periodic_init(clock, &t, callback, clock, _intervals[j]); | ||
uint32_t last = ztimer_now(clock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other option is to use the internal value of ztimer_periodic_t
:
uint32_t last = ztimer_now(clock); | |
uint32_t last = t.last; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-running the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The situation improved a bit (offset is smaller) but the same BOARD's are still failing... :(
arduino-uno/failuresummary
Failures during test:
z1/failuresummary
Failures during test:
atmega256rfr2-xpro/failuresummary
Failures during test:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the arduino-uno, the ZTIMER_USEC
times are consistently bad, while on atmega256rfr2-xpro it works fine for all but the first timeout. I think both are running at 16 MHz, are using the same peripheral time and should have (almost) the same IPC, so I wonder what is causing the difference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So how do we move forward?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say the test is fine, but the implementation in AVR is flanky. I would like to debug this, but I currently don't have the time :-/
@maribu can you rebase now that the fixing PR's are in? |
66f6bd5
to
b3281d0
Compare
I cannot find any application with an |
You can drop Makefile.board.dep, that logic is now in master with https://github.com/RIOT-OS/RIOT/pull/16553/files, so I think a reabase would do |
tests/ztimer_periodic/Makefile
Outdated
# ztimer_msec needs an RTT frequency of at least 1 kHz for a resolution of | ||
# roughly 1 ms, but some boards set the RTT to 1 Hz by default. This should | ||
# work around this at least for STM32, nRF52, and SAM* | ||
ifneq (,$(filter stm32 nrf52 sam%,$(CPU))) | ||
RTT_FREQUENCY ?= RTT_MAX_FREQUENCY | ||
CFLAGS += -DRTT_FREQUENCY=$(RTT_FREQUENCY) | ||
endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be dropped with #16553
ifneq (,$(filter stm32 nrf52 sam%,$(CPU))) | ||
FEATURES_OPTIONAL += periph_rtt | ||
ifneq (,$(filter periph_rtt,$(FEATURES_USED))) | ||
USEMODULE += ztimer_periph_rtt | ||
endif | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file can be dropped with https://github.com/RIOT-OS/RIOT/pull/16553/files
Instead of only testing for `ZTIMER_MSEC`, iterate over a list of clocks and run the test for each. The reasoning is that this test does not only test `ztimer_periodic`, but also that the used clock backend operates correctly in a typical use case.
Tested that with the proposed rebase and changes Kconfig build is the same
|
b3281d0
to
258d384
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All my BOARDS are now passing, ACK!
Contribution description
Instead of only testing for
ZTIMER_MSEC
, iterate over a list ofclocks and run the test for each. The reasoning is that this test
does not only test
ztimer_periodic
, but also that the used clockbackend operates correctly in a typical use case.
Testing procedure
The test should still pass.
Issues/PRs references
Useful for #16172