test suite reviews and discussions
 help / color / mirror / Atom feed
* [PATCH v1] framework/dut: fix pylama errors
@ 2021-12-06 12:14 Juraj Linkeš
  2021-12-06 13:55 ` David Marchand
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Juraj Linkeš @ 2021-12-06 12:14 UTC (permalink / raw)
  To: lijuan.tu, ohilyard; +Cc: dts, Juraj Linkeš

Pylama found the following errors:
framework/dut.py:273: [E] E0602 Undefined variable 'threading' [pylint]
framework/dut.py:591: [E] E1101 Instance of 'Dut' has no 'get_def_rte_config' member [pylint]
- move the method from child class
framework/dut.py:631: [E] E0602 Undefined variable 'crbs' [pylint]
framework/dut.py:840: [E] E0602 Undefined variable 'ResultTable' [pylint]
framework/dut.py:846: [E] E0602 Undefined variable 'ResultTable' [pylint]
framework/dut.py:929: [E] E0602 Undefined variable 'pci_bus' [pylint]
framework/dut.py:1173: [E] E0602 Undefined variable 'VMCORELIST' [pylint]
- remove unused method

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
Lijuan, please add additional people to review if needed.
---
 framework/dut.py          | 27 ++++++++++++++++++++-------
 framework/project_dpdk.py | 13 -------------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/framework/dut.py b/framework/dut.py
index dc3fc874..0d3447fe 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -31,6 +31,7 @@
 
 import os
 import re
+import threading
 import time
 from uuid import uuid4
 
@@ -41,6 +42,7 @@ from .config import AppNameConf, PortConf
 from .crb import Crb
 from .settings import LOG_NAME_SEP, NICS
 from .ssh_connection import SSHConnection
+from .test_result import ResultTable
 from .utils import RED, remove_old_rsa_key
 from .virt_resource import VirtResource
 
@@ -540,6 +542,19 @@ class Dut(Crb):
         except AttributeError:
             self.logger.error("%s is not implemented" % function_name)
 
+    def get_def_rte_config(self, config):
+        """
+        Get RTE configuration from config/defconfig_*.
+        """
+        out = self.send_expect("cat config/defconfig_%s | sed '/^#/d' | sed '/^\s*$/d'"
+                                        % self.target, "# ")
+
+        def_rte_config = re.findall(config+'=(\S+)', out)
+        if def_rte_config:
+            return def_rte_config[0]
+        else:
+            return None
+
     def setup_memory_linux(self, hugepages=-1):
         """
         Setup Linux hugepages.
@@ -582,7 +597,7 @@ class Dut(Crb):
                     self.set_huge_pages(arch_huge_pages)
                 else:
                     # before all hugepage average distribution  by all socket,
-                    # but sometimes create mbuf pool on socket 0 failed when 
+                    # but sometimes create mbuf pool on socket 0 failed when
                     # setup testpmd, so set all huge page on first socket
                     if force_socket:
                         self.set_huge_pages(arch_huge_pages, numa_nodes[0])
@@ -628,7 +643,7 @@ class Dut(Crb):
             if pci_bus == port_info['pci']:
                 port = port_info['port']
                 break
-        if port and port.get_ipv4_addr() == crbs['IP'].strip():
+        if port and port.get_ipv4_addr() == self.crb['IP'].strip():
             return True
         else:
             return False
@@ -926,7 +941,8 @@ class Dut(Crb):
             port = port_info['port']
             intf = port.get_interface_name()
             if "No such file" in intf:
-                self.logger.info("DUT: [%s] %s" % (pci_bus, unknow_interface))
+                self.logger.info("DUT: [%s] %s" % (port_info['pci'],
+                                                   unknow_interface))
                 continue
             self.send_expect("ifconfig %s up" % intf, "# ")
             time.sleep(5)
@@ -1056,7 +1072,7 @@ class Dut(Crb):
         self.ports_info = []
 
         skipped = RED('Skipped: Unknown/not selected')
-        
+
         for (pci_bus, pci_id) in self.pci_devices_info:
 
             if not settings.accepted_nic(pci_id):
@@ -1169,9 +1185,6 @@ class Dut(Crb):
         for port_id in range(len(self.ports_info)):
             self.destroy_sriov_vfs_by_port(port_id)
 
-    def get_vm_core_list(self):
-        return VMCORELIST[self.crb['VM CoreList']]
-
     def load_portconf(self):
         """
         Load port configurations for ports_info. If manually configured info
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index 9927bcc1..bc60f1ad 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -649,19 +649,6 @@ class DPDKdut(Dut):
         # No blocklist option in FreeBSD
         return blocklist
 
-    def get_def_rte_config(self, config):
-        """
-        Get RTE configuration from config/defconfig_*.
-        """
-        out = self.send_expect("cat config/defconfig_%s | sed '/^#/d' | sed '/^\s*$/d'"
-                                        % self.target, "# ")
-
-        def_rte_config = re.findall(config+'=(\S+)', out)
-        if def_rte_config:
-            return def_rte_config[0]
-        else:
-            return None
-
     def set_driver_specific_configurations(self, drivername):
         """
         Set configurations required for specific drivers before compilation.
-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] framework/dut: fix pylama errors
  2021-12-06 12:14 [PATCH v1] framework/dut: fix pylama errors Juraj Linkeš
@ 2021-12-06 13:55 ` David Marchand
  2022-01-18 13:59   ` Juraj Linkeš
  2022-01-07  7:42 ` Dong, JunX
  2022-01-19 12:05 ` [PATCH v2] " Juraj Linkeš
  2 siblings, 1 reply; 5+ messages in thread
From: David Marchand @ 2021-12-06 13:55 UTC (permalink / raw)
  To: Juraj Linkeš; +Cc: Tu, Lijuan, Owen Hilyard, dts

On Mon, Dec 6, 2021 at 1:14 PM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
> @@ -540,6 +542,19 @@ class Dut(Crb):
>          except AttributeError:
>              self.logger.error("%s is not implemented" % function_name)
>
> +    def get_def_rte_config(self, config):
> +        """
> +        Get RTE configuration from config/defconfig_*.
> +        """
> +        out = self.send_expect("cat config/defconfig_%s | sed '/^#/d' | sed '/^\s*$/d'"
> +                                        % self.target, "# ")

Is this part still needed?

> +
> +        def_rte_config = re.findall(config+'=(\S+)', out)
> +        if def_rte_config:
> +            return def_rte_config[0]
> +        else:
> +            return None
> +


-- 
David Machand


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v1] framework/dut: fix pylama errors
  2021-12-06 12:14 [PATCH v1] framework/dut: fix pylama errors Juraj Linkeš
  2021-12-06 13:55 ` David Marchand
