diff --git a/tests/pkg_c25519/tests/01-run.py b/tests/pkg_c25519/tests/01-run.py index 0513bf0547..03f41f2d9a 100755 --- a/tests/pkg_c25519/tests/01-run.py +++ b/tests/pkg_c25519/tests/01-run.py @@ -10,17 +10,15 @@ import os import sys +from testrunner import run_check_unittests +from testrunner import TIMEOUT as DEFAULT_TIMEOUT -def testfunc(child): - board = os.environ['BOARD'] - # Increase timeout on "real" hardware - # 170 seconds on `arduino-mega2560` - timeout = 200 if board != 'native' else -1 - child.expect(r"OK \(2 tests\)", timeout=timeout) + +BOARD = os.environ['BOARD'] +# Increase timeout on "real" hardware +# 170 seconds on `arduino-mega2560` +TIMEOUT = 200 if BOARD != 'native' else DEFAULT_TIMEOUT if __name__ == "__main__": - sys.path.append(os.path.join(os.environ['RIOTBASE'], - 'dist/tools/testrunner')) - from testrunner import run - sys.exit(run(testfunc)) + sys.exit(run_check_unittests(timeout=TIMEOUT)) diff --git a/tests/pkg_libcose/tests/01-run.py b/tests/pkg_libcose/tests/01-run.py index b1a37921bd..0118273127 100755 --- a/tests/pkg_libcose/tests/01-run.py +++ b/tests/pkg_libcose/tests/01-run.py @@ -8,20 +8,15 @@ import os import sys -from testrunner import run +from testrunner import run_check_unittests +from testrunner import TIMEOUT as DEFAULT_TIMEOUT +BOARD = os.environ['BOARD'] # on real hardware, this test application can take several minutes to # complete (~4min on microbit) -HW_TIMEOUT = 300 - - -def testfunc(child): - board = os.environ['BOARD'] - # Increase timeout on "real" hardware - timeout = HW_TIMEOUT if board != 'native' else -1 - child.expect(r'OK \(\d+ tests\)', timeout=timeout) +TIMEOUT = 300 if BOARD != 'native' else DEFAULT_TIMEOUT if __name__ == "__main__": - sys.exit(run(testfunc)) + sys.exit(run_check_unittests(timeout=TIMEOUT)) diff --git a/tests/pkg_tweetnacl/tests/01-run.py b/tests/pkg_tweetnacl/tests/01-run.py index 21d5cd8205..00e770623b 100755 --- a/tests/pkg_tweetnacl/tests/01-run.py +++ b/tests/pkg_tweetnacl/tests/01-run.py @@ -8,14 +8,14 @@ import os import sys -from testrunner import run +from testrunner import run, check_unittests def testfunc(child): board = os.environ['BOARD'] # Increase timeout on "real" hardware timeout = 120 if board != 'native' else -1 - child.expect(r'OK \(\d+ tests\)', timeout=timeout) + check_unittests(child, timeout=timeout) if __name__ == "__main__":