-
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: New test for xtimer_now with interrupts disabled #13025
tests: New test for xtimer_now with interrupts disabled #13025
Conversation
tests/xtimer_now_irq/Makefile.ci
Outdated
@@ -0,0 +1,10 @@ | |||
BOARD_INSUFFICIENT_MEMORY := \ |
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.
we should re-check this because the test is actually rather small
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 checked the list and it seems to fit all these boards just fine - so why are they listed as insufficient memory?
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 will remove it.
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 think the test can be improved and a Python test script should be added to allow automatic testing. The suggestions below should help with the script.
ping @aabadie! |
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 found new problems with the current version.
@aabadie @MichelRottleuthner |
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 "interpreting the XTIMER_MASK as usecs doesn't make sense" isn't addressed yet
@MichelRottleuthner I changed the README last week. What do you think now? |
Apart from the |
@aabadie how bout now? |
The pinetime errors are unrelated, fix for those is here: #13481 |
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.
As is, this will be run on the CI, but always timeout. CI jobs time out after 5 minutes.
I suggest to CI blacklist this test (until there's a board with a reasonable bit width for xtimer, e.g., at most 24).
This also needs some squashing. |
while (count) { | ||
unsigned int state = irq_disable(); | ||
uint32_t t1 = xtimer_now_usec(); | ||
xtimer_spin(xtimer_ticks((uint32_t)(~XTIMER_MASK) / 2)); |
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 32bit 1mhz, this will spin (0xffffffff / 2)
ticks. Doesn't that make the second iteration always fail?
- xtimer_now() is somewhere a little higher than zero, so is t1
- spin half period
- t2 is now somewhere a little higher than a half period
- next loop iteration, t1 is now close to t2 (a little higher than a half period)
- spin half period
t232bit xtimer_now_usec() overflows ("a little higher than a half period" + "half period" > full period)- t2 < t1, error triggers
What am I missing?
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.
Running it as is for 32 bit timer is madness anyway and we need a better way for testing these corner cases with a bit of mock magic.
Catching the "missed overflow" of the 32 bit timer with the 32 bit xtimer interface obviously doesn't make sense, the 64 bit variant is needed for that ;)
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.
Alright, how about straight passing if XTIMER_WIDTH == 32
?
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.
Ahh just passing it would feel like lying. Why not just replace the uint32_t t1 = xtimer_now_usec();
etc. with the 64 bit variants? Then it works for 32 bit too.
Hmm I guess the problem is then we have no way to CI-run it for 16 bit timers and keep it working for manual 32 bit testing?.
How about an additional flag for manual running of 32 bit + some terminal output warning about 32 bit not being checked without that flag?
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.
Ahh just passing it would feel like lying. Why not just replace the
uint32_t t1 = xtimer_now_usec();
etc. with the 64 bit variants? Then it works for 32 bit too.
yyyyyes, but isn't that testing something different then?
How about an additional flag for manual running of 32 bit + some terminal output warning about 32 bit not being checked without that flag?
As long as by default on 32bit on CI, this just prints "not testing anything" "OK", so CI just passes. Could also blacklist.
As is it shouldn't run at all, on 32bit, just so noone actually waits 2**32usec for something to happen. 😉
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.
yyyyyes, but isn't that testing something different then?
Didn't test yet, but no not really
As long as by default on 32bit on CI, this just prints "not testing anything" "OK", so CI just passes
I'd prefer some "not testing anything" "OK" over blacklisting.
just so noone actually waits 2**32usec
I definitely had cases when testing timer stuff that made me desperate enough too run such long running tests^^
@MichelRottleuthner @kaspar030 |
why is this automatically:
Because of |
If anything then <= 24, but actually 32 bit would still be possible when using 64 bit API. In any case 32 Bit must be optional (i.e. only for manual testing). I'd also vote against blacklisting it for all boards - why not CI-run it for 16 and 24 bit?
take a look at https://github.com/RIOT-OS/RIOT/blob/master/CODEOWNERS |
I thought @kaspar030 wanted it this way. (only <24 bit and blacklist all)
Have i misunderstood something? |
dbbfdb7
to
7db72ee
Compare
@MichelRottleuthner @kaspar030 squashed and all comments addressed. |
ping @kaspar030 all good now? |
This test checks, if the timer returns the correct time (xtimer_now_usec() is called), when interrupts are disabled. Specifically tested is if the time is correct after a low-level timer overflow.
7db72ee
to
921d9cf
Compare
new rebase (no changes) |
@kaspar030 Can we merge? |
@kaspar030 would you mind removing your block on this one? All your requests should be addressed. |
Contribution description
This is a new test for xtimer. It tests if xtimer now (
xtimer_now_usec
) returns the correct value when interrupts are disabled.This test is for: #9530
Testing procedure
BOARD=* make -C tests/xtimer_now_irq/ flash term
replace * with boardIf it returns an Error it is not correct.
Issues/PRs references
#9530