Ejemplo n.º 1
0
def testeVM(jarAssembler, jarVM, testDir, vmDir, nasmDir, hackDir, gui,
            verbose):

    clearbin(nasmDir)
    clearbin(hackDir)

    print("------------------------------")
    print("- Translating src files       ")
    print("- to I-VMTranslator/bin/nasm/ ")
    print("------------------------------")
    compileVM(False, jarVM, vmDir + 'vm/', nasmDir)
    #compileVM(False, jarVM, vmDir+'vmExamples/', nasmDir)

    # montador
    print("-------------------------")
    print("- Assembling files .... ")
    print("-------------------------")
    sError, sLog = assemblerFromTestDir(jarAssembler, testDir, nasmDir,
                                        hackDir)

    # simulando
    print("-------------------------")
    print("- Simulating .... ")
    print("-------------------------")
    sError, sLog = simulateFromTestDir(testDir, hackDir, gui, verbose)
    if sError != ERRO_NONE:
        testeAssemblySimulateNotif(sError, sLog)
        sys.exit(1)

    # testAssembling files
    print("-------------------------")
    print("- Testando .... ")
    print("-------------------------")
    tError, tLog = compareFromTestDir(testDir)
Ejemplo n.º 2
0
def testeVM(jarAssembler, jarVM, testDir, vmDir, nasmDir, hackDir, gui,
            verbose):

    clearbin(nasmDir)
    clearbin(hackDir)

    print("------------------------------")
    print("- Translating src files       ")
    print("- to I-VMTranslator/bin/nasm/ ")
    print("------------------------------")
    compileVM(False, jarVM, vmDir, nasmDir)

    # montador
    print("-------------------------")
    print("- Assembling files .... ")
    print("-------------------------")
    assemblerFromTestDir(jarAssembler, testDir, nasmDir, hackDir)

    # simulando
    print("-------------------------")
    print("- Simulating .... ")
    print("-------------------------")
    simulateFromTestDir(testDir, hackDir, gui, verbose)

    # testAssembling files
    print("-------------------------")
    print("- Testando .... ")
    print("-------------------------")
    compareFromTestDir(testDir)
Ejemplo n.º 3
0
def testeAssembly(jar, testDir, nasmDir, hackDir, gui, verbose):

    pwd = os.path.dirname(os.path.abspath(__file__))

    # global path
    os.path.abspath(nasm)
    os.path.abspath(hack)

    print("==== Assembling Files ==========================")
    clearbin(hack)

    errAssembler, logAssembler = assembler(jar, nasm, hack, True)

    if errAssembler == 0:
        print("==== Simulating ================================")
        clearTestDir(testDir)
        if simulateFromTestDir(testDir, hackDir, gui, verbose) < 0:
            sys.exit(1)

        # testAssembling files
        print("==== Testando ==================================")
        error, log = compareFromTestDir(testDir)

        if error < -1:
            sys.exit(-1)

    # report error
    print("==== Reporting results =========================")
    r = report(log, 'H')
    error = r.assemblyTeste(log)
    r.send()
Ejemplo n.º 4
0
def compileAll(jar, nasm, hack):
    print(" 1/2 Removendo arquivos antigos .hack")
    print("  - {}".format(hack))
    clearbin(hack)

    print(" 2/2 Gerando novos arquivos   .hack")
    print("  - {}".format(nasm))
    return assemblerAll(jar, nasm, hack, True)
Ejemplo n.º 5
0
def compileAll(jar, nasm, hack):
    print("-------------------------")
    print("- Montando arquivos      ")
    print("-------------------------")

    # global path
    os.path.abspath(nasm)
    os.path.abspath(hack)

    print(" 1/2 Removendo arquivos .hack")
    print("  - {}".format(hack))
    clearbin(hack)

    print(" 2/2 Gerando arquivos   .hack")
    print("  - {}".format(nasm))
    return assemblerAll(jar, nasm, hack, True)