From: ohilyard@iol.unh.edu
To: dts@dpdk.org
Cc: ohilyard@iol.unh.edu, lijuan.tu@intel.com, dpdklab@iol.unh.edu
Subject: [dts] [PATCH] tests/stats_checks: clear xstats before starting testing
Date: Tue, 1 Jun 2021 12:58:49 -0400 [thread overview]
Message-ID: <20210601165849.21995-1-ohilyard@iol.unh.edu> (raw)
From: Owen Hilyard <ohilyard@iol.unh.edu>
Port xstats would have non-zero values when the entire test suite
was run. Clearing those stats before starting the tests prevents a
failure where it appears that more packets were sent than were sent
during the test, causing a failure.
Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
tests/TestSuite_stats_checks.py | 34 +++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/tests/TestSuite_stats_checks.py b/tests/TestSuite_stats_checks.py
index 74de4eee..5dc21b6d 100644
--- a/tests/TestSuite_stats_checks.py
+++ b/tests/TestSuite_stats_checks.py
@@ -130,8 +130,8 @@ class TestStatsChecks(TestCase):
src_ip = self.get_random_ip()
pkt.config_layers([('ether', {'dst': mac}),
('ipv4', {'src': src_ip})])
- pkt.send_pkt(crb=self.tester, tx_port=self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])))
-
+ pkt.send_pkt(crb=self.tester,
+ tx_port=self.tester.get_interface(self.tester.get_local_port(self.dut_ports[0])))
def send_packet_of_size_to_tx_port(self, pktsize, received=True):
"""
@@ -180,7 +180,7 @@ class TestStatsChecks(TestCase):
out = self.exec('show port xstats %s' % port_id)
tmp_data = dict()
for prefix in prefix_list:
- pattern = re.compile('%s:(\s+)([0-9]+)' % prefix)
+ pattern = re.compile('%s:(\\s+)([0-9]+)' % prefix)
m = pattern.search(out)
if not m:
tmp_data.setdefault(prefix, 0)
@@ -193,40 +193,42 @@ class TestStatsChecks(TestCase):
if if_zero:
for port in xstats_data.keys():
self.verify(not any(xstats_data[port].values()), 'xstats Initial value error! port {} xstats '
- 'data is {}'.format(port, xstats_data[port]))
+ 'data is {}'.format(port, xstats_data[port]))
else:
self.verify(xstats_data[rx_port]['rx_good_packets'] == stats_data[rx_port]['RX-packets']
- == xstats_data[tx_port]['tx_good_packets'] == stats_data[tx_port]['TX-packets']
- == 100, "pkt recieve or transport count error!")
+ == xstats_data[tx_port]['tx_good_packets'] == stats_data[tx_port]['TX-packets']
+ == 100, "pkt recieve or transport count error!")
self.verify(xstats_data[rx_port]['rx_good_bytes'] == stats_data[rx_port]['RX-bytes'] ==
xstats_data[tx_port]['tx_good_bytes'] == stats_data[tx_port]['TX-bytes'],
'pkt recieve or transport bytes error!')
def xstats_check(self, rx_port, tx_port, if_vf=False):
- self.exec ("port config all rss all")
- self.exec ("set fwd mac")
+ self.exec("port config all rss all")
+ self.exec("set fwd mac")
+ self.exec("clear port xstats all")
org_xstats = self.get_xstats([rx_port, tx_port])
self.verify_results(org_xstats, rx_port, tx_port, if_zero=True)
- self.exec ("start")
+ self.exec("start")
self.send_pkt_with_random_ip(tx_port, count=100, if_vf=if_vf)
- self.exec ("stop")
+ self.exec("stop")
if rx_port == tx_port:
final_xstats = self.get_xstats([rx_port])
- stats_data = {rx_port: self.pmdout.get_pmd_stats(rx_port)}
+ stats_data = {
+ rx_port: self.pmdout.get_pmd_stats(rx_port)
+ }
else:
rx_stats_info = self.pmdout.get_pmd_stats(rx_port)
tx_stats_info = self.pmdout.get_pmd_stats(tx_port)
final_xstats = self.get_xstats([rx_port, tx_port])
- stats_data = {rx_port: rx_stats_info,
- tx_port: tx_stats_info
- }
+ stats_data = {
+ rx_port: rx_stats_info,
+ tx_port: tx_stats_info
+ }
self.verify_results(final_xstats, rx_port, tx_port, stats_data=stats_data)
-
self.pmdout.quit()
-
def set_up_all(self):
"""
Prerequisite steps for each test suit.
--
2.27.0
next reply other threads:[~2021-06-01 16:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 16:58 ohilyard [this message]
2021-06-09 6:38 ` 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=20210601165849.21995-1-ohilyard@iol.unh.edu \
--to=ohilyard@iol.unh.edu \
--cc=dpdklab@iol.unh.edu \
--cc=dts@dpdk.org \
--cc=lijuan.tu@intel.com \
/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).