Can now run individual test cases on hw

master
Richard Meadows 2015-06-28 18:46:04 +01:00
rodzic a4b336c1b5
commit b7d51b7f62
3 zmienionych plików z 37 dodań i 3 usunięć

Wyświetl plik

@ -250,6 +250,7 @@ TESTCASES := $(shell $(FIND) test/tc -name '*.[h]')
.PHONY: test
test: test/main.py all
@echo "Running tests..."
@echo $(tc) > test/.testcommand
$(DB) -q -x test/tests.py
# Ctypesgen for test

Wyświetl plik

@ -17,6 +17,22 @@ You need to have your debugger configured in config.mk and possibly
also have gdbscript-custom. The test driver just issues an `attach 1`
command after gdb startup and expects that to work.
##### From the makefile
From the main firmware makefile you can just run
```
make test
```
to run all tests, or
```
make test tc=<tc name>
```
to run a specific test case
#### Operation
Initially `tests.py` loads the latest binary, and runs `Reset_Handler`

Wyświetl plik

@ -147,6 +147,10 @@ class Tests():
fail = False
ttime = 0
if hasattr(test_case, 'iterations'):
"""This is for test cases that need to be run multiple time to check
the result is always correct
"""
for i in range(test_case.iterations):
params = test_case.get_test()
result = self.hw_run_tc(tc_name, params)
@ -158,6 +162,10 @@ class Tests():
else: # No result, Failure
fail = True
else:
"""This is for test cases that only run once or that use a pre-set
list of cases
"""
params = test_case.get_test()
while (params):
result = self.hw_run_tc(tc_name, params)
@ -195,8 +203,17 @@ class Tests():
if __name__ == '__main__':
t = Tests()
# Run all testcases
for tc_name in tc.__all__:
t.run_test_case(t.get_testcase_from_name(tc_name)())
# Read in our command file
with open("./test/.testcommand") as f:
tc_name = f.readline().strip('\n')
if tc_name in tc.__all__:
# If we've been commanded to run a test
t.run_test_case(t.get_testcase_from_name(tc_name)())
else:
# Run all testcases
for tc_name in tc.__all__:
t.run_test_case(t.get_testcase_from_name(tc_name)())
del t