@ 2022-01-07  7:42 ` Dong, JunX
  2022-01-19 12:05 ` [PATCH v2] " Juraj Linkeš
  2 siblings, 0 replies; 5+ messages in thread
From: Dong, JunX @ 2022-01-07  7:42 UTC (permalink / raw)
  To: Juraj Linkeš, Tu, Lijuan, ohilyard; +Cc: dts

On Monday, December 6, 2021 8:15 PM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
> 628,7 +643,7 @@ class Dut(Crb):
>              if pci_bus == port_info['pci']:
>                  port = port_info['port']
>                  break
> -        if port and port.get_ipv4_addr() == crbs['IP'].strip():
> +        if port and port.get_ipv4_addr() == self.crb['IP'].strip():

Suggest use get_ip_address instance method to get crb IP, not access inner date structure directly.

>              return True
>          else:
>              return False

-- 
Dong Jun

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v1] framework/dut: fix pylama errors
  2021-12-06 13:55 ` David Marchand
@ 2022-01-18 13:59   ` Juraj Linkeš
  0 siblings, 0 replies; 5+ messages in thread
From: Juraj Linkeš @ 2022-01-18 13:59 UTC (permalink / raw)
  To: David Marchand, Dong, JunX; +Cc: Tu, Lijuan, Owen Hilyard, dts



> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Monday, December 6, 2021 2:56 PM
> To: Juraj Linkeš <juraj.linkes@pantheon.tech>
> Cc: Tu, Lijuan <lijuan.tu@intel.com>; Owen Hilyard <ohilyard@iol.unh.edu>;
> dts@dpdk.org
> Subject: Re: [PATCH v1] framework/dut: fix pylama errors
> 
> On Mon, Dec 6, 2021 at 1:14 PM Juraj Linkeš <juraj.linkes@pantheon.tech>
> wrote:
> > @@ -540,6 +542,19 @@ class Dut(Crb):
> >          except AttributeError:
> >              self.logger.error("%s is not implemented" % function_name)
> >
> > +    def get_def_rte_config(self, config):
> > +        """
> > +        Get RTE configuration from config/defconfig_*.
> > +        """
> > +        out = self.send_expect("cat config/defconfig_%s | sed '/^#/d' | sed
> '/^\s*$/d'"
> > +                                        % self.target, "# ")
> 
> Is this part still needed?
> 

Sorry for the delayed reply, the mail got lost in my inbox somehow.
Even if this was needed, I wouldn't really want to do it in this patch, as that would be a bigger than necessary change to address the errors.
But in any case, Lijuan, Jun, is this still needed? I remember you mentioning that DTS is used to test older DPDK versions.

> > +
> > +        def_rte_config = re.findall(config+'=(\S+)', out)
> > +        if def_rte_config:
> > +            return def_rte_config[0]
> > +        else:
> > +            return None
> > +
> 
> 
> --
> David Machand
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] framework/dut: fix pylama errors
  2021-12-06 12:14 [PATCH v1] framework/dut: fix pylama errors Juraj Linkeš
  2021-12-06 13:55 ` David Marchand
  2022-01-07  7:42 ` Dong, JunX
