1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

dist/testrunner: add common function to check unittests

This commit is contained in:
Alexandre Abadie 2020-03-12 13:42:35 +01:00
parent df1719d2e8
commit fb643b348b
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405

View File

@ -9,6 +9,7 @@
import os
import sys
from functools import partial
from traceback import print_tb
import pexpect
@ -44,3 +45,16 @@ def run(testfunc, timeout=TIMEOUT, echo=True, traceback=False):
print("")
teardown_child(child)
return 0
def check_unittests(child, timeout=TIMEOUT, nb_tests=None):
_tests = r'\d+' if nb_tests is None else int(nb_tests)
child.expect(r'OK \({} tests\)'.format(_tests), timeout=timeout)
def run_check_unittests(timeout=TIMEOUT, echo=True, traceback=False,
nb_tests=None):
_unittests_func = partial(check_unittests,
timeout=timeout, nb_tests=nb_tests)
return run(_unittests_func, timeout, echo, traceback)