From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B2C65A04FB; Tue, 17 Dec 2019 08:37:04 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9E9C634EF; Tue, 17 Dec 2019 08:37:04 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id BA3112C17 for ; Tue, 17 Dec 2019 08:37:02 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Dec 2019 23:37:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,324,1571727600"; d="scan'208";a="209600295" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.203]) by orsmga008.jf.intel.com with ESMTP; 16 Dec 2019 23:37:00 -0800 From: lihong To: dts@dpdk.org Cc: lihong Date: Tue, 17 Dec 2019 08:11:23 +0800 Message-Id: <1576541483-27982-1-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V1] tests/multiple_pthread: fix issue of always send pkts after this suite X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" Signed-off-by: lihong --- 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