From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2F00E5A26 for ; Wed, 14 Jan 2015 02:15:50 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 13 Jan 2015 17:15:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="440236983" Received: from pgsmsx105.gar.corp.intel.com ([10.221.44.96]) by FMSMGA003.fm.intel.com with ESMTP; 13 Jan 2015 17:02:56 -0800 Received: from kmsmsx154.gar.corp.intel.com (172.21.73.14) by PGSMSX105.gar.corp.intel.com (10.221.44.96) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 14 Jan 2015 09:15:23 +0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by KMSMSX154.gar.corp.intel.com (172.21.73.14) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 14 Jan 2015 09:15:22 +0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.192]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.64]) with mapi id 14.03.0195.001; Wed, 14 Jan 2015 09:15:21 +0800 From: "Liu, Yong" To: "Qiu, Michael" , "dts@dpdk.org" Thread-Topic: [PATCH 1/6] framework/tester: Fix NoneType Error of port_map Thread-Index: AQHQLzbNB/V+tTEyLU2B0XJ248x1cpy+zy6A Date: Wed, 14 Jan 2015 01:15:21 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E10D4B230@SHSMSX103.ccr.corp.intel.com> References: <1421156540-25810-1-git-send-email-michael.qiu@intel.com> <1421156540-25810-2-git-send-email-michael.qiu@intel.com> In-Reply-To: <1421156540-25810-2-git-send-email-michael.qiu@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH 1/6] framework/tester: Fix NoneType Error of port_map 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: Wed, 14 Jan 2015 01:15:51 -0000 Thanks Michael. This patch is fine here. My confused is that in function = map_available_ports, DTS will call map_available_ports_uncached to initial= ize ports_map when ports_map is none.=20 Can you give more detail about how ports_map is None, maybe there's other p= otential issues. def map_available_ports(self): """ Load or generate network connection mapping list. """ if self.read_cache: self.ports_map =3D self.serializer.load(self.PORT_MAP_CACHE_KEY= ) if not self.read_cache or self.ports_map is None: self.map_available_ports_uncached() self.serializer.save(self.PORT_MAP_CACHE_KEY, self.ports_map) self.logger.warning("DUT PORT MAP: " + str(self.ports_map)) > -----Original Message----- > From: Qiu, Michael > Sent: Tuesday, January 13, 2015 9:42 PM > To: dts@dpdk.org > Cc: Liu, Yong; Qiu, Michael > Subject: [PATCH 1/6] framework/tester: Fix NoneType Error of port_map >=20 > File "./framework/tester.py", line 110, in tester_prerequisites > assert len(self.ports_map) > 0 > TypeError: object of type 'NoneType' has no len() >=20 > Currently ports_map is initialized with empty list, > but it could be overridden by 'None' value. >=20 > This patch solves this issue >=20 > Signed-off-by: Michael Qiu > --- > framework/tester.py | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/framework/tester.py b/framework/tester.py > index 2c023dd..d69503a 100644 > --- a/framework/tester.py > +++ b/framework/tester.py > @@ -125,7 +125,8 @@ class Tester(Crb): > self.restore_interfaces() > self.scan_ports() > self.map_available_ports() > - assert len(self.ports_map) > 0 > + if self.ports_map =3D=3D None or len(self.ports_map) =3D=3D 0: > + raise ValueError("ports_map should not be empty, please chec= k all > links") >=20 > def get_local_port(self, remotePort): > """ > -- > 1.9.3