kopia lustrzana https://github.com/bristol-seds/pico-tracker
Can now run individual test cases on hw
rodzic
a4b336c1b5
commit
b7d51b7f62
|
@ -250,6 +250,7 @@ TESTCASES := $(shell $(FIND) test/tc -name '*.[h]')
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: test/main.py all
|
test: test/main.py all
|
||||||
@echo "Running tests..."
|
@echo "Running tests..."
|
||||||
|
@echo $(tc) > test/.testcommand
|
||||||
$(DB) -q -x test/tests.py
|
$(DB) -q -x test/tests.py
|
||||||
|
|
||||||
# Ctypesgen for test
|
# Ctypesgen for test
|
||||||
|
|
|
@ -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`
|
also have gdbscript-custom. The test driver just issues an `attach 1`
|
||||||
command after gdb startup and expects that to work.
|
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
|
#### Operation
|
||||||
|
|
||||||
Initially `tests.py` loads the latest binary, and runs `Reset_Handler`
|
Initially `tests.py` loads the latest binary, and runs `Reset_Handler`
|
||||||
|
|
|
@ -147,6 +147,10 @@ class Tests():
|
||||||
fail = False
|
fail = False
|
||||||
ttime = 0
|
ttime = 0
|
||||||
if hasattr(test_case, 'iterations'):
|
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):
|
for i in range(test_case.iterations):
|
||||||
params = test_case.get_test()
|
params = test_case.get_test()
|
||||||
result = self.hw_run_tc(tc_name, params)
|
result = self.hw_run_tc(tc_name, params)
|
||||||
|
@ -158,6 +162,10 @@ class Tests():
|
||||||
else: # No result, Failure
|
else: # No result, Failure
|
||||||
fail = True
|
fail = True
|
||||||
else:
|
else:
|
||||||
|
"""This is for test cases that only run once or that use a pre-set
|
||||||
|
list of cases
|
||||||
|
|
||||||
|
"""
|
||||||
params = test_case.get_test()
|
params = test_case.get_test()
|
||||||
while (params):
|
while (params):
|
||||||
result = self.hw_run_tc(tc_name, params)
|
result = self.hw_run_tc(tc_name, params)
|
||||||
|
@ -195,6 +203,15 @@ class Tests():
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
t = Tests()
|
t = Tests()
|
||||||
|
|
||||||
|
# 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
|
# Run all testcases
|
||||||
for tc_name in tc.__all__:
|
for tc_name in tc.__all__:
|
||||||
t.run_test_case(t.get_testcase_from_name(tc_name)())
|
t.run_test_case(t.get_testcase_from_name(tc_name)())
|
||||||
|
|
Ładowanie…
Reference in New Issue