* [dts] [PATCH V1] tests/vswitch_sample_cbdma: fix script issues
@ 2021-07-27 6:36 Wei Ling
2021-07-27 8:24 ` Ling, WeiX
0 siblings, 1 reply; 3+ messages in thread
From: Wei Ling @ 2021-07-27 6:36 UTC (permalink / raw)
To: dts; +Cc: Wei Ling
1.Move self.vm_dut and self.vm from set_up_all to setup.
2.Add bind_dev parameter in start_vms method to make diff
case can bind the NIC into DPDK or not.
3.Add stop_all_apps and use it in tear_down to stop all apps.
Signed-off-by: Wei Ling <weix.ling@intel.com>
---
tests/TestSuite_vswitch_sample_cbdma.py | 32 ++++++++++++-------------
1 file changed, 15 insertions(+), 17 deletions(-)
diff --git a/tests/TestSuite_vswitch_sample_cbdma.py b/tests/TestSuite_vswitch_sample_cbdma.py
index 08422ea3..62ff8de9 100644
--- a/tests/TestSuite_vswitch_sample_cbdma.py
+++ b/tests/TestSuite_vswitch_sample_cbdma.py
@@ -81,8 +81,6 @@ class TestVswitchSampleCBDMA(TestCase):
self.vm_dst_mac0 = '52:54:00:00:00:01'
self.vm_dst_mac1 = '52:54:00:00:00:02'
self.vm_num = 2
- self.vm_dut = []
- self.vm = []
self.app_testpmd_path = self.dut.apps_name['test-pmd']
# create an instance to set stream field setting
self.pktgen_helper = PacketGeneratorHelper()
@@ -107,6 +105,8 @@ class TestVswitchSampleCBDMA(TestCase):
"""
self.dut.send_expect("rm -rf %s/vhost-net*" % self.base_dir, "#")
self.dut.send_expect("killall -I qemu-system-x86_64", '#', 20)
+ self.vm_dut = []
+ self.vm = []
def set_max_queues(self, max_queues=512):
self.logger.info("Configure MAX_QUEUES to {}".format(max_queues))
@@ -172,7 +172,7 @@ class TestVswitchSampleCBDMA(TestCase):
pmd_session.start_testpmd(cores=cores, param=params, eal_param=eal_params, no_pci=True, ports=[], prefix=prefix,
fixed_prefix=True)
- def start_vms(self, mode=0, mergeable=True, server_mode=False, set_target=True):
+ def start_vms(self, mode=0, mergeable=True, server_mode=False, set_target=True, bind_dev=True):
"""
start two VM, each VM has one virtio device
"""
@@ -202,7 +202,7 @@ class TestVswitchSampleCBDMA(TestCase):
vm_info.set_vm_device(**vm_params)
time.sleep(3)
try:
- vm_dut = vm_info.start(set_target=set_target)
+ vm_dut = vm_info.start(set_target=set_target, bind_dev=bind_dev)
if vm_dut is None:
raise Exception("Set up VM ENV failed")
except Exception as e:
@@ -370,8 +370,6 @@ class TestVswitchSampleCBDMA(TestCase):
for table_row in perf_result:
self.result_table_add(table_row)
self.result_table_print()
- self.virtio_user0_pmd.execute_cmd("quit", "#")
- self.vhost_user.send_expect("^C", "# ", 20)
def config_stream_imix(self, frame_sizes, port_num, dst_mac_list):
tgen_input = []
@@ -473,9 +471,6 @@ class TestVswitchSampleCBDMA(TestCase):
for table_row in perf_result:
self.result_table_add(table_row)
self.result_table_print()
- self.virtio_user0_pmd.execute_cmd("quit", "#")
- self.virtio_user1_pmd.execute_cmd("quit", "#")
- self.vhost_user.send_expect("^C", "# ", 20)
def get_receive_throughput(self, pmd_session, count=10):
i = 0
@@ -569,9 +564,6 @@ class TestVswitchSampleCBDMA(TestCase):
for table_row in perf_result:
self.result_table_add(table_row)
self.result_table_print()
- self.virtio_user0_pmd.execute_cmd("quit", "# ")
- self.virtio_user1_pmd.execute_cmd("quit", "# ")
- self.vhost_user.send_expect("^C", "# ", 20)
def vm2vm_check_with_two_vhost_device(self):
rx_throughput = {}
@@ -589,7 +581,7 @@ class TestVswitchSampleCBDMA(TestCase):
def start_vms_testpmd_and_test(self, need_start_vm=True):
if need_start_vm:
- self.start_vms(mode=2, mergeable=True, server_mode=True)
+ self.start_vms(mode=2, mergeable=True, server_mode=True, set_target=True, bind_dev=True)
self.vm0_pmd = PmdOutput(self.vm_dut[0])
self.vm1_pmd = PmdOutput(self.vm_dut[1])
self.start_vm_testpmd(self.vm0_pmd)
@@ -622,9 +614,6 @@ class TestVswitchSampleCBDMA(TestCase):
# repeat bind 50 time from virtio-pci to vfio-pci
self.repeat_bind_driver(dut=self.vm_dut[0], repeat_times=50)
self.repeat_bind_driver(dut=self.vm_dut[1], repeat_times=50)
- for i in range(len(self.vm)):
- self.vm[i].stop()
- self.vhost_user.send_expect("^C", "# ", 20)
self.table_header = ['Frame Size(Byte)', 'Before/After Bind VM Driver', 'Throughput(Mpps)']
self.result_table_create(self.table_header)
@@ -712,7 +701,7 @@ class TestVswitchSampleCBDMA(TestCase):
def start_iperf_and_scp_test_in_vms(self, need_start_vm=True, mode=0, mergeable=False, server_mode=False):
if need_start_vm:
- self.start_vms(mode=mode, mergeable=mergeable, server_mode=server_mode, set_target=False)
+ self.start_vms(mode=mode, mergeable=mergeable, server_mode=server_mode, set_target=True, bind_dev=False)
self.vm0_pmd = PmdOutput(self.vm_dut[0])
self.vm1_pmd = PmdOutput(self.vm_dut[1])
self.config_vm_env()
@@ -790,10 +779,19 @@ class TestVswitchSampleCBDMA(TestCase):
if getattr(self, 'virtio-user1', None):
self.dut.close_session(self.virtio_user1)
+ def stop_all_apps(self):
+ for i in range(len(self.vm)):
+ self.vm[i].stop()
+ self.virtio_user0_pmd.quit()
+ self.virtio_user1_pmd.quit()
+ self.vhost_user.send_expect("^C", "# ", 20)
+
def tear_down(self):
"""
Run after each test case.
"""
+ self.stop_all_apps()
+ self.dut.kill_all()
self.bind_cbdma_device_to_kernel()
def tear_down_all(self):
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dts] [PATCH V1] tests/vswitch_sample_cbdma: fix script issues
2021-07-27 6:36 [dts] [PATCH V1] tests/vswitch_sample_cbdma: fix script issues Wei Ling
@ 2021-07-27 8:24 ` Ling, WeiX
2021-07-29 5:04 ` Wang, Yinan
0 siblings, 1 reply; 3+ messages in thread
From: Ling, WeiX @ 2021-07-27 8:24 UTC (permalink / raw)
To: dts
> -----Original Message-----
> From: Ling, WeiX <weix.ling@intel.com>
> Sent: Tuesday, July 27, 2021 02:37 PM
> To: dts@dpdk.org
> Cc: Ling, WeiX <weix.ling@intel.com>
> Subject: [dts][PATCH V1] tests/vswitch_sample_cbdma: fix script issues
>
Tested-by: Wei Ling <weix.ling@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dts] [PATCH V1] tests/vswitch_sample_cbdma: fix script issues
2021-07-27 8:24 ` Ling, WeiX
@ 2021-07-29 5:04 ` Wang, Yinan
0 siblings, 0 replies; 3+ messages in thread
From: Wang, Yinan @ 2021-07-29 5:04 UTC (permalink / raw)
To: Ling, WeiX, dts
Acked-by: Yinan Wang <yinan.wang@intel.com>
> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Ling, WeiX
> Sent: 2021?7?27? 16:25
> To: dts@dpdk.org
> Subject: Re: [dts] [PATCH V1] tests/vswitch_sample_cbdma: fix script issues
>
> > -----Original Message-----
> > From: Ling, WeiX <weix.ling@intel.com>
> > Sent: Tuesday, July 27, 2021 02:37 PM
> > To: dts@dpdk.org
> > Cc: Ling, WeiX <weix.ling@intel.com>
> > Subject: [dts][PATCH V1] tests/vswitch_sample_cbdma: fix script issues
> >
> Tested-by: Wei Ling <weix.ling@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-29 5:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 6:36 [dts] [PATCH V1] tests/vswitch_sample_cbdma: fix script issues Wei Ling
2021-07-27 8:24 ` Ling, WeiX
2021-07-29 5:04 ` Wang, Yinan
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).