[yocto] [PATCH] qa-tools: Add suport for current format of templates
jose.perez.carranza at linux.intel.com
jose.perez.carranza at linux.intel.com
Thu Feb 16 14:37:08 PST 2017
From: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>
Currently the tempates has a format as below:
TRTEMP_<RELEASE>_<MANUAL/AUTO>_<COMPONENT>_<OPTIONAL>
Hence the logic was adapted to follow above structure and also a
commit paramater was added to follow the format of build as follows:
RELEASE MILESTONE_rc#
Signed-off-by: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>
---
testopia_update.py | 30 ++++++++++++++++------------
testopia_update/product/__init__.py | 39 +++++++++++++++++++++----------------
2 files changed, 40 insertions(+), 29 deletions(-)
diff --git a/testopia_update.py b/testopia_update.py
index 249d163..af281c9 100755
--- a/testopia_update.py
+++ b/testopia_update.py
@@ -15,7 +15,7 @@ DEFAULT_STORE_LOCATION = "/tmp/testopia_update"
ACTIONS = ('create', 'update')
BRANCHES = ('master', 'jethro', 'dizzy', 'daisy', 'noexists')
-CATEGORIES = ('Full pass', 'Weekly')
+CATEGORIES = ('AUTO', 'MANUAL')
class Options(object):
pass
@@ -60,6 +60,9 @@ def get_args():
parser.add_argument('--project-date', required=False,
dest="project_date", help='SCM version/revision date of the project.')
+ parser.add_argument('--commit', required=False,
+ dest="commit", help='Poky commit')
+
parser.add_argument('--results-log', required=False,
dest="results_log", help='Results log.')
@@ -68,6 +71,7 @@ def get_args():
parser.add_argument('--debug', required=False, action="store_true",
dest="debug", default=False, help='Enable debug mode.')
+
return parser.parse_args()
if __name__ == '__main__':
@@ -86,8 +90,8 @@ if __name__ == '__main__':
testopia_config = ['url', 'username', 'password', 'store_location']
testopia_opts = testopia_config + ['action', 'product_name', 'category_name',
'project_version', 'project_milestone', 'project_revision',
- 'project_date']
-
+ 'project_date','commit']
+
config = None
if not args.config and os.path.exists(DEFAULT_CONFIG_FILE):
args.config = DEFAULT_CONFIG_FILE
@@ -103,10 +107,10 @@ if __name__ == '__main__':
arg = getattr(args, to)
if arg:
setattr(opts, to, arg)
- if not hasattr(opts, to):
- logger.error("%s: Requires testopia %s in arguments or config." % \
- (sys.argv[0], to))
- sys.exit(1)
+# if not hasattr(opts, to):
+# logger.error("%s: Requires testopia %s in arguments or config." % \
+# (sys.argv[0], to))
+# sys.exit(1)
if not os.path.exists(opts.store_location):
os.makedirs(opts.store_location)
@@ -155,11 +159,13 @@ if __name__ == '__main__':
sys.exit(1)
build = product.get_build(test_plan, args.project_version,
- args.project_milestone, args.project_revision, args.project_date)
+ args.project_milestone, args.project_revision, args.project_date,
+ args.commit)
if not build:
if args.action == "create":
build = product.create_build(test_plan, args.project_version,
- args.project_milestone, args.project_revision, args.project_date)
+ args.project_milestone, args.project_revision, args.project_date,
+ args.commit)
logger.info("%s: Create build for product %s with: "\
"%s, %s, %s, %s." % (sys.argv[0], args.product_name,
args.project_version, args.project_milestone,
@@ -172,8 +178,8 @@ if __name__ == '__main__':
sys.exit(1)
if args.action == "create":
- template_test_run = product.get_template_test_run(test_plan, args.project_version,
- args.category_name, args.optional)
+ template_test_run = product.get_template_test_run(test_plan,
+ args.project_version, args.category_name, args.optional)
if not template_test_run:
logger.error("%s: Product %s can't find test run with: "\
"%s, %s, %s." % (sys.argv[0], args.product_name,
@@ -189,7 +195,7 @@ if __name__ == '__main__':
args.optional))
sys.exit(1)
logger.info("%s: Test run was created with Template (%d), Summary (%s)"\
- " and ID (%s)." % (sys.argv[0], template_test_run['run_id'],
+ " and ID (%s)." % (sys.argv[0], template_test_run['run_id'],
test_run['summary'], test_run['run_id']))
elif args.action == "update":
if not args.results_log:
diff --git a/testopia_update/product/__init__.py b/testopia_update/product/__init__.py
index 04f9dac..02c6447 100644
--- a/testopia_update/product/__init__.py
+++ b/testopia_update/product/__init__.py
@@ -1,5 +1,6 @@
import re
+
class Product(object):
def __init__(self, testopia, opts, logger, config):
self.testopia = testopia
@@ -42,13 +43,15 @@ class Product(object):
tp_envs = self.testopia.product_get_environments(tp['product_id'])
return [tp_env['name'] for tp_env in tp_envs]
- def _format_build_name(self, project_version, project_revision):
- return "%s: %s" % (project_version, project_revision)
+ def _format_build_name(self, project_version, project_revision, project_commit):
+ return "%s_%s: %s" % (project_version, project_revision, project_commit)
- def get_build(self, tp, project_version, project_milestone,
- project_revision, project_date):
+ def get_build(self, tp, project_version, project_milestone, project_revision,
+ project_date, project_commit):
builds = self.testopia.product_get_builds(tp['product_id'])
- build_name = self._format_build_name(project_milestone, project_revision)
+ build_name = self._format_build_name(project_milestone, project_revision,
+ project_commit)
+ exit
for b in builds:
if build_name == b['name'] and project_date == b['description'] \
and project_milestone == str(b['milestone']):
@@ -56,8 +59,9 @@ class Product(object):
return None
def create_build(self, tp, project_version, project_milestone,
- project_revision, project_date):
- build_name = self._format_build_name(project_milestone, project_revision)
+ project_revision, project_date, project_commit):
+ build_name = self._format_build_name(project_milestone, project_revision,
+ project_commit)
return self.testopia.build_create(build_name, tp['product_id'],
description=project_date, milestone=project_milestone,
@@ -66,14 +70,14 @@ class Product(object):
def _get_test_run_summary_alternatives(self, ttype, project_version,
category_name, optional):
summary_alts = []
- summary_alts.append('%s - %s - %s - %s' % (ttype, self.name,
- project_version, category_name))
- summary_alts.append('%s - %s - %s' % (ttype, project_version,
+ summary_alts.append('%s_%s_%s_%s' % (ttype, project_version,
+ category_name, self.name))
+ summary_alts.append('%s_%s_%s' % (ttype, project_version,
category_name))
- summary_alts.append('%s - %s' % (ttype, category_name))
- if optional:
+ summary_alts.append('%s_%s' % (ttype, category_name))
+ if optional:
for idx, sa in enumerate(summary_alts):
- summary_alts[idx] = sa + " - %s" % optional
+ summary_alts[idx] = sa + "_%s" % optional
return summary_alts
def get_template_test_run(self, tp, project_version, category_name,
@@ -85,7 +89,7 @@ class Product(object):
first match of summary in test runs.
"""
- summary_alts = self._get_test_run_summary_alternatives("TEMPLATE",
+ summary_alts = self._get_test_run_summary_alternatives("TRTEMP",
project_version, category_name, optional)
tp_test_runs = self.testopia.testplan_get_test_runs(tp['plan_id'])
@@ -100,7 +104,7 @@ class Product(object):
def get_test_run(self, tp, env, build, project_date, project_version,
category_name, optional):
- summary_alts = self._get_test_run_summary_alternatives(project_date,
+ summary_alts = self._get_test_run_summary_alternatives(project_date,
project_version, category_name, optional)
tp_test_runs = self.testopia.testplan_get_test_runs(tp['plan_id'])
@@ -133,8 +137,9 @@ class Product(object):
return project_version
- def create_test_run(self, tp, env, build, template_tr, project_version, project_date):
- summary = template_tr['summary'].replace('TEMPLATE', project_date)
+ def create_test_run(self, tp, env, build, template_tr, project_version,
+ project_date):
+ summary = template_tr['summary'].replace('TRTEMP', project_date)
test_case_ids = self._get_test_case_ids(template_tr)
new_test_run = self.testopia.testrun_create(build['build_id'],
--
2.1.4
More information about the yocto
mailing list