From: "Liu, Yong" <yong.liu@intel.com>
To: "Qiu, Michael" <michael.qiu@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [PATCH 1/6] framework/tester: Fix NoneType Error of port_map
Date: Wed, 14 Jan 2015 01:15:21 +0000 [thread overview]
Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E10D4B230@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1421156540-25810-2-git-send-email-michael.qiu@intel.com>
Thanks Michael. This patch is fine here. My confused is that in function map_available_ports, DTS will call map_available_ports_uncached to initialize ports_map when ports_map is none.
Can you give more detail about how ports_map is None, maybe there's other potential issues.
def map_available_ports(self):
"""
Load or generate network connection mapping list.
"""
if self.read_cache:
self.ports_map = 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
>
> File "./framework/tester.py", line 110, in tester_prerequisites
> assert len(self.ports_map) > 0
> TypeError: object of type 'NoneType' has no len()
>
> Currently ports_map is initialized with empty list,
> but it could be overridden by 'None' value.
>
> This patch solves this issue
>
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> ---
> framework/tester.py | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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 == None or len(self.ports_map) == 0:
> + raise ValueError("ports_map should not be empty, please check all
> links")
>
> def get_local_port(self, remotePort):
> """
> --
> 1.9.3
next prev parent reply other threads:[~2015-01-14 1:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 13:42 [dts] [PATCH 0/6] DTS enhancement and clean up Michael Qiu
2015-01-13 13:42 ` [dts] [PATCH 1/6] framework/tester: Fix NoneType Error of port_map Michael Qiu
2015-01-14 1:15 ` Liu, Yong [this message]
2015-01-25 1:07 ` Liu, Yong
2015-01-13 13:42 ` [dts] [PATCH 2/6] framework/crbs: Info clean up of crbs Michael Qiu
2015-01-25 1:07 ` Liu, Yong
2015-01-13 13:42 ` [dts] [PATCH 3/6] framework: Add login password support Michael Qiu
2015-01-14 1:18 ` Liu, Yong
2015-01-25 1:07 ` Liu, Yong
2015-01-13 13:42 ` [dts] [PATCH 4/6] framework/ssh: Add verify ability for command execution Michael Qiu
2015-01-14 1:24 ` Liu, Yong
2015-01-27 5:22 ` [dts] [PATCH v2] " Michael Qiu
2015-02-15 5:05 ` Liu, Yong
2015-01-13 13:42 ` [dts] [PATCH 5/6] framework: Fix ifname not found error Michael Qiu
2015-01-14 1:35 ` Liu, Yong
2015-01-13 13:42 ` [dts] [PATCH 6/6] framework/crb: rework restore_interfaces() Michael Qiu
2015-01-14 1:35 ` Liu, Yong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86228AFD5BCD8E4EBFD2B90117B5E81E10D4B230@SHSMSX103.ccr.corp.intel.com \
--to=yong.liu@intel.com \
--cc=dts@dpdk.org \
--cc=michael.qiu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).