diff --git a/scripts/suite.py b/scripts/suite.py index 77561b7e0..af134f77b 100644 --- a/scripts/suite.py +++ b/scripts/suite.py @@ -9,6 +9,7 @@ usage: teuthology-suite --help teuthology-suite [-v | -vv ] --suite [options] [...] teuthology-suite [-v | -vv ] --rerun [options] [...] + teuthology-suite [-v | -vv ] --descr [options] [...] Run a suite of ceph integration tests. A suite is a directory containing facets. A facet is a directory containing config snippets. Running a suite @@ -126,6 +127,9 @@ 2/ ... -1/ will schedule all jobs in the suite (many more than once). If specified, this value can be found in results.log. + --descr Use to rerun tests. Reschedule test based on their + descriptions. The descr is comma separated list of test + descriptions. -p , --priority Job priority (lower is sooner) [default: 1000] diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index a37887811..035aeda70 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -27,6 +27,33 @@ log = logging.getLogger(__name__) +def descr_to_yamls(descriptions, suites_path): + def expand_descr(test_yamls, source, prefix, base_pos): + pos = base_pos + while (pos < len(source)): + if source[pos] == '{': + more_prefix=source[base_pos:pos] + pos = expand_descr(test_yamls, source, prefix + more_prefix, pos + 1) + base_pos = pos + elif source[pos] == '}': + if base_pos != pos: + test_yamls.append(suites_path + "/" + prefix + source[base_pos:pos] + ".yaml") + return pos + 1 + elif source[pos] == ' ': + if base_pos != pos: + test_yamls.append(suites_path + "/" + prefix + source[base_pos:pos] + ".yaml") + pos = pos + 1 + base_pos = pos + else: + pos = pos + 1 + result = [] + desc_tab = descriptions.split(',') + for d in desc_tab: + d = d.strip() + test_yamls = [] + expand_descr(test_yamls, d, "", 0) + result.append((d, test_yamls)) + return result class Run(object): WAIT_MAX_JOB_TIME = 30 * 60 @@ -70,7 +97,7 @@ def make_run_name(self): [ self.user, str(self.timestamp), - self.args.suite, + self.args.suite or "rerun", self.args.ceph_branch, self.args.kernel_branch or '-', self.args.flavor, worker @@ -357,8 +384,14 @@ def build_base_config(self): job_config.timestamp = self.timestamp job_config.priority = self.args.priority job_config.seed = self.args.seed + if self.args.subset and self.args.descr: + util.schedule_fail("--subset is not compatible with --descr") + if self.args.suite and self.args.descr: + util.schedule_fail("--suite is not compatible with --descr") if self.args.subset: job_config.subset = '/'.join(str(i) for i in self.args.subset) + if self.args.descr: + job_config.suite = "rerun" if self.args.email: job_config.email = self.args.email if self.args.owner: @@ -575,16 +608,23 @@ def schedule_suite(self): else: arch = util.get_arch(self.base_config.machine_type) suite_name = self.base_config.suite - suite_path = os.path.normpath(os.path.join( + suites_path = os.path.normpath(os.path.join( self.suite_repo_path, self.args.suite_relpath, - 'suites', - self.base_config.suite.replace(':', '/'), + 'suites' )) + suite_path = os.path.normpath(os.path.join( + suites_path, + suite_name.replace(':', '/'), + )) + log.debug('Suites in %s' % (suites_path)) log.debug('Suite %s in %s' % (suite_name, suite_path)) log.debug(f"subset = {self.args.subset}") log.debug(f"no_nested_subset = {self.args.no_nested_subset}") - configs = build_matrix(suite_path, + if self.args.descr: + configs = descr_to_yamls(self.args.descr, suites_path) + else: + configs = build_matrix(suite_path, subset=self.args.subset, no_nested_subset=self.args.no_nested_subset, seed=self.args.seed) @@ -596,7 +636,7 @@ def schedule_suite(self): filter_all=self.args.filter_all, filter_fragments=self.args.filter_fragments, seed=self.args.seed, - suite_name=suite_name)) + suite_name=self.base_config.suite)) if self.args.dry_run: log.debug("Base job config:\n%s" % self.base_config)