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 69329A0613 for ; Wed, 25 Sep 2019 07:47:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5C4EC2E83; Wed, 25 Sep 2019 07:47:33 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id DD9B72C58 for ; Wed, 25 Sep 2019 07:47:31 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Sep 2019 22:47:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,546,1559545200"; d="scan'208";a="389108547" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 24 Sep 2019 22:47:31 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 24 Sep 2019 22:47:30 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 24 Sep 2019 22:47:30 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.92]) by shsmsx102.ccr.corp.intel.com ([169.254.2.113]) with mapi id 14.03.0439.000; Wed, 25 Sep 2019 13:47:28 +0800 From: "Tu, Lijuan" To: "Mo, YufengX" , "dts@dpdk.org" , "Wang, Yinan" , "Li, WenjieX A" CC: "Mo, YufengX" Thread-Topic: [dts] [PATCH V1 1/1] tests/packet_capture: support 2 nodes testing scenario Thread-Index: AQHVc1+6pou6U5qgYkKk0w24LAah8ac74qhA Date: Wed, 25 Sep 2019 05:47:27 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB27E0D@SHSMSX101.ccr.corp.intel.com> References: <20190925051157.44904-1-yufengx.mo@intel.com> <20190925051157.44904-2-yufengx.mo@intel.com> In-Reply-To: <20190925051157.44904-2-yufengx.mo@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTA3NDI2M2MtM2FjMC00MDA1LTg1OGEtNWIzNmNlNmMzZGMyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiOEVSRDhBR3NmbTRcL29wYU80U0FIZU8zbVdUaE9oZ24xNzRNVzRvQ2xzNXJTQVFXOTl2SExmTlhKQktNRDZpdnQifQ== x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1 1/1] tests/packet_capture: support 2 nodes testing scenario 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" Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yufengmx > Sent: Wednesday, September 25, 2019 1:12 PM > To: dts@dpdk.org; Wang, Yinan ; Li, WenjieX A > > Cc: Mo, YufengX > Subject: [dts] [PATCH V1 1/1] tests/packet_capture: support 2 nodes testi= ng > scenario >=20 >=20 > optimize script to support dut/tester 2 nodes testing scenario *. change = the > target source code relative directory to absolute directory. > *. create a pdump log directory on tester for tcpdump file. > *. change dut kill tcpdump to tester kill tcpdump. > *. change search spare interface attribute to BROADCAST,MULTICAST. > *. change is_existed_on_dut to is_existed_on_crb for dut/tester usage. > *. change pdump log directory from root to tmp. > *. use new packet.py send_pkt input parameter definition. > *. add dut/tester/dts on one node check method. > *. remove kernel nic lldp packet filter out process in parsePacket class. > *. set pdump session name to pdump tool name. > *. restore compile environment after suite execution complete. > *. fix typo. >=20 > phil.yang@arm.com refactor part of source code in packet.py and he hasn't > completed his desired target. His refactor bring dramatic efficiency drop= in > using sniff packet method. When dts running this script is not on tester,= his > refactor bring more trouble than its usage convenience. >=20 > Signed-off-by: yufengmx > --- > tests/TestSuite_packet_capture.py | 253 +++++++++++++++++++----------- > 1 file changed, 161 insertions(+), 92 deletions(-) >=20 > diff --git a/tests/TestSuite_packet_capture.py > b/tests/TestSuite_packet_capture.py > index 4bab902..6e5b98f 100644 > --- a/tests/TestSuite_packet_capture.py > +++ b/tests/TestSuite_packet_capture.py > @@ -39,6 +39,8 @@ import time > import re > import signal > import subprocess > +import shutil > +import socket > from pprint import pformat >=20 > from scapy.utils import rdpcap > @@ -56,7 +58,7 @@ from packet import Packet # refactor. New refactor > methods have much more longer time consumption than # old methods. >=20 > -# Saved back groud sniff process id > +# Saved back ground sniff process id > SNIFF_PIDS =3D {} >=20 >=20 > @@ -128,10 +130,9 @@ def load_sniff_packets(index=3D''): >=20 > class parsePacket(object): >=20 > - def __init__(self, filename, skip_flag=3DFalse): > + def __init__(self, filename): > self.pcapFile =3D filename > self.packetLayers =3D dict() > - self.skip =3D skip_flag >=20 > def parse_packet_layer(self, pkt_object): > if pkt_object is None: > @@ -159,14 +160,9 @@ class parsePacket(object): > cnt =3D 0 > for packet in pcap_pkts_origin: > self.parse_packet_layer(packet) > - flag =3D 'LLDP' not in self.packetLayers.keys() \ > - if self.skip else \ > - True > - src_ether =3D self.packetLayers["Ethernet"]['src'] > - if src_ether =3D=3D '00:00:00:00:00:00' and flag: > - if number =3D=3D cnt: > - break > - cnt +=3D 1 > + if number =3D=3D cnt: > + break > + cnt +=3D 1 > self.packetLayers.clear() >=20 > def parse_pcap(self, number=3D0): > @@ -192,25 +188,94 @@ class parsePacket(object): >=20 > class TestPacketCapture(TestCase): >=20 > - def is_existed_on_dut(self, check_path): > - self.dut.alt_session.send_expect("ls %s" % check_path, "# ") > + def get_dts_node_ip(self): > + ip_addr =3D None > + try: > + socket_inst =3D socket.socket(socket.AF_INET, socket.SOCK_DG= RAM) > + socket_inst.connect(('8.8.8.8', 80)) > + ip_addr =3D socket_inst.getsockname()[0] > + except Exception as e: > + msg =3D "Can't get dts running node ip address" > + self.logger.warning(msg) > + return ip_addr > + return ip_addr > + > + @property > + def is_dts_on_tester(self): > + if not self.dts_ip: > + return False > + # get tester ip to check if dts run on tester > + tester_ip =3D self.tester.get_ip_address() > + return self.dts_ip =3D=3D tester_ip > + > + @property > + def is_dts_on_dut(self): > + if not self.dts_ip: > + return False > + # get dut ip to check if dts run on dut > + dut_ip =3D self.dut.get_ip_address() > + return self.dts_ip =3D=3D dut_ip > + > + @property > + def is_dut_on_tester(self): > + # get dut/tester ip to check if they are in one platform > + tester_ip =3D self.tester.get_ip_address() > + dut_ip =3D self.dut.get_ip_address() > + return tester_ip =3D=3D dut_ip > + > + @property > + def target_dir(self): > + # get absolute directory of target source code > + target_dir =3D '/root' + self.dut.base_dir[1:] \ > + if self.dut.base_dir.startswith('~') else \ > + self.dut.base_dir > + return target_dir > + > + def __create_log_dir(self, log_dir): > + # create a log directory on dts running node > + if not os.path.exists(log_dir): > + os.makedirs(log_dir) > + # create a log directory on dut node > + if not self.is_dts_on_dut and \ > + not self.is_existed_on_crb(log_dir): > + cmd =3D "mkdir -p {0}".format(log_dir) > + self.dut.alt_session.send_expect(cmd, "# ") > + # create a log directory on tester node > + if not self.is_dts_on_tester and \ > + not self.is_existed_on_crb(log_dir, crb=3D'tester'): > + cmd =3D "mkdir -p {0}".format(log_dir) > + self.tester.alt_session.send_expect(cmd, "# ") > + > + def __clear_log_dir(self, log_dir): > + if os.path.exists(log_dir): > + shutil.rmtree(log_dir) > + os.makedirs(log_dir) > + if not self.is_dts_on_dut: > + self.dut.alt_session.send_expect( > + "rm -fr {0}/*".format(log_dir), "# ", 10) > + if not self.is_dts_on_tester: > + self.tester.alt_session.send_expect( > + "rm -fr {0}/*".format(log_dir), "# ", 10) > + > + def is_existed_on_crb(self, check_path, crb=3D'dut'): > + alt_session =3D self.dut.alt_session \ > + if crb =3D=3D 'dut' else \ > + self.tester.alt_session > + alt_session.send_expect("ls %s > /dev/null 2>&1" % check_path, > + "# ") > cmd =3D "echo $?" > - output =3D self.dut.alt_session.send_expect(cmd, "# ") > + output =3D alt_session.send_expect(cmd, "# ") > ret =3D True if output and output.strip() =3D=3D "0" else False > return ret >=20 > def get_dut_iface_with_kernel_driver(self): > # only physical nic support PROMISC > - cmd =3D "ip link show | grep PROMISC | awk {'print $2'}" > + cmd =3D "ip link show | grep BROADCAST,MULTICAST | awk {'print $= 2'}" > out =3D self.dut.alt_session.send_expect(cmd, "# ") > pat =3D "(.*):" > ifaces =3D [intf for intf in re.findall(pat, out, re.M) if intf] > - # get dut/tester ip to check if they are in a platform > - tester_ip =3D self.tester.get_ip_address() > - dut_ip =3D self.dut.get_ip_address() > for link_port in range(len(self.dut_ports)): > # if they are in a platform, ignore interface used by tester > - if tester_ip =3D=3D dut_ip: > + if not self.is_dut_on_tester: > tester_port =3D self.tester.get_local_port(link_port) > intf =3D self.tester.get_interface(tester_port) > if intf in ifaces: > @@ -265,10 +330,10 @@ class TestPacketCapture(TestCase): > self.tcpdump =3D "tcpdump -i {0} " + param + " -w {1} >/dev/null= 2>&1 &" >=20 > def check_pcap_lib(self): > - pcap_lib_dir =3D os.sep.join([self.dut.base_dir, > + pcap_lib_dir =3D os.sep.join([self.target_dir, > self.target, > "lib/librte_pmd_pcap.a"]) > - return self.is_existed_on_dut(pcap_lib_dir) > + return self.is_existed_on_crb(pcap_lib_dir) >=20 > def get_packet_types(self): > packet_types =3D ["TCP", > @@ -435,8 +500,6 @@ class TestPacketCapture(TestCase): > time.sleep(4) >=20 > def start_testpmd(self): > - self.dut.alt_session.send_expect( > - "rm -fr {0}/*".format(self.pdump_log), "# ", 10) > param_opt =3D "--port-topology=3Dchained" > eal_param =3D '--file-prefix=3Dtest' > self.testpmd.start_testpmd("Default", param=3Dparam_opt, @@ -453= ,23 > +516,14 @@ class TestPacketCapture(TestCase): > def start_tcpdump_iface(self, option): > if option["rx"][0] is not None and option["tx"][0] is not None a= nd \ > option["rx"][0] =3D=3D option["tx"][0]: > - if self.is_existed_on_dut(self.rxtx_pcap): > - self.dut.alt_session.send_expect( > - "rm -f %s" % self.rxtx_pcap, "# ") > cmd =3D self.tcpdump.format(self.rxtx_iface, self.rxtx_pcap) > self.session_ex.send_expect(cmd, "# ") > else: > if option["rx"][0] is not None: > - if self.is_existed_on_dut(self.rx_pcap): > - self.dut.alt_session.send_expect( > - "rm -f %s" % self.rx_pcap, "# ") > cmd =3D self.tcpdump.format(self.rx_iface, self.rx_pcap) > self.session_ex.send_expect(cmd, "# ") >=20 > if option["tx"][0] is not None: > - if self.is_existed_on_dut(self.tx_pcap): > - self.dut.alt_session.send_expect( > - "rm -f %s" % self.tx_pcap, "# ") > cmd =3D self.tcpdump.format(self.tx_iface, self.tx_pcap) > self.session_ex.send_expect(cmd, "# ") > time.sleep(4) > @@ -483,10 +537,8 @@ class TestPacketCapture(TestCase): > msg =3D ('pdump option string length should be less than {}' > ).format(length_limit) > self.verify(len(option) < length_limit, msg) > - self.dut.alt_session.send_expect( > - "rm -fr {0}/*".format(self.pdump_log), "# ", 20) > cmd =3D ';'.join([ > - "cd %s" % self.dut.base_dir, > + "cd %s" % self.target_dir, > self.dpdk_pdump + " '%s' >/dev/null 2>&1 &" % (option[0])]) > self.session_ex.send_expect(cmd, "# ", 15) > time.sleep(6) > @@ -494,12 +546,12 @@ class TestPacketCapture(TestCase): > def check_pdump_ready(self, option): > rx_dump_pcap =3D option["rx"][0] > if rx_dump_pcap: > - self.verify(self.is_existed_on_dut(rx_dump_pcap), > + self.verify(self.is_existed_on_crb(rx_dump_pcap), > "{1} {0} is not ready".format(rx_dump_pcap, > self.tool_name)) > tx_dump_pcap =3D option["tx"][0] > if tx_dump_pcap: > - self.verify(self.is_existed_on_dut(tx_dump_pcap), > + self.verify(self.is_existed_on_crb(tx_dump_pcap), > "{1} {0} is not ready".format(tx_dump_pcap, > self.tool_name)) >=20 > @@ -520,12 +572,13 @@ class TestPacketCapture(TestCase): > # check send tx packet by port 0 > # send packet to dut and compare dpdk-pdump dump pcap with > # scapy pcap file > - intf =3D self.tester.get_interface(self.tester.get_local_port(po= rt_1)) > - # prepare to catch replay packet in out port > - recPkt =3D os.path.join('/tmp', "sniff_%s.pcap" % intf) > - if os.path.exists(recPkt): > - os.remove(recPkt) > - index =3D sniff_packets(intf, count=3D1, timeout=3D20, pcap=3Dre= cPkt) > + if self.is_dts_on_tester: > + intf =3D self.tester.get_interface(self.tester.get_local_por= t(port_1)) > + # prepare to catch replay packet in out port > + recPkt =3D os.path.join('/tmp', "sniff_%s.pcap" % intf) > + if os.path.exists(recPkt): > + os.remove(recPkt) > + index =3D sniff_packets(intf, count=3D1, timeout=3D20, > + pcap=3DrecPkt) > pkt =3D Packet(pkt_type=3Dpkt_type) > if pkt_type =3D=3D 'VLAN_UDP': > pkt.config_layer('dot1q', {'vlan': 20}) @@ -539,24 +592,29 @= @ class > TestPacketCapture(TestCase): > # send out test packet > tester_port =3D self.tester.get_local_port(port_0) > intf =3D self.tester.get_interface(tester_port) > - pkt.send_pkt(tx_port=3Dintf) > + pkt.send_pkt( > + crb=3D None if self.is_dts_on_tester else self.tester, > + tx_port=3Dintf) > # load pcap file caught by out port > time.sleep(1) > - load_sniff_packets(index) > - # compare pcap file received by out port with scapy reference > - # packet pcap file > - warning =3D self.compare_pkts(refPkt, recPkt, pkt_type) > - msg =3D "tcpdump rx Receive Packet error: {0}".format(warning) > - self.verify(not warning, msg) > + # when dts doesn't run on tester, ignore this testing content > + if self.is_dts_on_tester: > + load_sniff_packets(index) > + # compare pcap file received by out port with scapy referenc= e > + # packet pcap file > + warning =3D self.compare_pkts(refPkt, recPkt, pkt_type) > + msg =3D "tcpdump rx Receive Packet error: {0}".format(warnin= g) > + self.verify(not warning, msg) > # check send tx packet by port 1 > # send packet to dut and compare dpdk-pdump dump pcap > # with scapy pcap file > - intf =3D self.tester.get_interface(self.tester.get_local_port(po= rt_0)) > - # prepare to catch replay packet in out port > - recPkt =3D os.path.join('/tmp', "sniff_%s.pcap" % intf) > - if os.path.exists(recPkt): > - os.remove(recPkt) > - index =3D sniff_packets(intf, count=3D1, timeout=3D20, pcap=3Dre= cPkt) > + if self.is_dts_on_tester: > + intf =3D self.tester.get_interface(self.tester.get_local_por= t(port_0)) > + # prepare to catch replay packet in out port > + recPkt =3D os.path.join('/tmp', "sniff_%s.pcap" % intf) > + if os.path.exists(recPkt): > + os.remove(recPkt) > + index =3D sniff_packets(intf, count=3D1, timeout=3D20, > + pcap=3DrecPkt) > pkt =3D Packet(pkt_type=3Dpkt_type) > if pkt_type =3D=3D 'VLAN_UDP': > pkt.config_layer('dot1q', {'vlan': 20}) @@ -570,15 +628,19 @= @ class > TestPacketCapture(TestCase): > # send out test packet > tester_port =3D self.tester.get_local_port(port_1) > intf =3D self.tester.get_interface(tester_port) > - pkt.send_pkt(tx_port=3Dintf) > + pkt.send_pkt( > + crb=3D None if self.is_dts_on_tester else self.tester, > + tx_port=3Dintf) > # load pcap file caught by out port > time.sleep(1) > - load_sniff_packets(index) > - # compare pcap file received by out port > - # with scapy reference packet pcap file > - warning =3D self.compare_pkts(refPkt, recPkt, pkt_type) > - msg =3D "tcpdump tx Receive Packet error: {0}".format(warning) > - self.verify(not warning, msg) > + # when dts doesn't run on tester, ignore this testing content > + if self.is_dts_on_tester: > + load_sniff_packets(index) > + # compare pcap file received by out port > + # with scapy reference packet pcap file > + warning =3D self.compare_pkts(refPkt, recPkt, pkt_type) > + msg =3D "tcpdump tx Receive Packet error: {0}".format(warnin= g) > + self.verify(not warning, msg) >=20 > def check_pdump_pcaps(self, pkt_type, number, **kwargs): > rx_dump_pcap =3D kwargs["rx"][0] > @@ -624,8 +686,23 @@ class TestPacketCapture(TestCase): > msg =3D "pdump tx {0} packet content is correct".format(pkt_= type) > self.logger.info(msg) >=20 > + def sync_dut_dump_file(self): > + if self.is_dts_on_dut: > + return > + # copy rx pdump data from dut > + if os.path.exists(self.rx_pcap): > + os.remove(self.rx_pcap) > + if self.is_existed_on_crb(self.rx_pcap): > + self.dut.session.copy_file_from(self.rx_pcap, self.rx_pcap) > + # copy tx pdump data from dut > + if os.path.exists(self.tx_pcap): > + os.remove(self.tx_pcap) > + if self.is_existed_on_crb(self.tx_pcap): > + self.dut.session.copy_file_from(self.tx_pcap, self.tx_pcap) > + > def packet_capture_test_packets(self, option): > self.clear_ASLR() > + self.__clear_log_dir(self.pdump_log) > self.start_testpmd() > self.start_dpdk_pdump(option) > if self.dev_iface_flag: > @@ -636,17 +713,7 @@ class TestPacketCapture(TestCase): > time.sleep(2) > if self.dev_iface_flag: > self.stop_tcpdump_iface() > - if self.dut.get_ip_address() !=3D self.tester.get_ip_address(): > - # copy rx pdump data from dut > - if self.is_existed_on_dut(self.rx_pcap): > - if os.path.exists(self.rx_pcap): > - os.remove(self.rx_pcap) > - self.dut.session.copy_file_from(self.rx_pcap, self.rx_pc= ap) > - # copy tx pdump data from dut > - if self.is_existed_on_dut(self.tx_pcap): > - if os.path.exists(self.tx_pcap): > - os.remove(self.tx_pcap) > - self.dut.session.copy_file_from(self.tx_pcap, self.tx_pc= ap) > + self.sync_dut_dump_file() > self.stop_dpdk_pdump() > self.stop_testpmd() > self.reset_ASLR() > @@ -771,6 +838,8 @@ class TestPacketCapture(TestCase): > ''' > Run at the start of each test suite. > ''' > + # get dts running node ip address > + self.dts_ip =3D self.get_dts_node_ip() > self.verify(self.target =3D=3D "x86_64-native-linuxapp-gcc", > "only support x86_64-native-linuxapp-gcc") > self.dut_ports =3D self.dut.get_ports() @@ -781,29 +850,30 @@ cl= ass > TestPacketCapture(TestCase): > # compile dpdk app with SW CONFIG_RTE_LIBRTE_PMD_PCAP open > self.dut_skip_compile =3D self.dut.skip_setup > # used for save log > - self.pdump_log =3D os.sep.join(["/root", 'pdumpLog']) > - if not self.is_existed_on_dut(self.pdump_log): > - cmd =3D "mkdir -p {0}".format(self.pdump_log) > - self.dut.alt_session.send_expect(cmd, "# ") > + self.pdump_log =3D os.sep.join(["/tmp", 'pdumpLog']) > + self.__create_log_dir(self.pdump_log) > + self.pcap_SW =3D "CONFIG_RTE_LIBRTE_PMD_PCAP" > + self.SW_file =3D os.path.join(self.target_dir, > + 'config/common_base') > if not (self.dut_skip_compile and self.check_pcap_lib()): > - self.pcap_SW =3D "CONFIG_RTE_LIBRTE_PMD_PCAP" > - cmd =3D "sed -i -e 's/{0}=3Dn$/{0}=3Dy/' config/common_base"= .format( > - self.pcap_SW) > + cmd =3D "sed -i -e 's/{0}=3Dn$/{0}=3Dy/' {1}".format( > + self.pcap_SW, self.SW_file) > self.dut.alt_session.send_expect(cmd, "# ", 30) > self.dut.skip_setup =3D False > self.dut.build_install_dpdk(self.target) > - self.session_ex =3D self.dut.new_session() > # secondary process (dpdk-pdump) > - self.pdump_dir =3D self.dut.base_dir + os.sep + \ > - "%s/build/app/pdump/" % self.target > + self.pdump_dir =3D os.sep.join([ > + self.target_dir, > + "%s/build/app/pdump/" % self.target]) > cmd =3D "ls {0} -F | grep '*'".format(self.pdump_dir) > exe_files =3D self.dut.alt_session.send_expect(cmd, "# ").splitl= ines() > if len(exe_files) =3D=3D 1: > self.tool_name =3D exe_files[0][:-1] > else: > self.verify(False, "tool name exception !") > - self.dut_dpdk_pdump_dir =3D self.dut.base_dir + os.sep + \ > - "%s/app/%s" % (self.target, self.tool_name) > + self.dut_dpdk_pdump_dir =3D os.sep.join([ > + self.target_dir, > + "%s/app/%s" % (self.target, self.tool_name)]) > + self.session_ex =3D self.dut.new_session(self.tool_name) > self.dpdk_pdump =3D self.dut_dpdk_pdump_dir + \ > " -v --file-prefix=3Dtest -- --pdump " > self.send_pcap =3D os.sep.join([self.pdump_log, > "scapy_%s_%s_%d.pcap"]) @@ -840,7 +910,7 @@ class > TestPacketCapture(TestCase): > if not self.exit_flag: > self.stop_dpdk_pdump() > self.dut.alt_session.send_expect("killall testpmd", "# ") > - self.dut.alt_session.send_expect("killall tcpdump", "# ") > + self.tester.alt_session.send_expect("killall tcpdump", "# > + ") > self.reset_ASLR() > if self.dev_iface_flag: > self.stop_tcpdump_iface() > @@ -850,20 +920,19 @@ class TestPacketCapture(TestCase): > ''' > Run after each test suite. > ''' > - if self.session_ex: > + if hasattr(self, 'session_ex') and self.session_ex: > self.reset_ASLR() > self.session_ex.close() > self.session_ex =3D None > # Restore the config file and recompile the package. > - if not (self.dut_skip_compile and self.check_pcap_lib()): > - > ################################################################ > ### > + if self.check_pcap_lib(): > self.dut.alt_session.send_expect( > ("sed -i -e 's/{0}=3Dy$/{0}=3Dn/' " > - "config/common_base").format(self.pcap_SW), "# ", 120) > + "{1}").format(self.pcap_SW, self.SW_file), > + "# ", 120) > # temporary disable skip_setup > skip_setup =3D self.dut.skip_setup > self.dut.skip_setup =3D True > self.dut.build_install_dpdk(self.target) > self.dut.skip_setup =3D skip_setup > - > ################################################################ > ### > self.dut.kill_all() > -- > 2.21.0