4949STATUS_SKIPPED = "\033 [33mSkipped\033 [0m"
5050
5151verbose = False
52+ test_only = []
5253
5354WCH_RISCV_CONTENT = """
5455adapter driver wlinke
@@ -145,8 +146,11 @@ def open_mtp_dev(uid):
145146 # run_cmd(f"gio mount -u mtp://TinyUsb_TinyUsb_Device_{uid}/")
146147 for raw in mtp .detect_devices ():
147148 mtp .device = mtp .mtp .LIBMTP_Open_Raw_Device (ctypes .byref (raw ))
148- if mtp .device and mtp .get_serialnumber ().decode ('utf-8' ) == uid :
149- return mtp
149+ if mtp .device :
150+ sn = mtp .get_serialnumber ().decode ('utf-8' )
151+ #print(f'mtp serial = {sn}')
152+ if sn == uid :
153+ return mtp
150154 time .sleep (1 )
151155 timeout -= 1
152156 return None
@@ -579,7 +583,7 @@ def test_device_mtp(board):
579583 'device/dfu_runtime' ,
580584 'device/cdc_msc_freertos' ,
581585 'device/hid_boot_interface' ,
582- 'device/mtp'
586+ # 'device/mtp'
583587]
584588
585589dual_tests = [
@@ -656,21 +660,24 @@ def test_board(board):
656660 # default to all tests
657661 test_list = []
658662
659- if 'tests' in board :
660- board_tests = board ['tests' ]
661- if 'device' in board_tests and board_tests ['device' ] == True :
662- test_list += list (device_tests )
663- if 'dual' in board_tests and board_tests ['dual' ] == True :
664- test_list += dual_tests
665- if 'host' in board_tests and board_tests ['host' ] == True :
666- test_list += host_test
667- if 'only' in board_tests :
668- test_list = board_tests ['only' ]
669- if 'skip' in board_tests :
670- for skip in board_tests ['skip' ]:
671- if skip in test_list :
672- test_list .remove (skip )
673- print (f'{ name :25} { skip :30} ... Skip' )
663+ if len (test_only ) > 0 :
664+ test_list = test_only
665+ else :
666+ if 'tests' in board :
667+ board_tests = board ['tests' ]
668+ if 'device' in board_tests and board_tests ['device' ] == True :
669+ test_list += list (device_tests )
670+ if 'dual' in board_tests and board_tests ['dual' ] == True :
671+ test_list += dual_tests
672+ if 'host' in board_tests and board_tests ['host' ] == True :
673+ test_list += host_test
674+ if 'only' in board_tests :
675+ test_list = board_tests ['only' ]
676+ if 'skip' in board_tests :
677+ for skip in board_tests ['skip' ]:
678+ if skip in test_list :
679+ test_list .remove (skip )
680+ print (f'{ name :25} { skip :30} ... Skip' )
674681
675682 err_count = 0
676683 flags_on_list = ["" ]
@@ -692,20 +699,23 @@ def main():
692699 Hardware test on specified boards
693700 """
694701 global verbose
702+ global test_only
695703
696704 duration = time .time ()
697705
698706 parser = argparse .ArgumentParser ()
699707 parser .add_argument ('config_file' , help = 'Configuration JSON file' )
700708 parser .add_argument ('-b' , '--board' , action = 'append' , default = [], help = 'Boards to test, all if not specified' )
701709 parser .add_argument ('-s' , '--skip' , action = 'append' , default = [], help = 'Skip boards from test' )
710+ parser .add_argument ('-t' , '--test-only' , action = 'append' , default = [], help = 'Tests to run, all if not specified' )
702711 parser .add_argument ('-v' , '--verbose' , action = 'store_true' , help = 'Verbose output' )
703712 args = parser .parse_args ()
704713
705714 config_file = args .config_file
706715 boards = args .board
707716 skip_boards = args .skip
708717 verbose = args .verbose
718+ test_only = args .test_only
709719
710720 # if config file is not found, try to find it in the same directory as this script
711721 if not os .path .exists (config_file ):
0 commit comments