[yocto] [qa-tools][PATCH v2] testopia_update: Add option to define test plan

Aníbal Limón anibal.limon at linux.intel.com
Tue Mar 7 08:44:55 PST 2017


Ack

On 03/07/2017 07:58 AM, jose.perez.carranza at linux.intel.com wrote:
> From: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>
> 
> There are cases where the test plan and the product name are not equal hence
> an option is added to handle those cases and define the test plan to work on.
> 
> Signed-off-by: Jose Perez Carranza <jose.perez.carranza at linux.intel.com>
> ---
>  testopia_update.py                  | 13 +++++++++---
>  testopia_update/product/__init__.py | 40 ++++++++++++++++++++-----------------
>  2 files changed, 32 insertions(+), 21 deletions(-)
> 
> diff --git a/testopia_update.py b/testopia_update.py
> index 9b35188..044074a 100755
> --- a/testopia_update.py
> +++ b/testopia_update.py
> @@ -70,6 +70,9 @@ def get_args():
>          dest="project_revision", help='SCM Revision of the project.')
>      parser.add_argument('--project-date', required=False,
>          dest="project_date", help='SCM version/revision date of the project.')
> +    parser.add_argument('--test-plan', required=False,
> +        dest="plan_name", help='Name of the test plan of the product, used when \
> +                                test plan name is different from product name.')
>  
>      parser.add_argument('--results-log', required=False,
>          dest="results_log", help='Results log.')
> @@ -115,8 +118,12 @@ if __name__ == '__main__':
>      if not os.path.exists(opts.store_location):
>          os.makedirs(opts.store_location)
>  
> +    kwargs = {}
> +    if args.plan_name:
> +        kwargs['plan_name'] = args.plan_name
> +
>      testopia = Testopia(opts.username, opts.password, opts.url, sslverify=False)
> -    products = get_products(testopia, opts, logger, config)
> +    products = get_products(testopia, opts, logger, config, **kwargs)
>  
>      if args.list_products:
>          print("List of available products: \n")
> @@ -141,8 +148,8 @@ if __name__ == '__main__':
>  
>      test_plan = product.get_test_plan(args.branch_name)
>      if not test_plan:
> -        logger.error("%s: Test plan for product %s and branch %s not exists."\
> -             % (sys.argv[0], args.product_name, args.branch_name))
> +        logger.error("%s: Test plan %s for product %s and branch %s not exists."\
> +             % (sys.argv[0], product.plan ,args.product_name, args.branch_name))
>  
>          sys.exit(1)
>  
> diff --git a/testopia_update/product/__init__.py b/testopia_update/product/__init__.py
> index e401824..18b112e 100644
> --- a/testopia_update/product/__init__.py
> +++ b/testopia_update/product/__init__.py
> @@ -1,13 +1,17 @@
>  import re
>  
> -
>  class Product(object):
> -    def __init__(self, testopia, opts, logger, config):
> +    def __init__(self, testopia, opts, logger, config, **kwargs):
>          self.testopia = testopia
>          self.opts = opts
>          self.logger = logger
>          self.config = config
>  
> +        if 'plan_name' in kwargs:
> +            self.plan = kwargs['plan_name']
> +        else:
> +            self.plan = self.name
> +
>      def support(self, name):
>          if self.name == name:
>              return True
> @@ -16,11 +20,11 @@ class Product(object):
>      def get_test_plan(self, branch_name):
>          tp = None
>  
> -        tp_name = '%s: %s branch' % (self.name, branch_name)
> +        tp_name = '%s: %s branch' % (self.plan, branch_name)
>  
>          tp = self.testopia.testplan_list(name=tp_name)
>          if not tp:
> -            tp_alt_name = '%s: %s branch' % (self.name, branch_name.lower())
> +            tp_alt_name = '%s: %s branch' % (self.plan, branch_name.lower())
>              tp = self.testopia.testplan_list(name=tp_alt_name)
>  
>          if tp:
> @@ -68,7 +72,7 @@ class Product(object):
>              category_name, optional):
>          summary_alts = []
>          summary_alts.append('%s_%s_%s_%s' % (ttype, project_version,
> -            category_name, self.name))
> +            category_name, self.plan))
>          summary_alts.append('%s_%s_%s' % (ttype, project_version,
>              category_name))
>          summary_alts.append('%s_%s' % (ttype, category_name))
> @@ -186,7 +190,7 @@ class Product(object):
>  
>          return missing
>  
> -def get_products(testopia, opts, config, logger):
> +def get_products(testopia, opts, config, logger, **kwargs):
>  
>  
>      from . import bitbake
> @@ -204,18 +208,18 @@ def get_products(testopia, opts, config, logger):
>  
>      products = []
>  
> -    products.append(bitbake.BitbakeProduct(testopia, opts, logger, config))
> -    products.append(bsp_qemu.BSPQEMUProduct(testopia, opts, logger, config))
> -    products.append(meta_yocto.MetaYoctoProduct(testopia, opts, logger, config))
> -    products.append(oe_core.OECoreProduct(testopia, opts, logger, config))
> -    products.append(runtime.RuntimeProduct(testopia, opts, logger, config))
> -    products.append(toaster.ToasterProduct(testopia, opts, logger, config))
> -    products.append(adt.ADTProduct(testopia, opts, logger, config))
> -    products.append(crops.CROPSProduct(testopia, opts, logger, config))
> -    products.append(eclipse_plugin.EclipePluginProduct(testopia, opts, logger, config))
> -    products.append(esdk.eSDKProduct(testopia, opts, logger, config))
> -    products.append(kernel.KernelProduct(testopia, opts, logger, config))
> -    products.append(general_runtime.GeneralRuntimeProduct(testopia, opts, logger, config))
> +    products.append(bitbake.BitbakeProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(bsp_qemu.BSPQEMUProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(meta_yocto.MetaYoctoProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(oe_core.OECoreProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(runtime.RuntimeProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(toaster.ToasterProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(adt.ADTProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(crops.CROPSProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(eclipse_plugin.EclipePluginProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(esdk.eSDKProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(kernel.KernelProduct(testopia, opts, logger, config, **kwargs))
> +    products.append(general_runtime.GeneralRuntimeProduct(testopia, opts, logger, config, **kwargs))
>  
>      return products
>  
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20170307/bf600ba8/attachment.pgp>


More information about the yocto mailing list