コード例 #1
0
def main():
    printMachineInfo()

    options = parseOpts()

    collector = createCollector.createCollector(
        "DOMFuzz" if options.testType == 'dom' else "jsfunfuzz")
    refreshSignatures(collector)

    options.tempDir = tempfile.mkdtemp("fuzzbot")
    print options.tempDir

    buildInfo = ensureBuild(options)
    assert os.path.isdir(buildInfo.buildDir)

    numProcesses = multiprocessing.cpu_count()
    if "-asan" in buildInfo.buildDir:
        # This should really be based on the amount of RAM available, but I don't know how to compute that in Python.
        # I could guess 1 GB RAM per core, but that wanders into sketchyville.
        numProcesses = max(numProcesses // 2, 1)
    if sps.isARMv7l:
        # Even though ARM boards generally now have many cores, each core is not as powerful
        # as x86/64 ones, so restrict fuzzing to only 1 core for now.
        numProcesses = 1

    forkJoin.forkJoin(options.tempDir, numProcesses, loopFuzzingAndReduction,
                      options, buildInfo, collector)

    # Remove build directory if we created it
    if options.testType == 'dom' and not \
            (options.existingBuildDir or options.buildOptions is not None):
        shutil.rmtree(buildInfo.buildDir)

    shutil.rmtree(options.tempDir)
コード例 #2
0
ファイル: bot.py プロジェクト: MikeHolman/funfuzz
def main():
    printMachineInfo()

    options = parseOpts()

    collector = createCollector.createCollector("DOMFuzz" if options.testType == 'dom' else "jsfunfuzz")
    refreshSignatures(collector)

    options.tempDir = tempfile.mkdtemp("fuzzbot")
    print options.tempDir

    buildInfo = ensureBuild(options)
    assert os.path.isdir(buildInfo.buildDir)

    numProcesses = multiprocessing.cpu_count()
    if "-asan" in buildInfo.buildDir:
        # This should really be based on the amount of RAM available, but I don't know how to compute that in Python.
        # I could guess 1 GB RAM per core, but that wanders into sketchyville.
        numProcesses = max(numProcesses // 2, 1)
    if sps.isARMv7l:
        # Even though ARM boards generally now have many cores, each core is not as powerful
        # as x86/64 ones, so restrict fuzzing to only 1 core for now.
        numProcesses = 1

    forkJoin.forkJoin(options.tempDir, numProcesses, loopFuzzingAndReduction, options, buildInfo, collector)

    # Remove build directory if we created it
    if options.testType == 'dom' and not \
            (options.existingBuildDir or options.buildOptions is not None):
        shutil.rmtree(buildInfo.buildDir)

    shutil.rmtree(options.tempDir)
コード例 #3
0
ファイル: bot.py プロジェクト: LucaBongiorni/funfuzz
def botmain(options):
    options.tempDir = tempfile.mkdtemp("fuzzbot")
    print options.tempDir

    if options.remote_host:
        printMachineInfo()
        #sendEmail("justInWhileLoop", "Platform details , " + platform.node() + " , Python " + sys.version[:5] + " , " +  " ".join(platform.uname()), "gkwong")

    buildInfo = ensureBuild(options)
    assert os.path.isdir(buildInfo.buildDir)

    if options.retestRoot:
        print "Retesting time!"
        retestAll(options, buildInfo)
    else:
        options.relevantJobsDirName = options.testType + "-" + buildInfo.buildType
        options.relevantJobsDir = options.baseDir + options.relevantJobsDirName + options.remoteSep

        runCommand(options.remote_host, "mkdir -p " + options.baseDir)  # don't want this created recursively, because "mkdir -p" is weird with modes
        runCommand(options.remote_host, "chmod og+rx " + options.baseDir)
        runCommand(options.remote_host, "mkdir -p " + options.relevantJobsDir)
        runCommand(options.remote_host, "chmod og+rx " + options.relevantJobsDir)

        (job, oldjobname, takenNameOnServer) = grabJob(options, "_needsreduction")
        if job:
            print "Reduction time!"
            lithArgs = readTinyFile(job + "lithium-command.txt").strip().split(" ")
            lithArgs[-1] = job + splitSlash(lithArgs[-1])[-1]  # options.tempDir may be different
            if platform.system() == "Windows":
                # Ensure both Lithium and Firefox understand the filename
                lithArgs[-1] = lithArgs[-1].replace("/", "\\")
            logPrefix = job + "reduce" + timestamp()
            (lithResult, lithDetails) = lithOps.runLithium(lithArgs, logPrefix, options.targetTime)
            uploadJob(options, lithResult, lithDetails, job, oldjobname)
            runCommand(options.remote_host, "rm -rf " + takenNameOnServer)

        else:
            print "Fuzz time!"
            #if options.testType == 'js':
            #    if sps.isLinux:  # Test to see whether releng AWS Linux instances can send email
            #        print "Sending email..."
            #        sendEmail("justFuzzTime", "Platform details (" + str(multiprocessing.cpu_count()) + " cores), " + platform.node() + " , Python " + sys.version[:5] + " , " +  " ".join(platform.uname()), "gkwong")
            #        print "Email sent!"

            numProcesses = multiprocessing.cpu_count()
            if "-asan" in buildInfo.buildDir:
                # This should really be based on the amount of RAM available, but I don't know how to compute that in Python.
                # I could guess 1 GB RAM per core, but that wanders into sketchyville.
                numProcesses = max(numProcesses // 2, 1)
            if sps.isARMv7l:
                # Even though ARM boards generally now have many cores, each core is not as powerful
                # as x86/64 ones, so restrict fuzzing to only 1 core for now.
                numProcesses = 1

            forkJoin.forkJoin(options.tempDir, numProcesses, fuzzUntilBug, options, buildInfo)

    # Remove build directory if we created it
    if options.testType == 'dom' and not \
            (options.retestRoot or options.existingBuildDir or options.buildOptions is not None):
        shutil.rmtree(buildInfo.buildDir)

    shutil.rmtree(options.tempDir)
コード例 #4
0
ファイル: bot.py プロジェクト: tdr130/funfuzz
def botmain(options):
    options.tempDir = tempfile.mkdtemp("fuzzbot")
    print options.tempDir

    if options.remote_host:
        printMachineInfo()
        #sendEmail("justInWhileLoop", "Platform details , " + platform.node() + " , Python " + sys.version[:5] + " , " +  " ".join(platform.uname()), "gkwong")

    buildInfo = ensureBuild(options)
    assert os.path.isdir(buildInfo.buildDir)

    if options.retestRoot:
        print "Retesting time!"
        retestAll(options, buildInfo)
    else:
        options.relevantJobsDirName = options.testType + "-" + buildInfo.buildType
        options.relevantJobsDir = options.baseDir + options.relevantJobsDirName + options.remoteSep

        runCommand(
            options.remote_host, "mkdir -p " + options.baseDir
        )  # don't want this created recursively, because "mkdir -p" is weird with modes
        runCommand(options.remote_host, "chmod og+rx " + options.baseDir)
        runCommand(options.remote_host, "mkdir -p " + options.relevantJobsDir)
        runCommand(options.remote_host,
                   "chmod og+rx " + options.relevantJobsDir)

        (job, oldjobname, takenNameOnServer) = grabJob(options,
                                                       "_needsreduction")
        if job:
            print "Reduction time!"
            lithArgs = readTinyFile(job +
                                    "lithium-command.txt").strip().split(" ")
            lithArgs[-1] = job + splitSlash(
                lithArgs[-1])[-1]  # options.tempDir may be different
            if platform.system() == "Windows":
                # Ensure both Lithium and Firefox understand the filename
                lithArgs[-1] = lithArgs[-1].replace("/", "\\")
            logPrefix = job + "reduce" + timestamp()
            (lithResult,
             lithDetails) = lithOps.runLithium(lithArgs, logPrefix,
                                               options.targetTime)
            uploadJob(options, lithResult, lithDetails, job, oldjobname)
            runCommand(options.remote_host, "rm -rf " + takenNameOnServer)

        else:
            print "Fuzz time!"
            #if options.testType == 'js':
            #    if sps.isLinux:  # Test to see whether releng AWS Linux instances can send email
            #        print "Sending email..."
            #        sendEmail("justFuzzTime", "Platform details (" + str(multiprocessing.cpu_count()) + " cores), " + platform.node() + " , Python " + sys.version[:5] + " , " +  " ".join(platform.uname()), "gkwong")
            #        print "Email sent!"

            numProcesses = multiprocessing.cpu_count()
            if "-asan" in buildInfo.buildDir:
                # This should really be based on the amount of RAM available, but I don't know how to compute that in Python.
                # I could guess 1 GB RAM per core, but that wanders into sketchyville.
                numProcesses = max(numProcesses // 2, 1)
            if sps.isARMv7l:
                # Even though ARM boards generally now have many cores, each core is not as powerful
                # as x86/64 ones, so restrict fuzzing to only 1 core for now.
                numProcesses = 1

            forkJoin.forkJoin(options.tempDir, numProcesses, fuzzUntilBug,
                              options, buildInfo)

    # Remove build directory if we created it
    if options.testType == 'dom' and not \
            (options.retestRoot or options.existingBuildDir or options.buildOptions is not None):
        shutil.rmtree(buildInfo.buildDir)

    shutil.rmtree(options.tempDir)