@@ -349,6 +349,8 @@ def run_tests(pyb, tests, args, base_path="."):
349349 for t in tests :
350350 if t .startswith ('basics/io_' ):
351351 skip_tests .add (t )
352+ elif args .target == 'qemu-arm' :
353+ skip_tests .add ('misc/print_exception.py' ) # requires sys stdfiles
352354
353355 # Some tests are known to fail on 64-bit machines
354356 if pyb is None and platform .architecture ()[0 ] == '64bit' :
@@ -527,8 +529,9 @@ the last matching regex is used:
527529 cmd_parser .add_argument ('files' , nargs = '*' , help = 'input test files' )
528530 args = cmd_parser .parse_args ()
529531
532+ LOCAL_TARGETS = ('unix' , 'qemu-arm' ,)
530533 EXTERNAL_TARGETS = ('pyboard' , 'wipy' , 'esp8266' , 'esp32' , 'minimal' , 'nrf' )
531- if args .target == 'unix' or args .list_tests :
534+ if args .target in LOCAL_TARGETS or args .list_tests :
532535 pyb = None
533536 elif args .target in EXTERNAL_TARGETS :
534537 global pyboard
@@ -537,24 +540,28 @@ the last matching regex is used:
537540 pyb = pyboard .Pyboard (args .device , args .baudrate , args .user , args .password )
538541 pyb .enter_raw_repl ()
539542 else :
540- raise ValueError ('target must be either %s or unix ' % ", " .join (EXTERNAL_TARGETS ))
543+ raise ValueError ('target must be one of %s ' % ", " .join (LOCAL_TARGETS + EXTERNAL_TARGETS ))
541544
542545 if len (args .files ) == 0 :
543546 if args .test_dirs is None :
547+ test_dirs = ('basics' , 'micropython' , 'misc' , 'extmod' ,)
544548 if args .target == 'pyboard' :
545549 # run pyboard tests
546- test_dirs = ('basics' , 'micropython' , ' float' , 'misc' , ' stress' , 'extmod ' , 'pyb' , 'pybnative' , 'inlineasm' )
550+ test_dirs + = ('float' , 'stress' , 'pyb' , 'pybnative' , 'inlineasm' )
547551 elif args .target in ('esp8266' , 'esp32' , 'minimal' , 'nrf' ):
548- test_dirs = ('basics' , 'micropython' , ' float' , 'misc' , 'extmod' )
552+ test_dirs + = ('float' ,)
549553 elif args .target == 'wipy' :
550554 # run WiPy tests
551- test_dirs = ('basics' , 'micropython' , 'misc' , 'extmod' , ' wipy' )
552- else :
555+ test_dirs + = ('wipy' , )
556+ elif args . target == 'unix' :
553557 # run PC tests
554- test_dirs = (
555- 'basics' , 'micropython' , 'float' , 'import' , 'io' , 'misc' ,
556- 'stress' , 'unicode' , 'extmod' , 'unix' , 'cmdline' ,
557- )
558+ test_dirs += ('float' , 'import' , 'io' , 'stress' , 'unicode' , 'unix' , 'cmdline' ,)
559+ elif args .target == 'qemu-arm' :
560+ if not args .write_exp :
561+ raise ValueError ('--target=qemu-arm must be used with --write-exp' )
562+ # Generate expected output files for qemu run.
563+ # This list should match the test_dirs tuple in tinytest-codegen.py.
564+ test_dirs += ('float' , 'inlineasm' , 'qemu-arm' ,)
558565 else :
559566 # run tests from these directories
560567 test_dirs = args .test_dirs
0 commit comments