Skip to content

Commit 186b355

Browse files
Daniel Camporadpgeorge
authored andcommitted
tests: Add support for the WiPy in run-tests script.
The --pyboard param has been replaced by --target which defaults to 'unix'. Possible values at this moment are 'unix', 'pyboard' and 'wipy'. Now is also possible to select the baud rate of the serial device when calling the script.
1 parent 0d3e309 commit 186b355

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

tests/run-tests

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,17 @@ def run_tests(pyb, tests, args):
147147
skip_tests.add('float/float2int_doubleprec.py') # requires double precision floating point to work
148148
skip_tests.add('micropython/meminfo.py') # output is very different to PC output
149149

150+
if args.target == 'wipy':
151+
skip_tests.add('misc/print_exception.py') # requires error reporting full
152+
skip_tests.add('misc/recursion.py') # requires stack checking enabled
153+
skip_tests.add('misc/recursive_data.py') # requires stack checking enabled
154+
skip_tests.add('misc/recursive_iternext.py') # requires stack checking enabled
155+
skip_tests.add('misc/rge_sm.py') # requires floating point
156+
skip_tests.update({'extmod/uctypes_%s.py' % t for t in 'bytearray le native_le ptr_le ptr_native_le sizeof sizeof_native'.split()}) # requires uctypes
157+
skip_tests.add('extmod/zlibd_decompress.py') # requires zlib
158+
skip_tests.add('extmod/ujson_dumps.py') # requires floating point
159+
skip_tests.add('extmod/ujson_loads.py') # requires floating point
160+
150161
# Some tests are known to fail on 64-bit machines
151162
if pyb is None and platform.architecture()[0] == '64bit':
152163
pass
@@ -254,29 +265,35 @@ def run_tests(pyb, tests, args):
254265

255266
def main():
256267
cmd_parser = argparse.ArgumentParser(description='Run tests for Micro Python.')
257-
cmd_parser.add_argument('--pyboard', action='store_true', help='run the tests on the pyboard')
258-
cmd_parser.add_argument('--device', default='/dev/ttyACM0', help='the serial device of the pyboard')
268+
cmd_parser.add_argument('--target', default='unix', help='the target platform')
269+
cmd_parser.add_argument('--device', default='/dev/ttyACM0', help='the serial device of the target board')
259270
cmd_parser.add_argument('-d', '--test-dirs', nargs='*', help='input test directories (if no files given)')
260271
cmd_parser.add_argument('--write-exp', action='store_true', help='save .exp files to run tests w/o CPython')
261272
cmd_parser.add_argument('--emit', default='bytecode', help='Micro Python emitter to use (bytecode or native)')
273+
cmd_parser.add_argument('-b', '--baudrate', default=115200, help='the baud rate of the serial device')
262274
cmd_parser.add_argument('files', nargs='*', help='input test files')
263275
args = cmd_parser.parse_args()
264276

265-
if args.pyboard:
277+
if args.target == 'pyboard' or args.target == 'wipy':
266278
import pyboard
267-
pyb = pyboard.Pyboard(args.device)
279+
pyb = pyboard.Pyboard(args.device, args.baudrate)
268280
pyb.enter_raw_repl()
269-
else:
281+
elif args.target == 'unix':
270282
pyb = None
283+
else:
284+
raise ValueError('target must be either unix, pyboard or wipy')
271285

272286
if len(args.files) == 0:
273287
if args.test_dirs is None:
274-
if pyb is None:
275-
# run PC tests
276-
test_dirs = ('basics', 'micropython', 'float', 'import', 'io', 'misc', 'unicode', 'extmod', 'unix', 'cmdline')
277-
else:
288+
if args.target == 'pyboard':
278289
# run pyboard tests
279290
test_dirs = ('basics', 'micropython', 'float', 'misc', 'extmod', 'pyb', 'pybnative', 'inlineasm')
291+
elif args.target == 'wipy':
292+
# run WiPy tests
293+
test_dirs = ('basics', 'micropython', 'misc', 'extmod')
294+
else:
295+
# run PC tests
296+
test_dirs = ('basics', 'micropython', 'float', 'import', 'io', 'misc', 'unicode', 'extmod', 'unix', 'cmdline')
280297
else:
281298
# run tests from these directories
282299
test_dirs = args.test_dirs

0 commit comments

Comments
 (0)