コード例 #1
0
ファイル: runtests.py プロジェクト: ardentcrest/ASMModSuit
def runAssemblerTest(fname, exceptFailure):
    print 'Running assembler test', os.path.basename(fname)
    error = False
    try:
        assemble.assembleClass(fname, fatal=True)
    except AsssemblerError:
        error = True
    assert error == exceptFailure
コード例 #2
0
ファイル: runtests.py プロジェクト: Janmm14/Krakatau
def runAssemblerTest(fname, exceptFailure):
    print 'Running assembler test', os.path.basename(fname)
    error = False
    try:
        assemble.assembleClass(fname, fatal=True)
    except AsssemblerError:
        error = True
    assert error == exceptFailure
コード例 #3
0
ファイル: runtests.py プロジェクト: Janmm14/Krakatau
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)
コード例 #4
0
ファイル: runtests.py プロジェクト: ardentcrest/ASMModSuit
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)