From: David Liu <dliu@iol.unh.edu>
To: dts@dpdk.org
Cc: lylavoie@iol.unh.edu, dev@dpdk.org, David Liu <dliu@iol.unh.edu>
Subject: [dts] [PATCH] EEPROM Dump Feature
Date: Thu, 24 Sep 2020 12:44:52 -0400 [thread overview]
Message-ID: <20200924164453.50360-1-dliu@iol.unh.edu> (raw)
add test case and test plan for eeprom dump
compare output result from ethtool and testpmd
Signed-off-by: David Liu <dliu@iol.unh.edu>
---
test_plans/eeprom_dump_test_plan.rst | 92 ++++++++++++++++++
tests/TestSuite_eeprom_dump.py | 139 +++++++++++++++++++++++++++
2 files changed, 231 insertions(+)
create mode 100644 test_plans/eeprom_dump_test_plan.rst
create mode 100644 tests/TestSuite_eeprom_dump.py
diff --git a/test_plans/eeprom_dump_test_plan.rst b/test_plans/eeprom_dump_test_plan.rst
new file mode 100644
index 0000000..3b169c3
--- /dev/null
+++ b/test_plans/eeprom_dump_test_plan.rst
@@ -0,0 +1,92 @@
+.. # BSD LICENSE
+ #
+ # Copyright(c) 2020 Intel Corporation. All rights reserved
+ # Copyright © 2020 The University of New Hampshire. All rights reserved.
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted provided that the following conditions
+ # are met:
+ #
+ # * Redistributions of source code must retain the above copyright
+ # notice, this list of conditions and the following disclaimer.
+ # * Redistributions in binary form must reproduce the above copyright
+ # notice, this list of conditions and the following disclaimer in
+ # the documentation and/or other materials provided with the
+ # distribution.
+ # * Neither the name of Intel Corporation nor the names of its
+ # contributors may be used to endorse or promote products derived
+ # from this software without specific prior written permission.
+ #
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=================
+EEPROM Dump Test
+=================
+
+The EEPROM Dump Test checks the ability to output EEPROM information on
+testpmd when requested. Then compares with output from ethtool to verify
+that both output information is the same. When finished, all the files
+created during testing will be deleted. The difference of the two files
+can be found in the log file.
+
+Prerequisites
+=============
+
+If using vfio the kernel must be >= 3.6+ and VT-d must be enabled in bios.When
+using vfio, use the following commands to load the vfio driver and bind it
+to the device under test::
+
+ modprobe vfio
+ modprobe vfio-pci
+ usertools/dpdk-devbind.py --bind=vfio-pci device_bus_id
+
+Assuming that ports are up and working, then launch the ``testpmd`` application
+with the following arguments::
+
+ ./build/app/testpmd -- -i --portmask=0x3
+
+Test Case : EEPROM Dump
+=======================
+
+1. Use testpmd to show the EEPROM information on selected port::
+
+ testpmd> show port <PORT_ID> eeprom
+
+2. Quit the testpmd to have access of ethtool, then use ethtool
+ to get EEPROM information on selected port::
+
+ ethtool -e <interface_name> raw on length <length> >> <file_name>.txt
+
+3. Store the output from testpmd and ethtool into two files, then compare both files.
+ Verify they are the same.
+
+4. Delete all the files created during testing.
+
+
+Test Case : Module EEPROM Dump
+===============================
+
+1. Use testpmd to show the EEPROM information on selected port::
+
+ testpmd> show port <PORT_ID> module_eeprom
+
+2. Quit the testpmd to have access of ethtool, then use ethtool
+ to get EEPROM information on selected port::
+
+ ethtool -m <interface_name> raw on length <length> >> <file_name>.txt
+
+3. Store the output from testpmd and ethtool into two files, then compare both files.
+ Verify they are the same.
+
+4. Delete all the files created during testing.
diff --git a/tests/TestSuite_eeprom_dump.py b/tests/TestSuite_eeprom_dump.py
new file mode 100644
index 0000000..8c2bf4c
--- /dev/null
+++ b/tests/TestSuite_eeprom_dump.py
@@ -0,0 +1,139 @@
+#BSD LICENSE
+#
+# Copyright(c) 2020 Intel Corporation. All rights reserved
+# Copyright © 2020 The University of New Hampshire. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+DPDK Test suite.
+"""
+import utils
+import re
+from pmd_output import PmdOutput
+from test_case import TestCase
+
+
+class TestEEPROMDump(TestCase):
+
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ """
+ self.ports = self.dut.get_ports()
+
+ self.pmdout = PmdOutput(self.dut)
+
+ def set_up(self):
+ """
+ Run before each test case.
+ """
+ pass
+
+ def clean_up_and_compare(self, testname, port):
+ # comapre the two files
+ result = self.dut.send_expect(f"diff testpmd_{testname}_{port}.txt ethtool_{testname}_{port}.txt", "#")
+
+ # Clean up files
+ self.dut.send_expect(f"rm ethtool_{testname}_raw_{port}.txt", "#")
+ self.dut.send_expect(f"rm ethtool_{testname}_hex_{port}.txt", "#")
+ self.dut.send_expect(f"rm ethtool_{testname}_{port}.txt", "#")
+ self.dut.send_expect(f"rm testpmd_{testname}_{port}.txt", "#")
+
+ self.verify(not result, "Testpmd dumped is not same as linux dumped")
+
+ def dump_to_file(self, regex, get, to):
+ # Get testpmd output to have only hex value
+ for line in re.findall(regex, get):
+ line = line.replace(" ", "").lower()
+ self.dut.send_expect(f"echo {line} >> {to}", "#")
+
+ def check_output(self, testname, ethcommand):
+ self.pmdout.start_testpmd("Default")
+ portsinfo = []
+
+ for port in self.ports:
+ pmdout = self.dut.send_expect(f"show port {port} {testname}", "testpmd>")
+ self.verify("Finish --" in pmdout, f"{testname} dump failed")
+
+ # get length from testpmd outout
+ length = re.findall(r'(?<=length: )\d+', pmdout)[0]
+
+ # Store the output and length
+ portinfo = {'port': port, 'length' : length, 'pmdout' :pmdout}
+ portsinfo.append(portinfo)
+
+ self.dut.send_expect("quit", "# ")
+
+ # Bind to the default driver to use ethtool after quit testpmd
+ for port in self.ports:
+ netdev = self.dut.ports_info[port]['port']
+ portinfo = portsinfo[port]
+
+ # strip original driver
+ portinfo['ori_driver'] = netdev.get_nic_driver()
+ portinfo['net_dev'] = netdev
+
+ # bind to default driver
+ netdev.bind_driver()
+
+ # get interface
+ iface = netdev.get_interface_name()
+
+ # Get testpmd output to have only hex value
+ self.dump_to_file(r'(?<=: )(.*)(?= \| )', portinfo['pmdout'], f"testpmd_{testname}_{port}.txt")
+
+ self.dut.send_expect(f"ethtool {ethcommand} {iface} raw on length {portinfo['length']} >> ethtool_{testname}_raw_{port}.txt", "#")
+ self.dut.send_expect(f"xxd ethtool_{testname}_raw_{port}.txt >> ethtool_{testname}_hex_{port}.txt", "#")
+ portinfo['ethout'] = self.dut.send_expect(f"cat ethtool_{testname}_hex_{port}.txt", "#")
+
+ self.dump_to_file(r'(?<=: )(.*)(?= )', portinfo['ethout'], f"ethtool_{testname}_{port}.txt")
+
+ # Compare the files and delete the files after
+ self.clean_up_and_compare(testname, port)
+
+ # bind to original driver
+ portinfo['net_dev'].bind_driver(portinfo['ori_driver'])
+
+ def test_eeprom_dump(self):
+ self.check_output("eeprom", "-e")
+
+ def test_module_eeprom_dump(self):
+ self.check_output("module_eeprom", "-m")
+
+ def tear_down(self):
+ """
+ Run after each test case.
+ """
+ self.dut.kill_all()
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ """
+ self.dut.kill_all()
--
2.17.1
next reply other threads:[~2020-09-24 16:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-24 16:44 David Liu [this message]
2020-09-29 2:45 ` [dts] [dpdk-dev] " Ma, LihongX
2020-10-12 8:45 ` 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=20200924164453.50360-1-dliu@iol.unh.edu \
--to=dliu@iol.unh.edu \
--cc=dev@dpdk.org \
--cc=dts@dpdk.org \
--cc=lylavoie@iol.unh.edu \
/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).