From patchwork Thu Sep 22 07:29:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weiyuan Li X-Patchwork-Id: 116633 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E73E0A0543; Thu, 22 Sep 2022 09:29:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BBB7540156; Thu, 22 Sep 2022 09:29:38 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id E2A18400D7 for ; Thu, 22 Sep 2022 09:29:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663831778; x=1695367778; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zHb/yVaFjMGIzCaZNIcJdHOgDZzz4eMXdzgzLqWxrus=; b=QmUQZY3ReguLqV5NAHCU/0DWUTFA/9+w/SiADOSOT7b77iK99cncto/P 1R1fnxI5uwfYryDLRjlHb2RuBzCMe1KJUxzrYBJZDrUBD7BhHdkdqOE6J J54GbKORLENoAUT4RaZ4p5/pl3ONGMDofIoVG9lWfCAEdwcKHOxGZeyqb JQsyKVG3ZWSxt/eAMFQry76bjzB0BzYxAM0GFJ8ElXTE9INTbK2W+0EWG tPV1w4oIFGwYlC45dA4f23AjqJ3BR2Z394/gZNwu9CnJLWWIRXC+hofIq FVF9m5h1be7frxNgt8AQpL8Fcgie5uIgKv0FnoT56elboiQQb2xCxi8lS g==; X-IronPort-AV: E=McAfee;i="6500,9779,10477"; a="283274648" X-IronPort-AV: E=Sophos;i="5.93,335,1654585200"; d="scan'208";a="283274648" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 00:29:36 -0700 X-IronPort-AV: E=Sophos;i="5.93,335,1654585200"; d="scan'208";a="745277058" Received: from unknown (HELO localhost.localdomain) ([10.239.252.248]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2022 00:29:35 -0700 From: Weiyuan Li To: dts@dpdk.org Cc: Weiyuan Li , Jiale Song , Peng Yuan Subject: [dts][PATCH V3] tests/port_control: optimize the test script to make run stably Date: Thu, 22 Sep 2022 15:29:53 +0800 Message-Id: <20220922072953.30372-1-weiyuanx.li@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 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 The case of VF binds PF port to kernel driver, and the next test case of PF needs to be bound to the dpdk driver, but it does not test failed. So, add check whether the PF port is bound to the dpdk driver. Signed-off-by: Weiyuan Li --- Tested-by: Jiale Song < songx.jiale@intel.com> Acked-by: Peng Yuan v2: -modify pattern "*drv=vfio-vfio" to "*drv={self.drvier}". v3: -modify script "dpdk-devbind.py -s" to "./usertools/dpdk-devbind.py -s" tests/TestSuite_port_control.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/TestSuite_port_control.py b/tests/TestSuite_port_control.py index d571b01f..bdb1b0ad 100644 --- a/tests/TestSuite_port_control.py +++ b/tests/TestSuite_port_control.py @@ -37,6 +37,7 @@ class TestPortControl(TestCase): self.socket = self.dut.get_numa_id(self.dut_ports[0]) port = self.dut.ports_info[0]["port"] self.pf_default_driver = port.get_nic_driver() + self.driver = self.get_suite_cfg()["vf_driver"] def set_up(self): """ @@ -191,6 +192,14 @@ class TestPortControl(TestCase): ) def test_pf_start_stop_reset_close(self): + # check PF whether bind to vfio-pci + res = self.dut.send_expect("./usertools/dpdk-devbind.py -s", "#") + pattern = f"({self.dut.nic.pci}).*drv={self.driver}" + regex = re.compile(pattern) + mo = regex.search(res) + if mo is None: + self.bind_nic_driver(self.dut_ports[:1], driver=self.driver) + self.start_testpmd(self.host_testpmd) # start port self.start_pmd_port(self.host_testpmd)