From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 37AE95A9B for ; Thu, 12 Feb 2015 09:09:44 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 12 Feb 2015 00:04:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,564,1418112000"; d="scan'208";a="651098439" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga001.jf.intel.com with ESMTP; 12 Feb 2015 00:09:25 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t1C89Mpg029917; Thu, 12 Feb 2015 16:09:22 +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 t1C89KvD014835; Thu, 12 Feb 2015 16:09:22 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t1C89Kxq014831; Thu, 12 Feb 2015 16:09:20 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 12 Feb 2015 16:09:06 +0800 Message-Id: <1423728550-14792-2-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1423728550-14792-1-git-send-email-yong.liu@intel.com> References: <1423728550-14792-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH 1/5] framework: remove useless nic list, replaced by port configuration file 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, 12 Feb 2015 08:09:45 -0000 Signed-off-by: Marvinliu --- framework/dts.py | 30 ++++++++++++++---------------- framework/dut.py | 41 ++++++++++++++++++----------------------- 2 files changed, 32 insertions(+), 39 deletions(-) diff --git a/framework/dts.py b/framework/dts.py index bddbe33..871380b 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -64,7 +64,7 @@ results_table_rows = [] results_table_header = [] performance_only = False functional_only = False -nics = None +nic = None requested_tests = None dut = None tester = None @@ -151,13 +151,12 @@ def accepted_nic(pci_id): if pci_id not in NICS.values(): return False - if 'any' in nics: + if 'any' in nic: return True else: - for selected_nic in nics: - if pci_id == NICS[selected_nic]: - return True + if pci_id == NICS[nic]: + return True return False @@ -211,9 +210,9 @@ def dts_parse_config(section): if suite == '': test_suites.remove(suite) - nics = [_.strip() for _ in paramDict['nic_type'].split(',')] + nic = [_.strip() for _ in paramDict['nic_type'].split(',')][0] - return duts[0], targets, test_suites, nics + return duts[0], targets, test_suites, nic def get_project_obj(project_name, super_class, crbInst, serializer): @@ -267,7 +266,7 @@ def dts_log_execution(log_handler): pass -def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics): +def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nic): """ Create dts dut/tester instance and initialize them. """ @@ -282,7 +281,7 @@ def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics): tester.dut = dut dut.set_speedup_options(read_cache, skip_setup) dut.set_directory(base_dir) - dut.set_nic_types(nics) + dut.set_nic_type(nic) tester.set_speedup_options(read_cache, skip_setup) show_speedup_options_messages(read_cache, skip_setup) dut.set_test_types(func_tests=functional_only, perf_tests=performance_only) @@ -315,7 +314,7 @@ def dts_run_prerequisties(pkgName, patch): return False -def dts_run_target(crbInst, targets, test_suites, nics): +def dts_run_target(crbInst, targets, test_suites, nic): """ Run each target in execution targets. """ @@ -336,8 +335,7 @@ def dts_run_target(crbInst, targets, test_suites, nics): if 'nic_type' not in paramDict: paramDict['nic_type'] = 'any' - nics = ['any'] - nic = nics[0] + nic = ['any'] result.nic = nic dts_run_suite(crbInst, test_suites, target, nic) @@ -394,7 +392,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup, global config global serializer - global nics + global nic global requested_tests global result global excel_report @@ -446,7 +444,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, nic = dts_parse_config(section) log_handler.info("\nDUT " + dutIP) @@ -465,14 +463,14 @@ def run_all(config_file, pkgName, git, patch, skip_setup, result.dut = dutIP # init dut, tester crb - dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics) + dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nic) # Run DUT prerequisites if dts_run_prerequisties(pkgName, patch) is False: dts_crbs_exit() continue - dts_run_target(crbInst, targets, test_suites, nics) + dts_run_target(crbInst, targets, test_suites, nic) dts_crbs_exit() diff --git a/framework/dut.py b/framework/dut.py index e095d86..034a915 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -80,12 +80,12 @@ class Dut(Crb): self.send_expect("sed -i 's/%s=.*$/%s=%s/' config/defconfig_%s" % (parameter, parameter, value, target), "# ") - def set_nic_types(self, nics): + def set_nic_type(self, nic): """ Set CRB NICS ready to validated. """ - self.nics = nics - if 'cfg' in nics: + self.nic = nic + if 'cfg' in nic: self.conf.load_ports_config(self.get_ip_address()) def set_toolchain(self, target): @@ -304,11 +304,9 @@ class Dut(Crb): perf = self.want_perf_tests nictypes = [] - if nic_type == 'any' and perf: - return ports for nic in NICS.keys(): - if ('any' == nic_type) or (nic_type in nic): + if ('any' == nic_type) or ('cfg' == nic_type): nictypes.append(nic) for portid in range(len(self.ports_info)): @@ -427,20 +425,17 @@ class Dut(Crb): Check that whether auto scanned ports ready to use """ pci_addr = "%s:%s" % (pci_bus, pci_id) - codenames = [] - for nic in self.nics: - if nic == 'any': - return True - elif nic == 'cfg': - if self.conf.check_port_available(pci_bus) is True: - return True - elif nic not in NICS.keys(): - self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % nic) - else: - codenames.append(NICS[nic]) - - if pci_id in codenames: + if self.nic == 'any': return True + elif self.nic == 'cfg': + if self.conf.check_port_available(pci_bus) is True: + return True + elif self.nic not in NICS.keys(): + self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % self.nic) + else: + codename = NICS[self.nic] + if pci_id == codename: + return True return False @@ -482,8 +477,6 @@ class Dut(Crb): self.scan_ports_uncached() self.serializer.save(self.PORT_INFO_CACHE_KEY, self.ports_info) - self.logger.info(dts.pprint(self.ports_info)) - def scan_ports_uncached(self): """ Scan ports and collect port's pci id, mac adress, ipv6 address. @@ -569,8 +562,10 @@ class Dut(Crb): else: port_cfg = {} - for key in ['intf', 'mac', 'numa', 'peer']: + for key in ['intf', 'mac', 'numa', 'peer', 'source']: if key in port_cfg: if key in port and port_cfg[key] != port[key]: - self.logger.warning("CONGGURED %s NOT SAME AS SCANNED!!!" % (key.upper())) + self.logger.warning("CONFIGURED %s NOT SAME AS SCANNED!!!" % (key.upper())) port[key] = port_cfg[key] + + self.logger.info(dts.pprint(self.ports_info)) -- 1.9.3