Commit 23093692 authored by Damien George's avatar Damien George
Browse files

tests: Allow to run tests on pyboard.

To run the tests on the pyboard you need to set the "test_on_pyboard"
variable to "True", and also have tools/pyboard.py available for import
(easiest is to symlink to it).
parent d71fc37a
......@@ -27,12 +27,22 @@ if not sys.argv[1:]:
else:
tests = sys.argv[1:]
test_on_pyboard = False
if test_on_pyboard:
import pyboard
pyb = pyboard.Pyboard('/dev/ttyACM0')
pyb.enter_raw_repl()
for test_file in tests:
test_name = os.path.splitext(os.path.basename(test_file))[0]
output_expected = subprocess.check_output([CPYTHON3, '-B', test_file])
try:
output_mupy = subprocess.check_output([MP_PY, test_file])
if test_on_pyboard:
pyb.enter_raw_repl()
output_mupy = pyb.execfile(test_file).replace(b'\r\n', b'\n')
else:
output_mupy = subprocess.check_output([MP_PY, test_file])
except subprocess.CalledProcessError:
output_mupy = b'CRASH'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment