Skip to content
Snippets Groups Projects
Commit 4fb7939a authored by Martine Lenders's avatar Martine Lenders
Browse files

unittests: add new test runner script

parent 55044512
No related branches found
No related tags found
No related merge requests found
...@@ -78,8 +78,5 @@ else ...@@ -78,8 +78,5 @@ else
CFLAGS += -DTEST_SUITES='$(subst $() $(),$(charCOMMA),$(UNIT_TESTS:tests-%=%))' CFLAGS += -DTEST_SUITES='$(subst $() $(),$(charCOMMA),$(UNIT_TESTS:tests-%=%))'
endif endif
test: SHELL=bash
test: test:
@exec 5>&1 && \ ./tests/01-run.py
LOG=$$("$(MAKE)" -s term | tee >(cat - >&5)) && \
grep 'OK ([1-9][0-9]* tests)' <<< $${LOG} > /dev/null
#!/usr/bin/env python
# Copyright (C) 2014 Martine Lenders <mlenders@inf.fu-berlin.de>
#
# 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.
import os, signal, sys, subprocess
from pexpect import spawn, TIMEOUT, EOF
DEFAULT_TIMEOUT = 5
def main():
env = os.environ.copy()
child = spawn("make term", env=env, timeout=DEFAULT_TIMEOUT)
child.logfile = sys.stdout
try:
subprocess.check_output(('make', 'reset'), env=env,
stderr=subprocess.PIPE)
except subprocess.CalledProcessError:
# make reset yields error on some boards even if successful
pass
try:
child.expect(r"OK \([0-9]+ tests\)")
except TIMEOUT:
print("There where errors in the unittests")
return 1
finally:
print("")
child.close()
return 0
if __name__ == "__main__":
sys.exit(main())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment