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

tests/pkg_*: refactor some test scripts

in pkg_c25519, pkg_libcose and pkg_tweetnacl, use the check_unittests helper function and rework the way the test TIMEOUT value is determined
This commit is contained in:
Alexandre Abadie 2020-03-18 17:48:24 +01:00
parent e9af310159
commit 10b7d5f922
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
3 changed files with 15 additions and 22 deletions

View File

@ -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))

View File

@ -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))

View File

@ -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__":