Exemplo n.º 1
0
def _bundle_run_timeout(tc, bundle_name, test_name):
    timeout = 240
    if bundle_name in bundle_run_timeouts:
        timeout = bundle_run_timeouts[bundle_name]
        tc.report_info("adjusting timeout to %d per "
                       "configuration tcfl.tc_clear_bbt.bundle_run_timeouts"
                       % timeout)
    if test_name in bundle_run_timeouts:
        timeout = bundle_run_timeouts[test_name]
        tc.report_info("adjusting timeout to %d per "
                       "configuration tcfl.tc_clear_bbt.bundle_run_timeouts"
                       % timeout)
    return timeout
Exemplo n.º 2
0
    def is_testcase(cls, path, _from_path):
        # the any-bundle directory of bbt.git is only to run after
        # other testcases--lame case to avoid it. IFFF you run from
        # inside it, it won't catch it, but so what...
        if path.startswith("any-bundle/") or "/any-bundle/" in path:
            return []
        # Catch .t's
        if not cls.filename_regex.match(os.path.basename(path)):
            return []
        file_name = os.path.basename(path)
        # Ignore stress tests for the time being
        if cls.ignore_stress and file_name.startswith("stress-"):
            logging.warning("ignoring stress testcase %s", path)
            return []
        # Now split in path/filename.
        # The TCF core cannot scan directories, just files. Because in
        # this case we want to create a testcase per-directory, we do
        # so. However, we save it in cls.paths (a class-variable). If
        # there is an entry for said path, then we append it to
        # it. Otherwise we create a new one.
        # As a result, we only create a testcase per directory that
        # has entries for each .t file in the directory.
        srcdir = os.path.dirname(path)
        srcdir_real_path = os.path.realpath(srcdir)
        for regex, replacement in bundle_path_map:
            match = regex.match(srcdir_real_path)
            if match:
                _srcdir = re.sub(regex, replacement, srcdir_real_path)
                logging.info("path '%s' mapped to '%s' per config "
                             "tcfl.tc_clear_bbt.bundle_path_map",
                             srcdir_real_path, _srcdir)
                break
        else:
            _srcdir = srcdir_real_path
        if _srcdir in cls.paths:
            # there is a testcase for this directory already, append
            # the .t
            tc = cls.paths[_srcdir]
            tc.t_files.append(os.path.basename(path))
            tc._scan_t_subcases(path, srcdir + "##")
            tc.report_info("%s will be run by %s" % (path, _srcdir),
                           dlevel = 3)
        else:
            # there is no testcase for this directory, go create it;
            # set the full filename as origin.
            tc = cls(srcdir, path)
            tc._scan_t_subcases(path, srcdir + "##")
            cls.paths[_srcdir] = tc

            # now, we will also run anything in the any-bundle
            # directory -- per directory, so we add it now, as we
            # won't be able to do it later FIXME this might make it
            # not work when we just point to a .t
            # any_bundle's are at ../../any-bundle from the
            # per-bundle directories where the .ts are.
            any_bundle_path = os.path.join(_srcdir, "..", "..", "any-bundle",
                                           "*.t")
            for any_t_file_path in glob.glob(any_bundle_path):
                tc._scan_t_subcases(any_t_file_path, srcdir + "##any-bundle/")

        return [ tc ]