From: Wenjie Li <wenjiex.a.li@intel.com>
To: dts@dpdk.org
Cc: Wenjie Li <wenjiex.a.li@intel.com>
Subject: [dts] [PATCH V1] tests/package_download:add new case
Date: Fri, 27 Dec 2019 12:04:29 +0000 [thread overview]
Message-ID: <1577448269-49807-1-git-send-email-wenjiex.a.li@intel.com> (raw)
add new case check_specific_package_loading
Signed-off-by: Wenjie Li <wenjiex.a.li@intel.com>
---
...e_enable_package_download_in_ice_driver.py | 57 +++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/tests/TestSuite_enable_package_download_in_ice_driver.py b/tests/TestSuite_enable_package_download_in_ice_driver.py
index fd6a27e..f28f0e6 100644
--- a/tests/TestSuite_enable_package_download_in_ice_driver.py
+++ b/tests/TestSuite_enable_package_download_in_ice_driver.py
@@ -295,6 +295,63 @@ class TestEnable_Package_Download_In_Ice_Driver(TestCase):
for error_message in error_messages:
self.verify(error_message in out, "There should be '%s' in out: %s" % (error_message, out))
+ def get_sn(self, nic_pci):
+ cmd = "lspci -vs %s | grep 'Device Serial Number'" % nic_pci
+ out = self.dut.send_expect(cmd, "#")
+ sn_temp = re.findall(r'Device Serial Number (.*)', out)
+ sn = re.sub("-", "", sn_temp[0])
+ return sn
+
+ def check_env(self):
+ """
+ Check the DUT has two or more CVL NICs. If not, return "the ENV needs at least two CVL NICs"
+ """
+ self.nic_pci = [self.dut.ports_info[0]['pci'], self.dut.ports_info[-1]['pci']]
+ self.nic_sn = [self.get_sn(self.nic_pci[0]), self.get_sn(self.nic_pci[1])]
+ self.verify(self.nic_sn[0] != self.nic_sn[1], "the case needs >=2 CVL NICs with different Serial Numbers")
+
+ def copy_specify_ice_pkg(self, pkg_ver):
+ """
+ Copy 2 different ``ice-xxx.pkg`` from dts/dep to dut /tmp/
+ pkg_files = ['ice-1.3.4.0.pkg', 'ice-1.3.10.0.pkg']
+ """
+ dst = "/tmp"
+ pkg_file = "ice-%s.pkg" % pkg_ver
+ src_file = r'./dep/%s' % pkg_file
+ self.dut.session.copy_file_to(src_file, dst)
+
+ def generate_delete_specify_pkg(self, pkg_ver, sn, key="true"):
+ self.dut.send_expect("rm -rf /lib/firmware/intel/ice/ddp/ice-%s.pkg" % sn, "#")
+ if key == "true":
+ self.dut.send_expect("\cp /tmp/ice-%s.pkg /lib/firmware/intel/ice/ddp/ice-%s.pkg" % (pkg_ver, sn), "#")
+
+ def test_check_specific_package_loading(self):
+ """
+ Copy 2 different ``ice.pkg`` into ``/lib/firmware/intel/ice/ddp/``,
+ and rename 1 ice.pkg to ice-<interface serial number>.pkg, e.g. ice-8ce1abfffffefd3c.pkg
+ Launch testpmd with 1 default interface and 1 specific interface,
+ check the ice-<interface serial number>.pkg is loadded by the specific interface.
+ """
+ self.check_env()
+ self.use_correct_ice_pkg(flag="true")
+ self.new_pkgs = ["1.3.10.0", "1.3.4.0"]
+ for i in range(len(self.new_pkgs)):
+ self.copy_specify_ice_pkg(self.new_pkgs[i])
+ self.generate_delete_specify_pkg(pkg_ver=self.new_pkgs[i], sn=self.nic_sn[i], key="true")
+
+ eal_param = "-w %s " % self.nic_pci[0] + "-w %s " % self.nic_pci[1] + "--log-level=8"
+ out = self.dut_testpmd.execute_cmd("./%s/app/testpmd %s -- -i " % (self.target, eal_param))
+ self.dut_testpmd.quit()
+
+ # Delete ice-<interface serial number>.pkg to recover the ENV
+ for i in range(len(self.new_pkgs)):
+ self.generate_delete_specify_pkg(pkg_ver=self.new_pkgs[i], sn=self.nic_sn[i], key="false")
+
+ self.actual_pcis = re.findall(r"device (.*) on", out)
+ self.pkgs = re.findall(r"is: (.*),", out)
+ self.verify(self.actual_pcis == self.nic_pci and self.pkgs == self.new_pkgs,
+ "The nics pci info/pkg are not matched")
+
def tear_down(self):
self.dut_testpmd.quit()
--
2.17.1
next reply other threads:[~2019-12-27 3:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-27 12:04 Wenjie Li [this message]
2019-12-27 3:23 ` Li, WenjieX A
2020-01-02 7:13 ` Chen, Zhaoyan
2020-01-03 2:56 ` Tu, Lijuan
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=1577448269-49807-1-git-send-email-wenjiex.a.li@intel.com \
--to=wenjiex.a.li@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).