diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-03 22:44:51 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-03 22:44:51 +0100 |
commit | 23093692912c6c5538f4ada461bc7c1833260127 (patch) | |
tree | 40e402c04b9447a1e61a1c794bef8ea0f624d61f /tests | |
parent | d71fc37af7a76df545c69b108e35edfd129ad1f1 (diff) | |
download | micropython-23093692912c6c5538f4ada461bc7c1833260127.tar.gz micropython-23093692912c6c5538f4ada461bc7c1833260127.zip |
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).
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/run-tests | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/run-tests b/tests/run-tests index 86b7d14e1c..1d99830bc6 100755 --- a/tests/run-tests +++ b/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' |