mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-16 20:52:58 +01:00
ea11de5258
The evtimer_msg test is expanded to also delete entries. Furthermore the messages that are printed should now show numbers that are very close (if not equal). Something like this: At 740 ms received msg 0: "#2 supposed to be 740" At 1081 ms received msg 1: "#0 supposed to be 1081" At 1581 ms received msg 2: "#1 supposed to be 1581" At 4035 ms received msg 3: "#3 supposed to be 4035" The function evtimer_print is also called to show the intermediate status of evtimer entries.
34 lines
1009 B
Python
Executable File
34 lines
1009 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
# Copyright (C) 2016 Freie Universität Berlin
|
|
#
|
|
# This file is subject to the terms and conditions of the GNU Lesser
|
|
# General Public License v2.1. See the file LICENSE in the top level
|
|
# directory for more details.
|
|
|
|
from __future__ import print_function
|
|
import sys
|
|
from testrunner import run
|
|
|
|
ACCEPTED_ERROR = 2
|
|
|
|
|
|
def testfunc(child):
|
|
child.expect(r"Testing generic evtimer")
|
|
child.expect(r"Are the reception times of all (\d+) msgs close to the supposed values?")
|
|
numof = int(child.match.group(1))
|
|
|
|
for i in range(numof):
|
|
child.expect(r'At \s*(\d+) ms received msg %i: "#\d+ supposed to be (\d+)"' % i)
|
|
# check if output is correct
|
|
expected = int(child.match.group(2))
|
|
actual = int(child.match.group(1))
|
|
assert(actual in range(expected - ACCEPTED_ERROR, expected + ACCEPTED_ERROR))
|
|
print(".", end="", flush=True)
|
|
print("")
|
|
print("All tests successful")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(run(testfunc))
|