From patchwork Fri Sep 25 09:28:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: usurekha@marvell.com X-Patchwork-Id: 78801 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E88C8A04C0; Fri, 25 Sep 2020 11:33:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E1E1D1E88E; Fri, 25 Sep 2020 11:33:59 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 86D2B1DD3F for ; Fri, 25 Sep 2020 11:33:58 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08P9UrI0031118 for ; Fri, 25 Sep 2020 02:33:57 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=IpkjWyxqW4epaUNFGUJjZjrknNvfxb3nkUGHD8EsI7I=; b=d/7IJOBdiZKiOxHHr80LqzRmQAHCQ6Ig2DRMM6mZ5ewUh7Pq9mdipGVF6326ty2gNjQg UzH/JXchWMk1zFroawiPEQSX+Rl+3/vvZt3QeRTwB5GRtWQ2CAepCYaa6pnCkC6KbEsE So15tlmird9qc43DVuMXmfIHvunE0y3lo81XzIn2UTWC0AFwU+W3ZSI6M6Dy8ZsrGdWV rIEER4BDZOIt69bJbZyUMwiG7qXMkOoPDBz/HDPmmGNeNoM6J/9T4+e3aogOfELE2Q8w sRTmH/cLH2LMgDNpztsckIhoeUf344iCosRX/5KgXyG1s601yg74rjbh3hAX8pf0lOuB 1A== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 33nfbqacfe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 25 Sep 2020 02:33:57 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 25 Sep 2020 02:33:56 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 25 Sep 2020 02:33:56 -0700 Received: from cavium.marvell.com (unknown [10.28.8.64]) by maili.marvell.com (Postfix) with ESMTP id 43C503F703F; Fri, 25 Sep 2020 02:33:54 -0700 (PDT) From: To: CC: , , usurekha Date: Fri, 25 Sep 2020 14:58:52 +0530 Message-ID: <1601026132-29371-1-git-send-email-usurekha@marvell.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-25_02:2020-09-24, 2020-09-25 signatures=0 Subject: [dts] [PATCH] tests/TestSuite_multiple_pthread.py: Updated test_positive() and teardown() functions. 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" From: usurekha Added script to get the available max cpu depends on DUT config. Did modifications in teardown() to close the tester scapy sessions properly. Signed-off-by: usurekha --- tests/TestSuite_multiple_pthread.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/TestSuite_multiple_pthread.py b/tests/TestSuite_multiple_pthread.py index 5d4a1f6..2af8196 100644 --- a/tests/TestSuite_multiple_pthread.py +++ b/tests/TestSuite_multiple_pthread.py @@ -62,7 +62,7 @@ class TestMultiplePthread(TestCase): """ Run before each test case. """ - self.send_sessions = [] + self.send_sessions = None def send_packet(self): """ @@ -73,8 +73,7 @@ class TestMultiplePthread(TestCase): iface = self.tester.get_interface(localPort) 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) + self.send_sessions = self.pkt.send_pkt_bg(crb=self.tester, tx_port=iface) def get_cores_statistic(self, cmdline): """ @@ -176,7 +175,14 @@ class TestMultiplePthread(TestCase): Test an random parameter from an defined table which has a couple of valid lcore parameters. """ n = self.cores - CONFIG_RTE_MAX_LCORE = 128 + # Get max available core depends on DUT configuration + cores = self.dut.get_core_list('all') + config_max_lcore = self.dut.get_def_rte_config('CONFIG_RTE_MAX_LCORE') + if config_max_lcore: + CONFIG_RTE_MAX_LCORE = min(int(config_max_lcore), len(cores) + 1) + else: + CONFIG_RTE_MAX_LCORE = len(cores) + 1 + test_list = [ {"lcores": "(%s,%s)@(%s,%s)" % (n[0], CONFIG_RTE_MAX_LCORE-1, n[1], n[2]), "cpu_list":[CONFIG_RTE_MAX_LCORE-1], @@ -230,8 +236,8 @@ class TestMultiplePthread(TestCase): """ Run after each test case. """ - if len(self.send_sessions) != 0: - self.pkt.stop_send_pkt_bg(self.send_sessions) + if self.send_sessions: + self.pkt.stop_send_pkt_bg(self.send_sessions) self.dut.kill_all() def tear_down_all(self):