From 2ab3af5550fc11aea3c11b958481f3576b610d7a Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 30 Nov 2016 14:03:52 -0700 Subject: [PATCH] suite: add --suite-relpath option Signed-off-by: Zack Cerza --- scripts/suite.py | 3 +++ teuthology/suite/__init__.py | 2 ++ teuthology/suite/placeholder.py | 1 + teuthology/suite/run.py | 10 +++++++--- teuthology/suite/test/test_placeholder.py | 2 ++ teuthology/suite/test/test_run_.py | 2 ++ 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/scripts/suite.py b/scripts/suite.py index 76d1e5d121..beabcc36d0 100644 --- a/scripts/suite.py +++ b/scripts/suite.py @@ -59,6 +59,9 @@ Standard arguments: Distro version to run against --suite-repo Use tasks and suite definition in this repository [default: {default_suite_repo}] + --suite-relpath + Look for tasks and suite definitions in this + subdirectory of the suite repo. --suite-branch Use this suite branch instead of the ceph branch --suite-dir Use this alternative directory as-is when diff --git a/teuthology/suite/__init__.py b/teuthology/suite/__init__.py index 3949e4fb61..9bd5d17586 100644 --- a/teuthology/suite/__init__.py +++ b/teuthology/suite/__init__.py @@ -35,6 +35,8 @@ def process_args(args): key = rename_args.get(key) or key if key == 'suite' and value is not None: value = normalize_suite_name(value) + if key == 'suite_relpath' and value is None: + value = '' elif key in ('limit', 'priority', 'num', 'newest'): value = int(value) elif key == 'subset' and value is not None: diff --git a/teuthology/suite/placeholder.py b/teuthology/suite/placeholder.py index fe068c9407..de346e4f55 100644 --- a/teuthology/suite/placeholder.py +++ b/teuthology/suite/placeholder.py @@ -97,6 +97,7 @@ dict_templ = { }, 'suite': Placeholder('suite'), 'suite_repo': Placeholder('suite_repo'), + 'suite_relpath': Placeholder('suite_relpath'), 'suite_branch': Placeholder('suite_branch'), 'suite_sha1': Placeholder('suite_hash'), 'tasks': [], diff --git a/teuthology/suite/run.py b/teuthology/suite/run.py index 13225f70e2..c09e89f019 100644 --- a/teuthology/suite/run.py +++ b/teuthology/suite/run.py @@ -107,6 +107,7 @@ class Run(object): archive_upload=config.archive_upload, archive_upload_key=config.archive_upload_key, suite_repo=config.get_ceph_qa_suite_git_url(), + suite_relpath=self.args.suite_relpath, ) return self.build_base_config() @@ -441,9 +442,12 @@ class Run(object): name = self.name arch = util.get_arch(self.base_config.machine_type) suite_name = self.base_config.suite - suite_path = os.path.join( - self.suite_repo_path, 'suites', - self.base_config.suite.replace(':', '/')) + suite_path = os.path.normpath(os.path.join( + self.suite_repo_path, + self.args.suite_relpath, + 'suites', + self.base_config.suite.replace(':', '/'), + )) log.debug('Suite %s in %s' % (suite_name, suite_path)) configs = [ (combine_path(suite_name, item[0]), item[1]) for item in diff --git a/teuthology/suite/test/test_placeholder.py b/teuthology/suite/test/test_placeholder.py index 03d04d35da..297b44c27f 100644 --- a/teuthology/suite/test/test_placeholder.py +++ b/teuthology/suite/test/test_placeholder.py @@ -19,6 +19,7 @@ class TestPlaceholder(object): archive_upload='archive_upload', archive_upload_key='archive_upload_key', suite_repo='https://example.com/ceph/suite.git', + suite_relpath='', ) output_dict = substitute_placeholders(dict_templ, input_dict) assert output_dict['suite'] == 'suite' @@ -42,6 +43,7 @@ class TestPlaceholder(object): distro=None, distro_version=None, suite_repo='https://example.com/ceph/suite.git', + suite_relpath='', ) output_dict = substitute_placeholders(dict_templ, input_dict) assert 'os_type' not in output_dict diff --git a/teuthology/suite/test/test_run_.py b/teuthology/suite/test/test_run_.py index c6d87fb174..b3b3db798e 100644 --- a/teuthology/suite/test/test_run_.py +++ b/teuthology/suite/test/test_run_.py @@ -20,6 +20,7 @@ class TestRun(object): self.args_dict = dict( suite='suite', suite_branch='suite_branch', + suite_relpath='', ceph_branch='ceph_branch', ceph_sha1='ceph_sha1', email='address@example.com', @@ -178,6 +179,7 @@ class TestScheduleSuite(object): def setup(self): self.args_dict = dict( suite='suite', + suite_relpath='', suite_dir='suite_dir', suite_branch='master', ceph_branch='ceph_branch', -- 2.39.5