tests/xtimer_now_irq: don't fail for 32bit timers

This commit is contained in:
Francisco Molina 2020-07-15 16:29:07 +02:00
parent 772b638d2a
commit 6bb765a362
No known key found for this signature in database
GPG Key ID: 3E94EAC3DBDEEDA8
2 changed files with 25 additions and 17 deletions

View File

@ -26,22 +26,27 @@
int main(void)
{
puts("xtimer_now_irq test application.\n");
uint8_t count = TEST_COUNT;
while (count) {
unsigned int state = irq_disable();
uint32_t t1 = xtimer_now_usec();
xtimer_spin(xtimer_ticks((uint32_t)(~XTIMER_MASK) / 2));
uint32_t t2 = xtimer_now_usec();
irq_restore(state);
if (t2 < t1) {
puts("ERROR: wrong time with interrupts disabled");
return -1;
}
puts("OK");
count --;
if (XTIMER_WIDTH == 32) {
puts("Nothing to do for 32 bit timers.\n");
}
else {
puts("xtimer_now_irq test application.\n");
uint8_t count = TEST_COUNT;
while (count) {
unsigned int state = irq_disable();
uint32_t t1 = xtimer_now_usec();
xtimer_spin(xtimer_ticks((uint32_t)(~XTIMER_MASK) / 2));
uint32_t t2 = xtimer_now_usec();
irq_restore(state);
if (t2 < t1) {
puts("ERROR: wrong time with interrupts disabled");
return -1;
}
puts("OK");
count --;
}
}
puts("SUCCESS");
return 0;
}

View File

@ -15,8 +15,11 @@ TIMEOUT = 20
def testfunc(child):
for _ in range(4):
child.expect_exact("OK", timeout=TIMEOUT)
res = child.expect(['Nothing to do for 32 bit timers.\r\n',
'xtimer_now_irq test application.\r\n'])
if res == 1:
for _ in range(4):
child.expect_exact("OK", timeout=TIMEOUT)
child.expect_exact("SUCCESS")