Exemplo n.º 1
0
def run_test_dir(dirpath):
    """ Runs a single full test, given its directory path
    """
    testfile = None
    asmfiles = []

    for file in os.listdir(dirpath):
        path = os.path.join(dirpath, file)

        if file == '_test.py':
            testfile = path
        elif os.path.splitext(path)[1] == '.lasm':
            asmfiles.append(path)

    if not asmfiles:
        return 'Empty'

    img = link_asmfiles(asmfiles)

    # Simulate
    sim = LuzSim(img)
    sim.run()

    # Run all the test functions for this test and make sure
    # they pass
    for testfunc in get_test_functions(testfile):
        if not testfunc(sim):
            raise FullTestError('failed %s in %s' %
                                (testfunc.__name__, dirpath))
    return 'OK'
Exemplo n.º 2
0
def run_test_dir(dirpath):
    """ Runs a single full test, given its directory path
    """
    testfile = None
    asmfiles = []

    for file in os.listdir(dirpath):
        path = os.path.join(dirpath, file)

        if file == '_test.py':
            testfile = path
        elif os.path.splitext(path)[1] == '.lasm':
            asmfiles.append(path)

    if not asmfiles:
        return 'Empty'

    img = link_asmfiles(asmfiles)

    # Simulate
    sim = LuzSim(img)
    sim.run()

    # Run all the test functions for this test and make sure
    # they pass
    for testfunc in get_test_functions(testfile):
        if not testfunc(sim):
            raise FullTestError('failed %s in %s' % (
                    testfunc.__name__, dirpath))
    return 'OK'
Exemplo n.º 3
0
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')