[riot-notifications] [RIOT-OS/RIOT] tests/xtimer_usleep: recognize negative offset (#11493)

Francisco notifications at github.com
Mon May 13 11:13:33 CEST 2019


Ok so we have an agreement over the expected behaviour for` xtimer_usleep(TARGET_TIME)`. I still think the test is wrong, it should recognize the negative offset but fail according to this. Right now the test is defining an upper and lower 5% error margin for the sleep time (INTERNAL_JITTER). 

Nonetheless since the expect REGEX is not capturing negative values it is failing whatever negative value it is getting but not in the right way. I have changed the test so the lower bound is equal to TARGET_TIME and the upper bound keeps the 5% margin. 

The result is having the test fail as:

```
2019-05-13 11:02:14,078 - INFO # main(): This is RIOT! (Version: 2019.07-devel-162-gcd0ab-pr_xtimer_doc)
2019-05-13 11:02:14,081 - INFO # Running test 5 times with 7 distinct sleep times
2019-05-13 11:02:14,083 - INFO # Please hit any key and then ENTER to continue
a
2019-05-13 11:02:14,155 - INFO # Slept for 9979 us (expected: 10000 us) Offset: -21 us
Invalid timeout 9979 ,expected 10000 < timeout < 10500
Host max error  500
error           -21
```

Instead of:
```
2019-05-13 11:03:02,812 - INFO # Slept for 12116 us (expected: 12122 us) Offset: -6 us
2019-05-13 11:03:02,922 - INFO # Slept for 98754 us (expected: 98765 us) Offset: -11 us
2019-05-13 11:03:02,997 - INFO # Slept for 74981 us (expected: 75000 us) Offset: -19 us
2019-05-13 11:03:02,998 - INFO # Test ran for 1732575 us
Timeout in expect script at "child.expect(u"Slept for (\\d+) us \\(expected: (\\d+) us\\) Offset: (\\d+) us")" (tests/xtimer_usleep/tests/01-run.py:36)
```

@cladmi @kaspar030 Does this change make sense?


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11493#issuecomment-491742667
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190513/a1466706/attachment-0001.html>


More information about the notifications mailing list