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 449ED18F for ; Wed, 14 Jan 2015 02:35:06 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 13 Jan 2015 17:31:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="440241727" Received: from pgsmsx107.gar.corp.intel.com ([10.221.44.105]) by FMSMGA003.fm.intel.com with ESMTP; 13 Jan 2015 17:22:11 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by PGSMSX107.gar.corp.intel.com (10.221.44.105) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 14 Jan 2015 09:35:01 +0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.192]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.231]) with mapi id 14.03.0195.001; Wed, 14 Jan 2015 09:35:00 +0800 From: "Liu, Yong" To: "Qiu, Michael" , "dts@dpdk.org" Thread-Topic: [PATCH 5/6] framework: Fix ifname not found error Thread-Index: AQHQLzbRIdmw749wHUuyFYdMpevs+Jy+1IPQ Date: Wed, 14 Jan 2015 01:35:00 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E10D4C276@SHSMSX103.ccr.corp.intel.com> References: <1421156540-25810-1-git-send-email-michael.qiu@intel.com> <1421156540-25810-6-git-send-email-michael.qiu@intel.com> In-Reply-To: <1421156540-25810-6-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 5/6] framework: Fix ifname not found error 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:35:07 -0000 DTS need handle those devices without network interface. Those NICs which k= ernel not supported should also can be tested in DTS. I think we need modify original logic. Let's pending this patch until fixed= issue first. > -----Original Message----- > From: Qiu, Michael > Sent: Tuesday, January 13, 2015 9:42 PM > To: dts@dpdk.org > Cc: Liu, Yong; Qiu, Michael > Subject: [PATCH 5/6] framework: Fix ifname not found error >=20 > Currently, DTS try to get ifname by the file name below the dir: > /sys/bus/pci/devices/xxxx:xx:xx.x/net >=20 > But if the device driver has been unbind or not loaded successful, > kernel will not create that entry, so the ifname will not exist. >=20 > This will cause DTS failure. >=20 > Check that entry to avoid this issue. >=20 > Signed-off-by: Michael Qiu > --- > framework/crb.py | 21 +++++++++++++++------ > framework/dut.py | 10 ++++++++++ > framework/tester.py | 2 +- > 3 files changed, 26 insertions(+), 7 deletions(-) >=20 > diff --git a/framework/crb.py b/framework/crb.py > index aca62c1..ee005c4 100644 > --- a/framework/crb.py > +++ b/framework/crb.py > @@ -55,7 +55,8 @@ class Crb(object): > self.serializer =3D serializer > self.ports_info =3D None >=20 > - def send_expect(self, cmds, expected, timeout=3DTIMEOUT, > alt_session=3DFalse): > + def send_expect(self, cmds, expected, timeout=3DTIMEOUT, > + alt_session=3DFalse, verify =3D False): > """ > Send commands to crb and return string before expected string. I= f > there's no expected string found before timeout, TimeoutExceptio= n will > @@ -63,9 +64,10 @@ class Crb(object): > """ >=20 > if alt_session: > - return self.alt_session.session.send_expect(cmds, expected, = timeout) > + return self.alt_session.session.send_expect(cmds, expected, > + timeout, verify) >=20 > - return self.session.send_expect(cmds, expected, timeout) > + return self.session.send_expect(cmds, expected, timeout, verify) >=20 > def set_test_types(self, func_tests, perf_tests): > """ > @@ -166,7 +168,9 @@ class Crb(object): >=20 > addr_array =3D pci_bus.split(':') > itf =3D self.get_interface_name(addr_array[0], addr_arra= y[1]) > - self.send_expect("ifconfig %s up" % itf, "# ") > + # In case the device driver has already been unbind > + if itf: > + self.send_expect("ifconfig %s up" % itf, "# ") >=20 > except Exception as e: > self.logger.error(" !!! Restore ITF: " + e.message) > @@ -226,8 +230,13 @@ class Crb(object): > """ > Get interface name of specified pci device on linux. > """ > - command =3D 'ls /sys/bus/pci/devices/0000:%s:%s/net' % (bus_id, > devfun_id) > - return self.send_expect(command, '# ') > + ifname_path =3D '/sys/bus/pci/devices/0000:%s:%s/net' % (bus_id, > devfun_id) > + # In case the device driver has already been unbind > + ret =3D self.send_expect("ls %s"% ifname_path, '# ', verify=3DTr= ue) > + if ret =3D=3D -1: > + return None > + else: > + return ret >=20 > def get_interface_name_freebsd(self, bus_id, devfun_id): > """ > diff --git a/framework/dut.py b/framework/dut.py > index d7099ef..96b8bd6 100644 > --- a/framework/dut.py > +++ b/framework/dut.py > @@ -424,6 +424,11 @@ class Dut(Crb): > if pci_id =3D=3D '8086:10fb': > self.send_expect("echo 0000:%s > /sys/bus/pci/drivers/ix= gbe/bind" % > pci_bus, "# ") > intf =3D self.get_interface_name(bus_id, devfun_id) > + # Skip undrived pci Eth device > + if not intf: > + self.logger.info("DUT: [000:%s %s] %s" % (pci_bus, pci_i= d, > + skipped)) > + continue >=20 > out =3D self.send_expect("ip link show %s" % intf, "# ") > if "DOWN" in out: > @@ -478,6 +483,11 @@ class Dut(Crb): > continue >=20 > intf =3D self.get_interface_name(pci_bus) > + # Skip undrived pci devices > + if not intf: > + self.logger.info("DUT: [%s %s] %s" % (pci_bus, pci_id, > + skipped)) > + continue >=20 > macaddr =3D self.get_mac_addr(intf) > ipv6 =3D self.get_ipv6_addr(intf) > diff --git a/framework/tester.py b/framework/tester.py > index 0ebe29a..40f9344 100644 > --- a/framework/tester.py > +++ b/framework/tester.py > @@ -213,7 +213,7 @@ class Tester(Crb): >=20 > intf =3D self.get_interface_name(bus_id, devfun_id) >=20 > - if "No such file" in intf: > + if not intf: > self.logger.info("Tester: [000:%s %s] %s" % (pci_bus, pc= i_id, > "unknow_int= erface")) > continue > -- > 1.9.3