From: lihong <lihongx.ma@intel.com>
To: dts@dpdk.org
Cc: lihong <lihongx.ma@intel.com>
Subject: [dts] [PATCH V1] tests/multiple_pthread: fix issue of always send pkts after this suite
Date: Tue, 17 Dec 2019 08:11:23 +0800 [thread overview]
Message-ID: <1576541483-27982-1-git-send-email-lihongx.ma@intel.com> (raw)
Signed-off-by: lihong <lihongx.ma@intel.com>
---
tests/TestSuite_multiple_pthread.py | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/tests/TestSuite_multiple_pthread.py b/tests/TestSuite_multiple_pthread.py
index b59f047..6c6a070 100644
--- a/tests/TestSuite_multiple_pthread.py
+++ b/tests/TestSuite_multiple_pthread.py
@@ -36,6 +36,7 @@ import random
import string
import utils
from test_case import TestCase
+from packet import Packet
class TestMultiplePthread(TestCase):
@@ -60,27 +61,19 @@ class TestMultiplePthread(TestCase):
"""
Run before each test case.
"""
- pass
-
- def destroy_packets_session(self):
- """
- close send packets session.
- """
- for i in valports:
- self.tester.create_session(name="%s" % i).send_expect("^C", "#")
- self.tester.destroy_session(self.tester.create_session(name="%s" % i))
+ self.send_sessions = []
def send_packet(self):
"""
- create sessions and Send packets continuous.
+ Send packets continuous.
"""
for index in valports:
localPort = self.tester.get_local_port(index)
iface = self.tester.get_interface(localPort)
- self.send_packets_session = self.tester.create_session(name="%s" % index)
- packet = r'sendp([Ether()/IP(src="1.2.3.4", dst="192.168.0.%d")], iface="%s", loop=1)' % (index, iface)
- self.send_packets_session.send_expect("scapy", ">>>")
- self.send_packets_session.send_command(packet)
+ pcap_str = 'Ether()/IP(src="1.2.3.4", dst="192.168.0.%d")' % (index)
+ self.pkt = Packet(pcap_str)
+ intf = self.pkt.send_pkt_bg(crb=self.tester, tx_port=iface)
+ self.send_sessions.append(intf)
def get_cores_statistic(self, cmdline):
"""
@@ -91,6 +84,7 @@ class TestMultiplePthread(TestCase):
m = cmdline.replace('"', '', 2)
out_list = out.split(m)
mutiple_pthread_session.send_expect("^C", "#")
+ self.dut.close_session(mutiple_pthread_session)
return out_list
def verify_before_send_packets(self, out_list):
@@ -159,7 +153,6 @@ class TestMultiplePthread(TestCase):
# quit application
self.dut.send_expect("stop", "testpmd> ")
self.dut.send_expect("quit", "# ", 30)
- self.destroy_packets_session()
def test_basic_operation(self):
"""
@@ -231,6 +224,8 @@ class TestMultiplePthread(TestCase):
"""
Run after each test case.
"""
+ if len(self.send_sessions) != 0:
+ self.pkt.stop_send_pkt_bg(self.tester, self.send_sessions)
self.dut.kill_all()
def tear_down_all(self):
--
2.7.4
next reply other threads:[~2019-12-17 7:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-17 0:11 lihong [this message]
2019-12-17 7:51 ` Zhu, WenhuiX
2019-12-20 8:05 ` 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=1576541483-27982-1-git-send-email-lihongx.ma@intel.com \
--to=lihongx.ma@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).