Esempio n. 1
0
def runTestList(none, test_list):
    """
    none: is always None.

    test_list (list): a list of tuples containing (test_cases, options,
        cmd_line_options)
    """
    deck_dl = []

    for test in test_list:
        test_cases, options, cmd_line_options = test
        d1 = runner.runTestCases(test_cases, options, cmd_line_options)
        deck_dl.append(d1)

    d2 = defer.DeferredList(deck_dl)
    d2.addCallback(testsEnded)
    d2.addErrback(testFailed)

    # Print every 5 second the list of current tests running
    l = task.LoopingCall(updateStatusBar)
    l.start(5.0)
    return d2
Esempio n. 2
0
        pcap_filename = yamloo_filename + ".pcap"

    if os.path.exists(yamloo_filename):
        print "Report already exists with filename %s" % yamloo_filename
        print "Renaming it to %s" % yamloo_filename + '.old'
        os.rename(yamloo_filename, yamloo_filename + '.old')
    if os.path.exists(pcap_filename):
        print "Report PCAP already exists with filename %s" % pcap_filename
        print "Renaming it to %s" % pcap_filename + '.old'
        os.rename(pcap_filename, pcap_filename + '.old')

    classes = runner.findTestClassesFromConfig(cmd_line_options)
    test_cases, options = runner.loadTestsAndOptions(classes, cmd_line_options)
    if config.privacy.includepcap:
        try:
            checkForRoot()
        except NotRootError:
            print "[!] Includepcap options requires root priviledges to run"
            print "    you should run ooniprobe as root or disable the options in ooniprobe.conf"
            sys.exit(1)
        print "Starting sniffer"
        net.capturePackets(pcap_filename)

    log.start(cmd_line_options['logfile'])

    tests_d = runner.runTestCases(test_cases, options, cmd_line_options,
                                  yamloo_filename)
    tests_d.addBoth(testsEnded)

    reactor.run()
Esempio n. 3
0
        pcap_filename = yamloo_filename+".pcap"

    if os.path.exists(yamloo_filename):
        log.msg("Report already exists with filename %s" % yamloo_filename)
        log.msg("Renaming it to %s" % yamloo_filename+'.old')
        os.rename(yamloo_filename, yamloo_filename+'.old')
    if os.path.exists(pcap_filename):
        log.msg("Report already exists with filename %s" % pcap_filename)
        log.msg("Renaming it to %s" % pcap_filename+'.old')
        os.rename(pcap_filename, pcap_filename+'.old')

    log.start(cmd_line_options['logfile'])
    classes = runner.findTestClassesFromConfig(cmd_line_options)
    test_cases, options = runner.loadTestsAndOptions(classes, cmd_line_options)
    if config.privacy.includepcap:
        try:
            checkForRoot()
        except NotRootError:
            log.err("includepcap options requires root priviledges to run")
            log.err("you should run ooniprobe as root or disable the options in ooniprobe.conf")
            sys.exit(1)
        log.debug("Starting sniffer")
        sniffer_d = net.capturePackets(pcap_filename)

    tests_d = runner.runTestCases(test_cases, options,
            cmd_line_options, yamloo_filename)
    tests_d.addBoth(testsEnded)

    reactor.run()