Esempio n. 1
0
 def _prepareSourcefile(self, sourcefile):
     content = open(sourcefile, "r").read()
     content = content.replace(
         "ERROR;", "ERROR_LOCATION;").replace(
         "ERROR:", "ERROR_LOCATION:").replace(
         "errorFn();", "goto ERROR_LOCATION; ERROR_LOCATION:;")
     newFilename = sourcefile + "_acsar.c"
     filewriter.writeFile(newFilename, content)
     return newFilename
Esempio n. 2
0
def executeBenchmarkInCloud(benchmark, outputHandler):

    # build input for cloud
    cloudInput = getCloudInput(benchmark)
    cloudInputFile = os.path.join(benchmark.logFolder, 'cloudInput.txt')
    filewriter.writeFile(cloudInput, cloudInputFile)
    outputHandler.allCreatedFiles.append(cloudInputFile)

    # install cloud and dependencies
    ant = subprocess.Popen(["ant", "resolve-benchmark-dependencies"])
    ant.communicate()
    ant.wait()

    # start cloud and wait for exit
    logging.debug("Starting cloud.")
    if config.debug:
        logLevel =  "FINER"
    else:
        logLevel = "INFO"
    libDir = os.path.abspath("./lib/java-benchmark")
    cmdLine = ["java", "-jar", libDir + "/vcloud.jar", "benchmark", "--loglevel", logLevel]
    if config.cloudMaster:
        cmdLine.extend(["--master", config.cloudMaster])
    cloud = subprocess.Popen(cmdLine, stdin=subprocess.PIPE)
    try:
        (out, err) = cloud.communicate(cloudInput.encode('utf-8'))
    except KeyboardInterrupt:
        killScriptCloud()
    returnCode = cloud.wait()

    if returnCode and not STOPPED_BY_INTERRUPT:
        logging.warn("Cloud return code: {0}".format(returnCode))

    handleCloudResults(benchmark, outputHandler)

    if config.commit and not STOPPED_BY_INTERRUPT:
        Util.addFilesToGitRepository(OUTPUT_PATH, outputHandler.allCreatedFiles,
                                     config.commitMessage+'\n\n'+outputHandler.description)

    return returnCode
Esempio n. 3
0
 def _prepareSourcefile(self, sourcefile):
     content = open(sourcefile, "r").read()
     content = content.replace("goto ERROR;", "assert(0);")
     newFilename = "tmp_benchmark_feaver.c"
     filewriter.writeFile(newFilename, content)
     return newFilename