From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 060D9C52E for ; Thu, 18 Jun 2015 05:06:57 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 17 Jun 2015 20:06:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,636,1427785200"; d="scan'208";a="510123551" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 17 Jun 2015 20:06:56 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t5I36tHe009064; Thu, 18 Jun 2015 11:06:55 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t5I36rIJ016903; Thu, 18 Jun 2015 11:06:55 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t5I36qL7016899; Thu, 18 Jun 2015 11:06:52 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 18 Jun 2015 11:06:38 +0800 Message-Id: <1434596804-16846-4-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1434596804-16846-1-git-send-email-yong.liu@intel.com> References: <1434596804-16846-1-git-send-email-yong.liu@intel.com> Subject: [dts] [dts 3/9] Support virtual scenario in dts main process X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2015 03:06:58 -0000 From: Marvin Liu When section "scenario" contained in execution.cfg, virtual scenario module will be loaded and create the test scenario. Signed-off-by: Marvin Liu diff --git a/framework/dts.py b/framework/dts.py index cf07d51..cf944da 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -55,6 +55,7 @@ from exception import TimeoutException from logger import getLogger import logger import debugger +from virt_scene import VirtScene import sys reload(sys) @@ -144,6 +145,11 @@ def dts_parse_config(section): """ Parse execution file configuration. """ + try: + scenario = config.get(section, 'scenario') + except: + scenario = '' + duts = [dut_.strip() for dut_ in config.get(section, 'crbs').split(',')] targets = [target.strip() @@ -157,7 +163,7 @@ def dts_parse_config(section): nic = [_.strip() for _ in paramDict['nic_type'].split(',')][0] - return duts[0], targets, test_suites, nic + return duts[0], targets, test_suites, nic, scenario def get_project_obj(project_name, super_class, crbInst, serializer): @@ -261,16 +267,29 @@ def dts_run_prerequisties(pkgName, patch): return False -def dts_run_target(crbInst, targets, test_suites, nic): +def dts_run_target(crbInst, targets, test_suites, nic, scenario): """ Run each target in execution targets. """ + if scenario != '': + scene = VirtScene(dut, tester, scenario) + else: + scene = None + + if scene: + scene.load_config() + scene.create_scene() + for target in targets: log_handler.info("\nTARGET " + target) result.target = target try: - dut.set_target(target) + if scene: + scene.set_target(target) + dut.set_target(target, build_only=True) + else: + dut.set_target(target) except AssertionError as ex: log_handler.error(" TARGET ERROR: " + str(ex)) result.add_failed_target(result.dut, target, str(ex)) @@ -284,7 +303,11 @@ def dts_run_target(crbInst, targets, test_suites, nic): paramDict['nic_type'] = 'any' nic = 'any' - dts_run_suite(crbInst, test_suites, target, nic) + dts_run_suite(crbInst, test_suites, target, nic, scene) + + if scene: + scene.destroy_scene() + scene = None dut.restore_interfaces() dut.close() @@ -292,7 +315,7 @@ def dts_run_target(crbInst, targets, test_suites, nic): tester.close() -def dts_run_suite(crbInst, test_suites, target, nic): +def dts_run_suite(crbInst, test_suites, target, nic, scene): """ Run each suite in test suite list. """ @@ -306,7 +329,12 @@ def dts_run_suite(crbInst, test_suites, target, nic): module = test_module for test_classname, test_class in get_subclasses(test_module, TestCase): - test_suite = test_class(dut, tester, target, test_suite) + if scene.vm_dut_enable: + duts = scene.get_vm_duts() + tester.dut = duts[0] + test_suite = test_class(duts[0], tester, target, test_suite) + else: + test_suite = test_class(dut, tester, target, test_suite) result.nic = test_suite.nic dts_log_testsuite(test_suite, log_handler, test_classname) @@ -352,6 +380,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup, global debug_case global Package global Patches + global scenario # save global variable Package = pkgName @@ -405,7 +434,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup, dts_parse_param(section) # verify if the delimiter is good if the lists are vertical - dutIP, targets, test_suites, nics = dts_parse_config(section) + dutIP, targets, test_suites, nics, scenario = dts_parse_config(section) log_handler.info("\nDUT " + dutIP) @@ -431,7 +460,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup, dts_crbs_exit() continue - dts_run_target(crbInst, targets, test_suites, nics) + dts_run_target(crbInst, targets, test_suites, nics, scenario) dts_crbs_exit() -- 1.9.3