# Print available tests in order and exit if options.list_tests is True: print '\n'.join(map(str, sorted(TEST_MAP.values()))) sys.exit() # force program to "0" if a source dir is specified if options.source_dir is not None: p = 0 n = None else: # Program Number or name p, n = options.program, options.program_name if n is not None and p is not None: args_error(parser, "[ERROR] specify either '-n' or '-p', not both") if n: if not n in TEST_MAP.keys(): # Check if there is an alias for this in private_settings.py if getattr(ps, "test_alias", None) is not None: alias = ps.test_alias.get(n, "") if not alias in TEST_MAP.keys(): args_error(parser, "[ERROR] Program with name '%s' not found" % n) else: n = alias p = TEST_MAP[n].n if p is None or (p < 0) or (p > (len(TESTS)-1)): message = "[ERROR] You have to specify one of the following tests:\n" message += '\n'.join(map(str, sorted(TEST_MAP.values()))) args_error(parser, message)
# Print available tests in order and exit if options.list_tests is True: print '\n'.join(map(str, sorted(TEST_MAP.values()))) sys.exit() # force program to "0" if a source dir is specified if options.source_dir is not None: p = 0 n = None else: # Program Number or name p, n = options.program, options.program_name if n is not None and p is not None: args_error(parser, "[ERROR] specify either '-n' or '-p', not both") if n: # We will transform 'n' to list of 'p' (integers which are test numbers) nlist = n.split(',') for test_id in nlist: if test_id not in TEST_MAP.keys(): args_error( parser, "[ERROR] Program with name '%s' not found" % test_id) p = [TEST_MAP[n].n for n in nlist] elif p is None or (p < 0) or (p > (len(TESTS) - 1)): message = "[ERROR] You have to specify one of the following tests:\n" message += '\n'.join(map(str, sorted(TEST_MAP.values()))) args_error(parser, message)
help="generate project for the given MCU (%s)" % ', '.join(TARGET_NAMES)) parser.add_option("-p", type="int", dest="program", help="The index of the desired test program: [0-%d]" % (len(TESTS)-1)) parser.add_option("-i", dest="ide", default='uvision', help="The target IDE: %s" % str(EXPORTERS.keys())) parser.add_option("-b", dest="build", action="store_true", default=False, help="Use the mbed library build, instead of the sources") (options, args) = parser.parse_args() # Target if options.mcu is None : args_error(parser, "[ERROR] You should specify an MCU") mcu = options.mcu # IDE if options.ide is None: args_error(parser, "[ERROR] You should specify an IDE") ide = options.ide # Project if options.program is None or (options.program < 0) or (options.program > (len(TESTS)-1)): message = "[ERROR] You have to specify one of the following tests:\n" message += '\n'.join(map(str, sorted(TEST_MAP.values()))) args_error(parser, message) test = Test(options.program) if not options.build:
dest="ide", default='uvision', help="The target IDE: %s" % str(EXPORTERS.keys())) parser.add_option( "-b", dest="build", action="store_true", default=False, help="Use the mbed library build, instead of the sources") (options, args) = parser.parse_args() # Target if options.mcu is None: args_error(parser, "[ERROR] You should specify an MCU") mcu = options.mcu # IDE if options.ide is None: args_error(parser, "[ERROR] You should specify an IDE") ide = options.ide # Project if options.program is None or (options.program < 0) or (options.program > (len(TESTS) - 1)): message = "[ERROR] You have to specify one of the following tests:\n" message += '\n'.join(map(str, sorted(TEST_MAP.values()))) args_error(parser, message) test = Test(options.program)
default=None, help="The mbed serial baud rate") # Ideally, all the tests with a single "main" thread can be run with, or # without the rtos parser.add_option("--rtos", action="store_true", dest="rtos", default=False, help="Link to the rtos") # Specify a different linker script parser.add_option("-l", "--linker", dest="linker_script", default=None, help="use the specified linker script") (options, args) = parser.parse_args() # Target if options.mcu is None : args_error(parser, "[ERROR] You should specify an MCU") mcu = options.mcu # Toolchain if options.tool is None: args_error(parser, "[ERROR] You should specify a TOOLCHAIN") toolchain = options.tool target = TARGET_MAP[mcu] passed_tests = [] failed_tests = [] try: for p in range(len(TEST_MAP)): # Test