From: "xu,gang" <gangx.xu@intel.com>
To: dts@dpdk.org
Cc: "xu,huilong" <huilongx.xu@intel.com>
Subject: [dts] [PATCH V2] update dump test case
Date: Wed, 17 Aug 2016 14:51:17 +0800 [thread overview]
Message-ID: <1471416677-14656-1-git-send-email-gangx.xu@intel.com> (raw)
From: "xu,huilong" <huilongx.xu@intel.com>
update list:
1. discard test_log_dump, because this function remove in dpdk.org
2. update ring_dump/mempool_dump case, ignore get ring/mempool struct info.
because ring struct is a internal struct, only get ring/mempool name. and check.
3. update dump_devargs case. update arguments and check info.
Signed-off-by: xu,huilong <huilongx.xu@intel.com>
---
tests/TestSuite_dynamic_config.py | 118 +++++++++++++++----------------------
tests/TestSuite_unit_tests_dump.py | 44 +++++---------
2 files changed, 62 insertions(+), 100 deletions(-)
diff --git a/tests/TestSuite_dynamic_config.py b/tests/TestSuite_dynamic_config.py
index 7df02b7..45beb62 100644
--- a/tests/TestSuite_dynamic_config.py
+++ b/tests/TestSuite_dynamic_config.py
@@ -64,19 +64,18 @@ class TestDynamicConfig(TestCase):
# Based on h/w type, choose how many ports to use
self.dut_ports = self.dut.get_ports(self.nic)
- print self.dut_ports
# Verify that enough ports are available
self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
# Prepare cores and ports
cores = self.dut.get_core_list('1S/2C/2T')
- coreMask = dts.create_mask(cores)
- portMask = dts.create_mask(self.dut_ports[:2])
+ self.coreMask = dts.create_mask(cores)
+ self.portMask = dts.create_mask(self.dut_ports[:2])
# launch app
cmd = "./%s/build/app/test-pmd/testpmd -c %s -n 3 -- -i --rxpt=0 \
- --rxht=0 --rxwt=0 --txpt=39 --txht=0 --txwt=0 --portmask=%s" % (self.target, coreMask, portMask)
+ --rxht=0 --rxwt=0 --txpt=39 --txht=0 --txwt=0 --portmask=%s" % (self.target, self.coreMask, self.portMask)
self.dut.send_expect("%s" % cmd, "testpmd> ", 120)
@@ -93,7 +92,8 @@ class TestDynamicConfig(TestCase):
self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong")
self.verify("Promiscuous mode: enabled" in out,
"wrong default promiscuous value")
- self.dut.send_expect("start", "testpmd> ", 120)
+
+ self.dut.kill_all()
def dynamic_config_send_packet(self, portid, destMac="00:11:22:33:44:55"):
"""
@@ -112,7 +112,12 @@ class TestDynamicConfig(TestCase):
"""
Run before each test case.
"""
- pass
+ cmd = "./%s/build/app/test-pmd/testpmd -c %s -n 3 -- -i --rxpt=0 \
+ --rxht=0 --rxwt=0 --txpt=39 --txht=0 --txwt=0 --portmask=%s" % (self.target, self.coreMask, self.portMask)
+
+ self.dut.send_expect("%s" % cmd, "testpmd> ", 120)
+ self.dut.send_expect("start", "testpmd> ", 120)
+
def test_dynamic_config_default_mode(self):
"""
@@ -123,15 +128,15 @@ class TestDynamicConfig(TestCase):
# get the current rx statistic
out = self.dut.send_expect("clear port stats all" , "testpmd> ")
- out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
# send one packet with different MAC address than the portid
self.dynamic_config_send_packet(portid)
pre_rxpkt = cur_rxpkt
- out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
# check the pakcet increasment
self.verify(int(cur_rxpkt) == int(pre_rxpkt)
@@ -141,8 +146,8 @@ class TestDynamicConfig(TestCase):
self.dynamic_config_send_packet(portid, self.dest)
pre_rxpkt = cur_rxpkt
- out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
# check the pakcet increasment
self.verify(int(cur_rxpkt) == int(pre_rxpkt)
@@ -154,57 +159,26 @@ class TestDynamicConfig(TestCase):
"""
portid = self.dut_ports[0]
- if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single"]:
- self.dut.send_expect("set promisc all off", "testpmd> ")
- out = self.dut.send_expect(
- "show port stats %d" % self.dut_ports[1], "testpmd> ")
- cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
-
- self.dynamic_config_send_packet(portid)
- pre_rxpkt = cur_rxpkt
- out = self.dut.send_expect(
- "show port stats %d" % self.dut_ports[1], "testpmd> ")
- cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
- self.verify(int(cur_rxpkt) == int(
- pre_rxpkt), "1st packet increasment error")
- self.dynamic_config_send_packet(portid, self.dest)
- pre_rxpkt = cur_rxpkt
- out = self.dut.send_expect(
- "show port stats %d" % self.dut_ports[1], "testpmd> ")
- cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
- self.verify(int(cur_rxpkt) == int(
- pre_rxpkt) + 1, "2nd packet increasment error")
- else:
- self.dut.send_expect("set promisc %d off" % portid, "testpmd> ")
-
- # get the current rx statistic
- out = self.dut.send_expect(
- "show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
-
- # send one packet with different MAC address than the portid
- self.dynamic_config_send_packet(portid)
-
- pre_rxpkt = cur_rxpkt
- out = self.dut.send_expect(
- "show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
-
- # check the pakcet increasment
- self.verify(int(cur_rxpkt) == int(
- pre_rxpkt), "1st packet increasment error")
-
- # send one packet with the portid MAC address
- self.dynamic_config_send_packet(portid, self.dest)
-
- pre_rxpkt = cur_rxpkt
- out = self.dut.send_expect(
- "show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
-
- # check the pakcet increasment
- self.verify(int(cur_rxpkt) == int(
- pre_rxpkt) + 1, "2nd packet increasment error")
+
+ self.dut.send_expect("set promisc all off", "testpmd> ")
+ out = self.dut.send_expect(
+ "show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+
+ self.dynamic_config_send_packet(portid)
+ pre_rxpkt = cur_rxpkt
+ out = self.dut.send_expect(
+ "show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ self.verify(int(cur_rxpkt) == int(
+ pre_rxpkt), "1st packet increasment error")
+ self.dynamic_config_send_packet(portid, self.dest)
+ pre_rxpkt = cur_rxpkt
+ out = self.dut.send_expect(
+ "show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ self.verify(int(cur_rxpkt) == int(
+ pre_rxpkt) + 1, "2nd packet increasment error")
def test_dynamic_config_broadcast(self):
"""
@@ -269,15 +243,15 @@ class TestDynamicConfig(TestCase):
self.dut.send_expect("set promisc %d on" % portid, "testpmd> ")
# get the current rx statistic
- out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
# send one packet with different MAC address than the portid
self.dynamic_config_send_packet(portid)
pre_rxpkt = cur_rxpkt
- out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
# check the pakcet increasment
self.verify(int(cur_rxpkt) == int(pre_rxpkt)
@@ -287,21 +261,21 @@ class TestDynamicConfig(TestCase):
self.dynamic_config_send_packet(portid, self.dest)
pre_rxpkt = cur_rxpkt
- out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ")
+ cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
# check the pakcet increasment
self.verify(int(cur_rxpkt) == int(pre_rxpkt)
+ 1, "2nd packet increasment error")
- self.dut.send_expect("quit", "# ", 30)
+ #self.dut.send_expect("quit", "# ", 30)
def tear_down(self):
"""
Run after each test case.
"""
- pass
-
+ self.dut.kill_all()
+
def tear_down_all(self):
"""
Run after each test suite.
diff --git a/tests/TestSuite_unit_tests_dump.py b/tests/TestSuite_unit_tests_dump.py
index afdc256..730c4c1 100644
--- a/tests/TestSuite_unit_tests_dump.py
+++ b/tests/TestSuite_unit_tests_dump.py
@@ -72,7 +72,7 @@ class TestUnitTestsDump(TestCase):
"""
pass
- def test_log_dump(self):
+ def discard_test_log_dump(self):
"""
Run history log dump test case.
"""
@@ -85,41 +85,28 @@ class TestUnitTestsDump(TestCase):
"""
Run history log dump test case.
"""
- self.dut.send_expect("./%s/app/test -n 1 -c ffff" % (self.target), "R.*T.*E.*>.*>", self.start_test_time)
- out = self.dut.send_expect("dump_ring", "RTE>>", self.run_cmd_time)
+ self.dut.send_expect("./%s/app/testpmd -n 1 -c f -- -i" % (self.target), "testpmd>", self.start_test_time)
+ out = self.dut.send_expect("dump_ring", "testpmd>", self.run_cmd_time)
self.dut.send_expect("quit", "# ")
- elements = ['ring', 'address', 'flags', 'size', 'ct', 'ch', 'pt', 'ph', 'used', 'avail', 'watermark']
match_regex = "ring <(.*?)>@0x(.*)\r\n"
- for element in elements[2:]:
- match_regex += " %s=(\d*)\r\n" % element
m = re.compile(r"%s" % match_regex, re.S)
- result = m.search(out)
- ring_info = dict(zip(elements, result.groups()))
+ result = m.findall(out)
+
- self.verify(ring_info['ring'] == 'MP_log_history', "Test failed")
+ self.verify(result[0][0] == 'MP_mbuf_pool_socket_0', "dump ring name failed")
def test_mempool_dump(self):
"""
Run mempool dump test case.
"""
- self.dut.send_expect("./%s/app/test -n 1 -c ffff" % (self.target), "R.*T.*E.*>.*>", self.start_test_time)
- out = self.dut.send_expect("dump_mempool", "RTE>>", self.run_cmd_time * 2)
+ self.dut.send_expect("./%s/app/testpmd -n 1 -c f -- -i" % (self.target), "testpmd>", self.start_test_time)
+ out = self.dut.send_expect("dump_mempool", "testpmd>", self.run_cmd_time * 2)
self.dut.send_expect("quit", "# ")
- elements = ['mempool', 'flags', 'ring', 'phys_addr', 'nb_mem_chunks', 'size', 'populated_size', 'header_size', 'elt_size',
- 'trailer_size', 'total_obj_size', 'private_data_size', 'avg bytes/object', 'cache infos','cache_size', 'common_pool_count']
match_regex = "mempool <(.*?)>@0x(.*?)\r\n"
- for element in elements[1:]:
- if element == 'cache_size':
- match_regex += " %s=(.*?)\r\n" % element
- elif element == 'cache infos':
- match_regex += " %s:\r\n" % element
- else:
- match_regex += " %s=(.*?)\r\n" % element
m = re.compile(r"%s" % match_regex, re.S)
- result = m.search(out)
- mempool_info = dict(zip(elements, result.groups()))
+ result = m.findall(out)
- self.verify(mempool_info['mempool'] == 'log_history', "Test failed")
+ self.verify(result[0][0] == 'mbuf_pool_socket_0', "dump mempool name failed")
def test_physmem_dump(self):
"""
@@ -185,19 +172,20 @@ class TestUnitTestsDump(TestCase):
Run devargs dump test case.
"""
test_port = self.dut_ports[0]
- self.dut.send_expect("./%s/app/test -n 1 -c ffff -b %s"
- % (self.target, self.dut.ports_info[test_port]['pci']), "R.*T.*E.*>.*>", self.start_test_time)
+ pci_address = self.dut.ports_info[test_port]['pci'];
+ self.dut.send_expect("./%s/app/test -n 1 -c ffff -b %s"
+ % (self.target, pci_address), "R.*T.*E.*>.*>", self.start_test_time)
out = self.dut.send_expect("dump_devargs", "RTE>>", self.run_cmd_time * 2)
self.dut.send_expect("quit", "# ")
- black_str = "PCI blacklist %s" % self.dut.ports_info[test_port]['pci']
+ black_str = "PCI blacklist %s" % pci_address
self.verify(black_str in out, "Dump black list failed")
self.dut.send_expect("./%s/app/test -n 1 -c ffff -w %s"
- % (self.target, self.dut.ports_info[test_port]['pci']), "R.*T.*E.*>.*>", self.start_test_time)
+ % (self.target, pci_address), "R.*T.*E.*>.*>", self.start_test_time)
out = self.dut.send_expect("dump_devargs", "RTE>>", self.run_cmd_time * 2)
self.dut.send_expect("quit", "# ")
- white_str = "PCI whitelist %s" % self.dut.ports_info[test_port]['pci']
+ white_str = "PCI whitelist %s" % pci_address
self.verify(white_str in out, "Dump white list failed")
def tear_down(self):
--
1.9.3
next reply other threads:[~2016-08-17 6:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-17 6:51 xu,gang [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-08-23 2:27 xu,huilong
2016-08-25 6:15 ` Liu, Yong
2016-08-17 6:53 xu,huilong
2016-08-15 2:52 xu,huilong
2016-08-19 1:08 ` Liu, Yong
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=1471416677-14656-1-git-send-email-gangx.xu@intel.com \
--to=gangx.xu@intel.com \
--cc=dts@dpdk.org \
--cc=huilongx.xu@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).