From 3bf95fd09e2128f1cd762905c5d69cf66b56fd75 Mon Sep 17 00:00:00 2001 From: MatthewLi Date: Thu, 24 Nov 2016 01:56:41 -0500 Subject: dovetail tool: testarea argument added JIRA: DOVETAIL-71 1) argument testarea is added 2) terminology "scenario" change to "testsuite" 3) related documents amended 4) all word "certification" changed to "compliance" Change-Id: I038a9e04bf83cfdac20f0c59adb1841bf5470584 Signed-off-by: MatthewLi --- dovetail/run.py | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) (limited to 'dovetail/run.py') diff --git a/dovetail/run.py b/dovetail/run.py index 86194389..fcc9da1a 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -16,16 +16,16 @@ import utils.dovetail_logger as dt_logger from container import Container from testcase import Testcase -from testcase import Scenario +from testcase import Testsuite from report import Report from conf.dovetail_config import DovetailConfig as dt_config logger = dt_logger.Logger('run.py').getLogger() -def load_scenario(scenario): - Scenario.load() - return Scenario.get(dt_config.SCENARIO_NAMING_FMT % scenario) +def load_testsuite(testsuite): + Testsuite.load() + return Testsuite.get(testsuite) def set_container_tags(option_str): @@ -40,8 +40,13 @@ def load_testcase(): Testcase.load() -def run_test(scenario): - for testcase_name in scenario['testcases_list']: +def run_test(testsuite, testarea): + testarea_list = [] + for value in testsuite['testcases_list']: + if value is not None and (testarea == 'full' or testarea in value): + testarea_list.append(value) + + for testcase_name in testarea_list: logger.info('>>[testcase]: %s' % (testcase_name)) testcase = Testcase.get(testcase_name) if testcase is None: @@ -102,10 +107,10 @@ def filter_env_options(input_dict): def main(*args, **kwargs): - """Dovetail certification test entry!""" - logger.info('=======================================') - logger.info('Dovetail certification: %s!' % (kwargs['scenario'])) - logger.info('=======================================') + """Dovetail compliance test entry!""" + logger.info('================================================') + logger.info('Dovetail compliance: %s!' % (kwargs['testsuite'])) + logger.info('================================================') validate_options(kwargs) envs_options = filter_env_options(kwargs) dt_config.update_envs(envs_options) @@ -113,12 +118,25 @@ def main(*args, **kwargs): dt_config.dovetail_config['functest']['envs']) logger.info('Your new envs for yardstick: %s' % dt_config.dovetail_config['yardstick']['envs']) - load_testcase() - scenario_yaml = load_scenario(kwargs['scenario']) + if 'tag' in kwargs and kwargs['tag'] is not None: set_container_tags(kwargs['tag']) - run_test(scenario_yaml) - Report.generate(scenario_yaml) + + load_testcase() + testsuite_yaml = load_testsuite(kwargs['testsuite']) + testarea = kwargs['testarea'] + testsuite_validation = False + testarea_validation = False + if (testarea == 'full') or (testarea in dt_config.testarea_supported): + testarea_validation = True + if kwargs['testsuite'] in dt_config.testsuite_supported: + testsuite_validation = True + if testsuite_validation and testarea_validation: + run_test(testsuite_yaml, testarea) + Report.generate(testsuite_yaml, testarea) + else: + logger.error('invalid input commands, testsuite %s testarea %s' % + (kwargs['testsuite'], testarea)) CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) -- cgit 1.2.3-korg