Browse Source

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).
pull/421/head
Damien George 11 years ago
parent
commit
2309369291
  1. 12
      tests/run-tests

12
tests/run-tests

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

Loading…
Cancel
Save