diff mbox series

[V1,4/4] tests/stats_checks:rich test point in case

Message ID 20210907191319.15494-5-zhiminx.huang@intel.com (mailing list archive)
State New
Headers show
Series add plan and case | expand

Checks

Context Check Description
ci/Intel-dts-test fail Testing issues

Commit Message

Zhimin Huang Sept. 7, 2021, 7:13 p.m. UTC
add some new test points in test case:
 add clear stats test.

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
 tests/TestSuite_stats_checks.py | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/tests/TestSuite_stats_checks.py b/tests/TestSuite_stats_checks.py
index 5dc21b6..58c5236 100644
--- a/tests/TestSuite_stats_checks.py
+++ b/tests/TestSuite_stats_checks.py
@@ -208,10 +208,22 @@  class TestStatsChecks(TestCase):
         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")
+        final_xstats, stats_data = self.sendpkt_get_xstats(rx_port, tx_port, if_vf)
+        self.verify_results(final_xstats, rx_port, tx_port, stats_data=stats_data)
+        self.exec("clear port stats all")
+        clear_stats = self.get_xstats([rx_port, tx_port])
+        self.verify_results(clear_stats, rx_port, tx_port, if_zero=True)
 
-        self.send_pkt_with_random_ip(tx_port, count=100, if_vf=if_vf)
+        final_xstats, stats_data = self.sendpkt_get_xstats(rx_port, tx_port, if_vf)
+        self.verify_results(final_xstats, rx_port, tx_port, stats_data=stats_data)
+        self.exec("clear port xstats all")
+        clear_xstats = self.get_xstats([rx_port, tx_port])
+        self.verify_results(clear_xstats, rx_port, tx_port, if_zero=True)
+        self.pmdout.quit()
 
+    def sendpkt_get_xstats(self, rx_port, tx_port, if_vf):
+        self.exec("start")
+        self.send_pkt_with_random_ip(tx_port, count=100, if_vf=if_vf)
         self.exec("stop")
         if rx_port == tx_port:
             final_xstats = self.get_xstats([rx_port])
@@ -226,8 +238,7 @@  class TestStatsChecks(TestCase):
                 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()
+        return final_xstats, stats_data
 
     def set_up_all(self):
         """