Пример #1
0
def runDisassemblerTest(target, testcases):
    print 'Running disassembler test {}...'.format(target)
    tdir = tempfile.mkdtemp()

    classloc = os.path.join(dis_class_location, target + '.class')
    jloc = os.path.join(tdir, target + '.j')

    disassemble.disassembleClass(disassemble.readFile, targets=[classloc], outpath=tdir)
    pairs = assemble.assembleClass(jloc)
    new_fname = os.path.join(tdir, target + '.class')

    for name, data in pairs:
        assert name == target
        with open(new_fname, 'wb') as f:
            f.write(data)

    good_fname = os.path.join(dis_class_location, target + '.class')
    runJavaAndCompare(target, testcases, good_fname, new_fname)
    shutil.rmtree(tdir)
Пример #2
0
def runDisassemblerTest(target, testcases):
    print 'Running disassembler test {}...'.format(target)
    tdir = tempfile.mkdtemp()

    classloc = os.path.join(dis_class_location, target + '.class')
    jloc = os.path.join(tdir, target + '.j')

    disassemble.disassembleClass(disassemble.readFile,
                                 targets=[classloc],
                                 outpath=tdir)
    pairs = assemble.assembleClass(jloc)
    new_fname = os.path.join(tdir, target + '.class')

    for name, data in pairs:
        assert name == target
        with open(new_fname, 'wb') as f:
            f.write(data)

    good_fname = os.path.join(dis_class_location, target + '.class')
    runJavaAndCompare(target, testcases, good_fname, new_fname)
    shutil.rmtree(tdir)