* [dts][PATCH V1 2/3] tests/queue_start_stop: optimize test script to remove re-compile dpdk test step
2023-03-31 6:09 [dts][PATCH V1 1/3] test_plans/vf_queue_start_stop: add new vf test_plan Lingli Chen
@ 2023-03-31 6:09 ` Lingli Chen
2023-03-31 6:09 ` [dts][PATCH V1 3/3] tests/vf_queue_start_stop: add a new vf case Lingli Chen
1 sibling, 0 replies; 3+ messages in thread
From: Lingli Chen @ 2023-03-31 6:09 UTC (permalink / raw)
To: dts; +Cc: yuan.peng, Lingli Chen
remove re-compile dpdk test step to sync with test_plans
Signed-off-by: Lingli Chen <linglix.chen@intel.com>
---
tests/TestSuite_queue_start_stop.py | 42 +++--------------------------
1 file changed, 3 insertions(+), 39 deletions(-)
diff --git a/tests/TestSuite_queue_start_stop.py b/tests/TestSuite_queue_start_stop.py
index 80baf8d6..27af1419 100644
--- a/tests/TestSuite_queue_start_stop.py
+++ b/tests/TestSuite_queue_start_stop.py
@@ -43,21 +43,6 @@ class TestQueueStartStop(TestCase):
"""
Run before each test case.
"""
- try:
- patch_file = FOLDERS["Depends"] + r"/macfwd_log.patch"
- except:
- self.logger.warning(str(FOLDERS))
- patch_file = r"dep/macfwd_log.patch"
- FOLDERS["Depends"] = "dep"
- patch_dst = "/tmp/"
-
- # dpdk patch and build
- try:
- self.dut.session.copy_file_to(patch_file, patch_dst)
- self.patch_hotfix_dpdk(patch_dst + "macfwd_log.patch", True)
- self.dut.build_install_dpdk(self.target)
- except Exception as e:
- raise IOError("dpdk setup failure: %s" % e)
def check_forwarding(self, ports, nic, pktSize=64, received=True):
self.send_packet(ports[0], ports[1], self.nic, pktSize, received)
@@ -85,20 +70,6 @@ class TestQueueStartStop(TestCase):
else:
self.verify(len(sniff_pkts) == 0, "stop queue not work as expected")
- def patch_hotfix_dpdk(self, patch_dir, on=True):
- """
- This function is to apply or remove patch for dpdk.
- patch_dir: the abs path of the patch
- on: True for apply, False for remove
- """
- try:
- if on:
- self.dut.send_expect("patch -p0 < %s" % patch_dir, "[~|~\]]# ")
- else:
- self.dut.send_expect("patch -p0 -R < %s" % patch_dir, "[~|~\]]# ")
- except Exception as e:
- raise ValueError("patch_hotfix_dpdk failure: %s" % e)
-
def test_queue_start_stop(self):
"""
queue start/stop test
@@ -114,6 +85,7 @@ class TestQueueStartStop(TestCase):
)
time.sleep(5)
self.dut.send_expect("set fwd mac", "testpmd>")
+ self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("start", "testpmd>")
self.check_forwarding([0, 0], self.nic)
except Exception as e:
@@ -138,7 +110,7 @@ class TestQueueStartStop(TestCase):
except Exception as e:
raise IOError("queue start/stop forward failure: %s" % e)
self.verify(
- "ports 0 queue 0 receive " not in out,
+ "port 0/queue 0: received 1 packets" not in out,
"start queue revice package failed, out = %s" % out,
)
@@ -153,7 +125,7 @@ class TestQueueStartStop(TestCase):
except Exception as e:
raise IOError("queue start/stop forward failure: %s" % e)
self.verify(
- "ports 0 queue 0 receive " in out,
+ "port 0/queue 0: received 1 packets" in out,
"start queue revice package failed, out = %s" % out,
)
@@ -161,7 +133,6 @@ class TestQueueStartStop(TestCase):
"""
Run after each test case.
"""
- patch_dst = "/tmp/"
try:
self.dut.send_expect("stop", "testpmd>")
@@ -169,13 +140,6 @@ class TestQueueStartStop(TestCase):
except:
print("Failed to quit testpmd")
- self.dut.kill_all()
-
- try:
- self.patch_hotfix_dpdk(patch_dst + "macfwd_log.patch", False)
- except Exception as e:
- print(("patch_hotfix_dpdk remove failure :%s" % e))
-
def tear_down_all(self):
"""
Run after each test suite.
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dts][PATCH V1 3/3] tests/vf_queue_start_stop: add a new vf case
2023-03-31 6:09 [dts][PATCH V1 1/3] test_plans/vf_queue_start_stop: add new vf test_plan Lingli Chen
2023-03-31 6:09 ` [dts][PATCH V1 2/3] tests/queue_start_stop: optimize test script to remove re-compile dpdk test step Lingli Chen
@ 2023-03-31 6:09 ` Lingli Chen
1 sibling, 0 replies; 3+ messages in thread
From: Lingli Chen @ 2023-03-31 6:09 UTC (permalink / raw)
To: dts; +Cc: yuan.peng, Lingli Chen
add vf_queue_start_stop test script
Signed-off-by: Lingli Chen <linglix.chen@intel.com>
---
tests/TestSuite_vf_queue_start_stop.py | 162 +++++++++++++++++++++++++
1 file changed, 162 insertions(+)
create mode 100644 tests/TestSuite_vf_queue_start_stop.py
diff --git a/tests/TestSuite_vf_queue_start_stop.py b/tests/TestSuite_vf_queue_start_stop.py
new file mode 100644
index 00000000..bb98eb2c
--- /dev/null
+++ b/tests/TestSuite_vf_queue_start_stop.py
@@ -0,0 +1,162 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2023 Intel Corporation
+#
+
+"""
+DPDK Test suite.
+
+Test queue start stop Feature
+
+"""
+
+import os
+import re
+import time
+
+import framework.utils as utils
+from framework.packet import Packet, strip_pktload
+from framework.pmd_output import PmdOutput
+from framework.settings import FOLDERS
+from framework.test_case import TestCase
+
+#
+#
+# Test class.
+#
+
+
+class TestQueueStartStop(TestCase):
+ #
+ #
+ #
+ # Test cases.
+ #
+
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ """
+ self.ports = self.dut.get_ports(self.nic)
+ self.verify(len(self.ports) >= 1, "Insufficient number of ports.")
+
+ self.core_config = "1S/2C/1T"
+ self.ports_socket = self.dut.get_numa_id(self.ports[0])
+
+ def set_up(self):
+ """
+ Run before each test case.
+ """
+ # generate vf
+ self.dut.bind_interfaces_linux(self.kdriver)
+ self.dut.generate_sriov_vfs_by_port(self.ports[0], 1)
+ self.vf_port = self.dut.ports_info[self.ports[0]]["vfs_port"][0]
+
+ self.vf_port.bind_driver(driver="vfio-pci")
+ self.vf_port_pci = self.dut.ports_info[self.ports[0]]["sriov_vfs_pci"][0]
+
+ def check_forwarding(self, dmac, received=True):
+ self.send_packet(0, 0, dmac, received)
+
+ def send_packet(self, txPort, rxPort, dmac, received=True):
+ """
+ Send packages according to parameters.
+ """
+ rxitf = self.tester.get_interface(self.tester.get_local_port(rxPort))
+ txitf = self.tester.get_interface(self.tester.get_local_port(txPort))
+
+ pkt = Packet(pkt_type="UDP", pkt_len=64)
+ inst = self.tester.tcpdump_sniff_packets(rxitf)
+ pkt.config_layer("ether", {"dst": dmac})
+ pkt.send_pkt(self.tester, tx_port=txitf, count=4)
+ sniff_pkts = self.tester.load_tcpdump_sniff_packets(inst)
+
+ if received:
+ res = strip_pktload(sniff_pkts, layer="L4")
+ self.verify(
+ "58 58 58 58 58 58 58 58" in res, "receive queue not work as expected"
+ )
+ else:
+ self.verify(len(sniff_pkts) == 0, "stop queue not work as expected")
+
+ def test_vf_queue_start_stop(self):
+ """
+ vf queue start/stop test
+ """
+ self.pmd_out = PmdOutput(self.dut)
+ cores = self.dut.get_core_list(self.core_config, socket=self.ports_socket)
+ # dpdk start
+ try:
+ self.pmd_out.start_testpmd(
+ cores=cores,
+ eal_param="-a %s --file-prefix=vf" % self.vf_port_pci,
+ param="--portmask=0x1 --port-topology=loop",
+ )
+ self.dut.send_expect("set fwd mac", "testpmd>")
+ self.dut.send_expect("set verbose 1", "testpmd>")
+ self.dut.send_expect("start", "testpmd>")
+ self.pmd_out.wait_link_status_up("all")
+
+ dmac = self.pmd_out.get_port_mac(0)
+
+ self.check_forwarding(dmac)
+ except Exception as e:
+ raise IOError("dpdk start and first forward failure: %s" % e)
+
+ # stop rx queue test
+ try:
+ print("test stop rx queue")
+ self.dut.send_expect("stop", "testpmd>")
+ self.dut.send_expect("port 0 rxq 0 stop", "testpmd>")
+ self.dut.send_expect("start", "testpmd>")
+ self.check_forwarding(dmac, received=False)
+
+ # start rx queue test
+ print("test start rx queue stop tx queue")
+ self.dut.send_expect("stop", "testpmd>")
+ self.dut.send_expect("port 0 rxq 0 start", "testpmd>")
+ self.dut.send_expect("port 0 txq 0 stop", "testpmd>")
+ self.dut.send_expect("start", "testpmd>")
+ self.check_forwarding(dmac, received=False)
+ out = self.dut.get_session_output()
+ except Exception as e:
+ raise IOError("queue start/stop forward failure: %s" % e)
+ self.verify(
+ "port 0/queue 0: received 1 packets" not in out,
+ "start queue revice package failed, out = %s" % out,
+ )
+
+ try:
+ # start tx queue test
+ print("test start rx and tx queue")
+ self.dut.send_expect("stop", "testpmd>")
+ self.dut.send_expect("port 0 txq 0 start", "testpmd>")
+ self.dut.send_expect("start", "testpmd>")
+ self.check_forwarding(dmac)
+ out = self.dut.get_session_output()
+ except Exception as e:
+ raise IOError("queue start/stop forward failure: %s" % e)
+ self.verify(
+ "port 0/queue 0: received 1 packets" in out,
+ "start queue revice package failed, out = %s" % out,
+ )
+
+ def tear_down(self):
+ """
+ Run after each test case.
+ """
+ try:
+ self.dut.send_expect("stop", "testpmd>")
+ self.dut.send_expect("quit", "#")
+ except:
+ print("Failed to quit testpmd")
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ """
+ self.dut.kill_all()
+ self.dut.send_expect("rm -rf ./app/test-pmd/testpmd", "#")
+ self.dut.send_expect("rm -rf ./app/test-pmd/*.o", "#")
+ self.dut.send_expect("rm -rf ./app/test-pmd/build", "#")
+
+ self.dut.bind_interfaces_linux(self.drivername)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread