예제 #1
0
def cmd_bisect(cfg):
    if len(cfg.get('merge_ref')) != 1:
        raise Exception(
            "Bisecting currently works only with exactly one mergeref")

    ktree = skt.ktree(cfg.get('baserepo'),
                      ref=cfg.get('commitgood'),
                      wdir=cfg.get('workdir'))
    head = ktree.checkout()

    cfg['workdir'] = ktree.getpath()
    cfg['buildinfo'] = None

    logging.info("Building good commit: %s", head)
    cmd_build(cfg)
    cmd_publish(cfg)
    os.unlink(cfg.get('tarpkg'))

    runner = skt.runner.getrunner(*cfg.get('runner'))

    retcode = runner.run(cfg.get('buildurl'),
                         cfg.get('krelease'),
                         wait=True,
                         host=cfg.get('host'),
                         uid="[bisect] [good %s]" % head,
                         reschedule=False)

    cfg['host'] = runner.gethost()

    if retcode != 0:
        logging.warning("Good commit %s failed, aborting bisect", head)
        cmd_cleanup(cfg)
        return

    ktree.merge_git_ref(cfg.get('merge_ref')[0][0], cfg.get('commitbad'))
    binfo = ktree.bisect_start(head)

    ret = 0
    while ret == 0:
        cmd_build(cfg)
        cmd_publish(cfg)
        os.unlink(cfg.get('tarpkg'))
        retcode = runner.run(cfg.get('buildurl'),
                             cfg.get('krelease'),
                             wait=True,
                             host=cfg.get('host'),
                             uid="[bisect] [%s]" % binfo,
                             reschedule=False)

        (ret, binfo) = ktree.bisect_iter(retcode)

    cmd_cleanup(cfg)
예제 #2
0
파일: executable.py 프로젝트: ckalina/skt
def cmd_run(cfg):
    """
    Run tests on a built kernel using the specified "runner". Only "Beaker"
    runner is currently supported.

    Args:
        cfg:    A dictionary of skt configuration.
    """
    global retcode

    runner = skt.runner.getrunner(*cfg.get('runner'))

    atexit.register(runner.cleanup_handler)
    signal.signal(signal.SIGINT, runner.signal_handler)
    signal.signal(signal.SIGTERM, runner.signal_handler)
    retcode = runner.run(cfg.get('buildurl'),
                         cfg.get('max_aborted_count'),
                         cfg.get('krelease'),
                         cfg.get('wait'),
                         arch=cfg.get("kernel_arch"),
                         waiving=cfg.get('waiving'))

    recipe_set_index = 0
    for index, job in enumerate(runner.job_to_recipe_set_map.keys()):
        save_state(cfg, {'jobid_%s' % (index): job})
        for recipe_set in runner.job_to_recipe_set_map[job]:
            save_state(cfg,
                       {'recipesetid_%s' % (recipe_set_index): recipe_set})
            recipe_set_index += 1

    cfg['jobs'] = runner.job_to_recipe_set_map.keys()

    save_state(cfg, {'retcode': retcode})
예제 #3
0
def cmd_run(cfg):
    """
    Run tests on a built kernel using the specified "runner". Only "Beaker"
    runner is currently supported.

    Args:
        cfg:    A dictionary of skt configuration.
    """
    global retcode
    runner = skt.runner.getrunner(*cfg.get('runner'))
    retcode = runner.run(cfg.get('buildurl'),
                         cfg.get('krelease'),
                         cfg.get('wait'),
                         uid=cfg.get('uid'),
                         arch=cfg.get("kernel_arch"))

    idx = 0
    for job in runner.jobs:
        if cfg.get('wait') and cfg.get('junit'):
            runner.dumpjunitresults(job, cfg.get('junit'))
        save_state(cfg, {'jobid_%s' % (idx): job})
        idx += 1

    cfg['jobs'] = runner.jobs

    if retcode and cfg.get('basehead') and cfg.get('publisher') \
            and cfg.get('basehead') != cfg.get('buildhead'):
        # TODO: there is a chance that baseline 'krelease' is different
        baserunner = skt.runner.getrunner(*cfg.get('runner'))
        publisher = skt.publisher.getpublisher(*cfg.get('publisher'))
        baseurl = publisher.geturl("%s.tar.gz" % cfg.get('basehead'))
        basehost = runner.get_mfhost()
        baseres = baserunner.run(baseurl,
                                 cfg.get('krelease'),
                                 cfg.get('wait'),
                                 host=basehost,
                                 uid="baseline check",
                                 reschedule=False)
        save_state(cfg, {'baseretcode': baseres})

        # If baseline also fails - assume pass
        if baseres:
            retcode = 0

    save_state(cfg, {'retcode': retcode})
예제 #4
0
def cmd_run(cfg):
    global retcode
    runner = skt.runner.getrunner(*cfg.get('runner'))
    retcode = runner.run(cfg.get('buildurl'),
                         cfg.get('krelease'),
                         cfg.get('wait'),
                         uid=cfg.get('uid'))

    idx = 0
    for job in runner.jobs:
        if cfg.get('wait') and cfg.get('junit') != None:
            runner.dumpjunitresults(job, cfg.get('junit'))
        save_state(cfg, {'jobid_%s' % (idx): job})
        idx += 1

    cfg['jobs'] = runner.jobs

    if retcode != 0 and cfg.get('basehead') and cfg.get('publisher') \
            and cfg.get('basehead') != cfg.get('buildhead'):
        # TODO: there is a chance that baseline 'krelease' is different
        baserunner = skt.runner.getrunner(*cfg.get('runner'))
        publisher = skt.publisher.getpublisher(*cfg.get('publisher'))
        baseurl = publisher.geturl("%s.tar.gz" % cfg.get('basehead'))
        basehost = runner.get_mfhost()
        baseres = baserunner.run(baseurl,
                                 cfg.get('krelease'),
                                 cfg.get('wait'),
                                 host=basehost,
                                 uid="baseline check",
                                 reschedule=False)
        save_state(cfg, {'baseretcode': baseres})

        # If baseline also fails - assume pass
        if baseres != 0:
            retcode = 0

    save_state(cfg, {'retcode': retcode})

    if retcode != 0 and cfg.get('bisect') == True:
        cfg['commitbad'] = cfg.get('mergehead')
        cmd_bisect(cfg)