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).
This commit is contained in:
Damien George 2014-04-03 22:44:51 +01:00
parent d71fc37af7
commit 2309369291

View File

@ -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'