test suite reviews and discussions
 help / color / mirror / Atom feed
From: zhuwenhui <wenhuix.zhu@intel.com>
To: dts@dpdk.org
Cc: zhuwenhui <wenhuix.zhu@intel.com>
Subject: [dts] [PATCH V1] tests/unit_tests_dump:add new cases
Date: Tue, 18 Jun 2019 11:19:48 +0800	[thread overview]
Message-ID: <1560827988-6625-1-git-send-email-wenhuix.zhu@intel.com> (raw)

Signed-off-by: zhuwenhui <wenhuix.zhu@intel.com>
---
 tests/TestSuite_unit_tests_dump.py | 71 ++++++++++++++++++++++++++++--
 1 file changed, 67 insertions(+), 4 deletions(-)

diff --git a/tests/TestSuite_unit_tests_dump.py b/tests/TestSuite_unit_tests_dump.py
index 74dac56..b519714 100644
--- a/tests/TestSuite_unit_tests_dump.py
+++ b/tests/TestSuite_unit_tests_dump.py
@@ -95,11 +95,16 @@ class TestUnitTestsDump(TestCase):
         self.dut.send_expect("quit", "# ")
         match_regex = "ring <(.*?)>"
         m = re.compile(r"%s" % match_regex, re.S)
-        result = m.findall(out)
+        results = m.findall(out)
         
         # Nic driver will create multiple rings.
         # Only check the last one to make sure ring_dump function work.
-        self.verify( 'MP_mbuf_pool_socket_0' in result, "dump ring name failed")
+        self.verify( 'MP_mbuf_pool_socket_0' in results, "dump ring name failed")
+        for result in results:
+            self.dut.send_expect("%s" % cmd, "testpmd>", self.start_test_time)
+            out = self.dut.send_expect("dump_ring %s" % result, "testpmd>", self.run_cmd_time)
+            self.dut.send_expect("quit", "# ")
+            self.verify( 'capacity' in out, "dump ring name failed")
 
     def test_mempool_dump(self):
         """
@@ -112,9 +117,15 @@ class TestUnitTestsDump(TestCase):
         self.dut.send_expect("quit", "# ")
         match_regex = "mempool <(.*?)>@0x(.*?)\r\n"
         m = re.compile(r"%s" % match_regex, re.S)
-        result = m.findall(out)
+        results = m.findall(out)
+
+        self.verify(results[0][0] == 'mbuf_pool_socket_0', "dump mempool name failed")
+        for result in results:
+            self.dut.send_expect("%s" % cmd, "testpmd>", self.start_test_time)
+            out = self.dut.send_expect("dump_mempool %s" % result[0], "testpmd>", self.run_cmd_time * 2)
+            self.dut.send_expect("quit", "# ")
+            self.verify("internal cache infos:" in out, "dump mempool name failed")
 
-        self.verify(result[0][0] == 'mbuf_pool_socket_0', "dump mempool name failed")
 
     def test_physmem_dump(self):
         """
@@ -198,6 +209,58 @@ class TestUnitTestsDump(TestCase):
         white_str = "[pci]: %s" % pci_address
         self.verify(white_str in out, "Dump white list failed")
 
+    def test_dump_malloc_stats(self):
+        """
+        Run dump malloc dump test case.
+        """
+        self.dut.send_expect("./%s/app/test -n 1 -c %s" % (self.target, self.coremask), "R.*T.*E.*>.*>", self.start_test_time)
+        out = self.dut.send_expect("dump_malloc_stats", "RTE>>", self.run_cmd_time * 2)
+        self.dut.send_expect("quit", "# ")
+        match_regex = "Heap id:(\d*)"
+        m = re.compile(r"%s" % match_regex, re.DOTALL)
+        results = m.findall(out)
+        memzone_info = []
+        for result in results:
+            memzone_info.append(result)
+        self.verify(len(memzone_info) > 0, "Dump malloc stats failed")
+
+    def test_dump_malloc_heaps(self):
+        """
+        Run malloc heaps dump test case.
+        """
+        self.dut.send_expect("./%s/app/test -n 1 -c %s" % (self.target, self.coremask), "R.*T.*E.*>.*>", self.start_test_time)
+        out = self.dut.send_expect("dump_malloc_heaps", "RTE>>", self.run_cmd_time * 2)
+        self.dut.send_expect("quit", "# ")
+
+        elements = ['Heap id', 'Heap size', 'Heap alloc count']
+        match_regex = ""
+        for element in elements:
+            match_regex += "%s:(.*?)\r\n" % element
+        m = re.compile(r"%s" % match_regex, re.DOTALL)
+        results = m.findall(out)
+        memzone_info = []
+        for result in results:
+            memzone_info.append(dict(zip(elements, result)))
+        self.verify(len(memzone_info) > 0, "Dump malloc heaps failed")
+
+    def test_dump_log_types(self):
+        """
+        Run log types dump test case.
+        """
+        self.dut.send_expect("./%s/app/test -n 1 -c %s" % (self.target, self.coremask), "R.*T.*E.*>.*>", self.start_test_time)
+        out = self.dut.send_expect("dump_log_types", "RTE>>", self.run_cmd_time * 2)
+        self.dut.send_expect("quit", "# ")
+
+        elements = ['id']
+        match_regex = "id (\d):"
+        match_regex += "(.*?),"
+        m = re.compile(r"%s" % match_regex, re.DOTALL)
+        results = m.findall(out)
+        memzone_info = []
+        for result in results:
+            memzone_info.append(dict(zip(elements, result)))
+        self.verify(len(memzone_info) > 0, "Dump log types failed")
+
     def tear_down(self):
         """
         Run after each test case.
-- 
2.17.2


             reply	other threads:[~2019-06-18  3:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-18  3:19 zhuwenhui [this message]
2019-06-18  3:19 ` Peng, Yuan
2019-06-18  3:22 ` Yao, BingX Y
2019-07-11  1:22 ` 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=1560827988-6625-1-git-send-email-wenhuix.zhu@intel.com \
    --to=wenhuix.zhu@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).