def run(cmdline_args): optparser = OptionParser() optparser.add_option('-o', '--output', dest='output', action='store', help='output file name') optparser.add_option('--ulba', dest='ulba', action='store', default='default', help='Upper Linear Base Address for output HEX file') if len(cmdline_args) == 0: optparser.print_help() return options, args = optparser.parse_args(cmdline_args) out_filename = options.output or 'image.hex' in_filenames = reduce(operator.add, [glob.glob(pat) for pat in args], []) if options.ulba == 'default': ulba = 0 else: ulba = int(options.ulba, 16) assemble_binary(in_filenames, out_filename, ulba) printme('Created output file: %s...' % out_filename)
def run_all(startdir='.'): t1 = time.time() for subdir in subdirs(startdir, excludes=set(['.svn'])): try: printme('Test %s...' % subdir) status = run_test_dir(subdir) printme(status + '\n') except Exception: printme('Caught exception for dir: %s\n' % subdir) raise printme('------------------------------------------------------\n') printme('Elapsed: %.3fs\n' % (time.time() - t1))
def run_all(startdir='.'): t1 = time.time() for dir in os.listdir(startdir): if not os.path.isdir(dir): continue if not dir.startswith(('.svn', '__')): subdir = os.path.join(startdir, dir) try: printme('Test %s...' % subdir) status = run_test_dir(subdir) printme(status + '\n') except Exception: printme('Caught exception for dir: %s\n' % subdir) raise printme('------------------------------------------------------\n') printme('Elapsed: %.3fs\n' % (time.time() - t1))
optparser.add_option('-i', '--interactive', dest='interactive', action='store_true', help='run interactive debugger') optparser.set_defaults(interactive=False) # Parse command-line arguments. 'args' should be a single test name options, args = optparser.parse_args() if len(args) < 1: optparser.print_help() sys.exit(1) asmfiles = [] for file in os.listdir(os.path.join('.', args[0])): path = os.path.join(args[0], file) if os.path.splitext(path)[1] == '.lasm': asmfiles.append(path) img = link_asmfiles(asmfiles) if options.interactive: interactive_cli_sim(img) else: sim = LuzSim(img, debug_print=True) sim.run() printme('Finished successfully...\n') printme('Debug queue contents:\n') printme(map(lambda n: '0x%X' % n, sim.debugq.items)) printme('\n')