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:
parent
e9af310159
commit
10b7d5f922
@ -10,17 +10,15 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from testrunner import run_check_unittests
|
||||||
|
from testrunner import TIMEOUT as DEFAULT_TIMEOUT
|
||||||
|
|
||||||
def testfunc(child):
|
|
||||||
board = os.environ['BOARD']
|
BOARD = os.environ['BOARD']
|
||||||
# Increase timeout on "real" hardware
|
# Increase timeout on "real" hardware
|
||||||
# 170 seconds on `arduino-mega2560`
|
# 170 seconds on `arduino-mega2560`
|
||||||
timeout = 200 if board != 'native' else -1
|
TIMEOUT = 200 if BOARD != 'native' else DEFAULT_TIMEOUT
|
||||||
child.expect(r"OK \(2 tests\)", timeout=timeout)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.path.append(os.path.join(os.environ['RIOTBASE'],
|
sys.exit(run_check_unittests(timeout=TIMEOUT))
|
||||||
'dist/tools/testrunner'))
|
|
||||||
from testrunner import run
|
|
||||||
sys.exit(run(testfunc))
|
|
||||||
|
|||||||
@ -8,20 +8,15 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
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
|
# on real hardware, this test application can take several minutes to
|
||||||
# complete (~4min on microbit)
|
# complete (~4min on microbit)
|
||||||
HW_TIMEOUT = 300
|
TIMEOUT = 300 if BOARD != 'native' else DEFAULT_TIMEOUT
|
||||||
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(run(testfunc))
|
sys.exit(run_check_unittests(timeout=TIMEOUT))
|
||||||
|
|||||||
@ -8,14 +8,14 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from testrunner import run
|
from testrunner import run, check_unittests
|
||||||
|
|
||||||
|
|
||||||
def testfunc(child):
|
def testfunc(child):
|
||||||
board = os.environ['BOARD']
|
board = os.environ['BOARD']
|
||||||
# Increase timeout on "real" hardware
|
# Increase timeout on "real" hardware
|
||||||
timeout = 120 if board != 'native' else -1
|
timeout = 120 if board != 'native' else -1
|
||||||
child.expect(r'OK \(\d+ tests\)', timeout=timeout)
|
check_unittests(child, timeout=timeout)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user