@ 2022-01-19 12:05 ` Juraj Linkeš
  2 siblings, 0 replies; 5+ messages in thread
From: Juraj Linkeš @ 2022-01-19 12:05 UTC (permalink / raw)
  To: lijuan.tu, ohilyard, junx.dong; +Cc: dts, Juraj Linkeš

Pylama found the following errors:
framework/dut.py:273: [E] E0602 Undefined variable 'threading' [pylint]
framework/dut.py:591: [E] E1101 Instance of 'Dut' has no 'get_def_rte_config' member [pylint]
- move the method from child class
framework/dut.py:631: [E] E0602 Undefined variable 'crbs' [pylint]
framework/dut.py:840: [E] E0602 Undefined variable 'ResultTable' [pylint]
framework/dut.py:846: [E] E0602 Undefined variable 'ResultTable' [pylint]
framework/dut.py:929: [E] E0602 Undefined variable 'pci_bus' [pylint]
framework/dut.py:1173: [E] E0602 Undefined variable 'VMCORELIST' [pylint]
- remove unused method

Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
Lijuan, please add additional people to review if needed.
---
 framework/dut.py          | 23 ++++++++++++++++++-----
 framework/project_dpdk.py | 13 -------------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/framework/dut.py b/framework/dut.py
index dc3fc874..16566a9c 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -31,6 +31,7 @@
 
 import os
 import re
+import threading
 import time
 from uuid import uuid4
 
@@ -41,6 +42,7 @@ from .config import AppNameConf, PortConf
 from .crb import Crb
 from .settings import LOG_NAME_SEP, NICS
 from .ssh_connection import SSHConnection
+from .test_result import ResultTable
 from .utils import RED, remove_old_rsa_key
 from .virt_resource import VirtResource
 
@@ -540,6 +542,19 @@ class Dut(Crb):
         except AttributeError:
             self.logger.error("%s is not implemented" % function_name)
 
+    def get_def_rte_config(self, config):
+        """
+        Get RTE configuration from config/defconfig_*.
+        """
+        out = self.send_expect("cat config/defconfig_%s | sed '/^#/d' | sed '/^\s*$/d'"
+                                        % self.target, "# ")
+
+        def_rte_config = re.findall(config+'=(\S+)', out)
+        if def_rte_config:
+            return def_rte_config[0]
+        else:
+            return None
+
     def setup_memory_linux(self, hugepages=-1):
         """
         Setup Linux hugepages.
@@ -628,7 +643,7 @@ class Dut(Crb):
             if pci_bus == port_info['pci']:
                 port = port_info['port']
                 break
-        if port and port.get_ipv4_addr() == crbs['IP'].strip():
+        if port and port.get_ipv4_addr() == self.get_ip_address().strip():
             return True
         else:
             return False
@@ -926,7 +941,8 @@ class Dut(Crb):
             port = port_info['port']
             intf = port.get_interface_name()
             if "No such file" in intf:
-                self.logger.info("DUT: [%s] %s" % (pci_bus, unknow_interface))
+                self.logger.info("DUT: [%s] %s" % (port_info['pci'],
+                                                   unknow_interface))
                 continue
             self.send_expect("ifconfig %s up" % intf, "# ")
             time.sleep(5)
@@ -1169,9 +1185,6 @@ class Dut(Crb):
         for port_id in range(len(self.ports_info)):
             self.destroy_sriov_vfs_by_port(port_id)
 
-    def get_vm_core_list(self):
-        return VMCORELIST[self.crb['VM CoreList']]
-
     def load_portconf(self):
         """
         Load port configurations for ports_info. If manually configured info
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index 9927bcc1..bc60f1ad 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -649,19 +649,6 @@ class DPDKdut(Dut):
         # No blocklist option in FreeBSD
         return blocklist
 
-    def get_def_rte_config(self, config):
-        """
-        Get RTE configuration from config/defconfig_*.
-        """
-        out = self.send_expect("cat config/defconfig_%s | sed '/^#/d' | sed '/^\s*$/d'"
-                                        % self.target, "# ")
-
-        def_rte_config = re.findall(config+'=(\S+)', out)
-        if def_rte_config:
-            return def_rte_config[0]
-        else:
-            return None
-
     def set_driver_specific_configurations(self, drivername):
         """
         Set configurations required for specific drivers before compilation.
-- 
2.20.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-19 12:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 12:14 [PATCH v1] framework/dut: fix pylama errors Juraj Linkeš
2021-12-06 13:55 ` David Marchand
2022-01-18 13:59   ` Juraj Linkeš
2022-01-07  7:42 ` Dong, JunX
2022-01-19 12:05 ` [PATCH v2] " Juraj Linkeš

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git