test suite reviews and discussions
 help / color / mirror / Atom feed
From: Jin Ling <jin.ling@intel.com>
To: dts@dpdk.org
Cc: Jin Ling <jin.ling@intel.com>
Subject: [DTS][PATCH V1 2/3] tests/ice_config_port_speed: add new test cases
Date: Mon, 17 Jul 2023 14:52:52 +0800	[thread overview]
Message-ID: <20230717065253.1611703-3-jin.ling@intel.com> (raw)
In-Reply-To: <20230717065253.1611703-1-jin.ling@intel.com>

Signed-off-by: Jin Ling <jin.ling@intel.com>
---
 tests/TestSuite_ice_config_port_speed.py | 63 ++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 tests/TestSuite_ice_config_port_speed.py

diff --git a/tests/TestSuite_ice_config_port_speed.py b/tests/TestSuite_ice_config_port_speed.py
new file mode 100644
index 00000000..bc7b38de
--- /dev/null
+++ b/tests/TestSuite_ice_config_port_speed.py
@@ -0,0 +1,63 @@
+import copy
+import os
+import re
+import time
+from framework.settings import *
+import framework.utils as utils
+import tests.rte_flow_common as rfc
+from framework.packet import Packet
+from framework.pmd_output import PmdOutput
+from framework.test_case import TestCase, skip_unsupported_pkg
+from framework.utils import GREEN, RED
+
+class ConfigPortSpeed(TestCase):
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        """
+        self.dut_ports = self.dut.get_ports(self.nic)
+        self.pmdout = PmdOutput(self.dut)
+        # Get the Supported Speed list.
+    def set_up(args):
+        pass
+    def tear_down(args):
+        pass
+    def tear_down_all(self):
+        self.dut.kill_all()
+
+    def test_ice_config_port_speed(self):
+        # bind ice driver
+
+        # self.tester_kdriver = get_nic_driver(self.tester.ports_info[0]["type"])
+        self.pmdout.execute_cmd(f"./usertools/dpdk-devbind.py --force -b={self.kdriver} {self.dut.ports_info[0]['pci']}","#")
+        # self.pmdout.execute_cmd(f"./usertools/dpdk-devbind.py --force -b={self.drivername} {self.dut.ports_info[0]['peer']}","#")
+        link_speed = []
+        out = self.pmdout.execute_cmd(f"ethtool {self.dut.ports_info[0]['intf']}","#")
+        link_modes= re.findall('Advertised link modes: (.*)Advertised pause frame use',repr(out))
+        for line in link_modes[0].split(r"\r\n\t"):
+            if line !="":
+                line = line.strip().split("/")
+                speed = re.findall("(\w*)base",line[0])[0]
+                duplex= line[1]
+                link_speed.append((speed,duplex))
+
+        link_speed = list(set(link_speed))
+        # launch testpmd
+        self.pmdout.execute_cmd(f"./usertools/dpdk-devbind.py --force -b={self.drivername} {self.dut.ports_info[0]['pci']}","#")
+        # self.pmdout.execute_cmd(f"./usertools/dpdk-devbind.py --force -b={self.kdriver} {self.dut.ports_info[0]['peer']}","#")
+        self.pmdout.start_testpmd("Default")
+
+        # make sure link speed is up
+        self.verify(self.pmdout.get_port_link_status(self.dut_ports[0])=="up","link is down, cannot set link speed")
+        for item in link_speed:
+            self.pmdout.execute_cmd("port stop all")
+            self.pmdout.execute_cmd(f"port config {self.dut_ports[0]} speed {item[0]} duplex {item[1].lower()}")
+            self.pmdout.execute_cmd("port start all")
+            self.pmdout.wait_link_status_up(self.dut_ports[0],timeout=30)
+            # port_info = self.pmdout.execute_cmd(f"show port info {self.dut_ports[0]}")
+            changed_link_speed = self.pmdout.get_port_link_speed(self.dut_ports[0])
+            change_link_duplex = self.pmdout.get_port_link_duplex(self.dut_ports[0])
+
+            self.verify(int(changed_link_speed) == eval(item[0])//1000
+                        and item[1].lower() in change_link_duplex,
+                        "link speed mode not changed")
--
2.25.1

  parent reply	other threads:[~2023-07-17  6:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17  6:52 [DTS][PATCH V1 0/3] add new test suite ice_config_port_speed Jin Ling
2023-07-17  6:52 ` [DTS][PATCH V1 1/3] test_plan/ice_config_port_speed: add new test plan Jin Ling
2023-07-17  6:52 ` Jin Ling [this message]
2023-07-17  6:52 ` [DTS][PATCH V1 3/3] test_plans/index: add new test_suite Jin Ling

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=20230717065253.1611703-3-jin.ling@intel.com \
    --to=jin.ling@intel.com \
    --cc=dts@dpdk.org \
    /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).