From patchwork Thu Sep 15 07:13:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weiyuan Li X-Patchwork-Id: 116328 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 E4F8EA00C5; Thu, 15 Sep 2022 09:13:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E01974021D; Thu, 15 Sep 2022 09:13:24 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 2756440156 for ; Thu, 15 Sep 2022 09:13:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663226003; x=1694762003; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zZqJW5v+TwTYLGCReETlnbgnPXC+VV0Jh0UqJtnXFd0=; b=MNo4YE3BindIBFPhREcxdgqFw7K7c/SzbSENe/Svtl/ZfX6bE24Nqrog cMskYFh90aty2XaqnJg5APVuldwCkVpwUThtgmc0Lurr8IENP9fuM4/Gy iTHES2uRtzCHEVaUZfKXqYJuwMOmDgFMq5IOlt5fPN9CaFXmNf1FbwTk0 DDIPeIkPyNI20EuuxhuCpzYBEsTI5XNweuigjjrB3BEkY00Qw1rQ8J/in KKTSYdiKXeavkn25z9qxyKp7HGAWZS0WYOYeNgOlIzewI5l+ZOEOimo0u EeWRmx+AnAkthPJ/Czp1EM/Tlo1NPCSekf3MhWvRd3ouOpm8sTWbdSkTY w==; X-IronPort-AV: E=McAfee;i="6500,9779,10470"; a="296224862" X-IronPort-AV: E=Sophos;i="5.93,317,1654585200"; d="scan'208";a="296224862" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2022 00:13:18 -0700 X-IronPort-AV: E=Sophos;i="5.93,317,1654585200"; d="scan'208";a="594708449" Received: from unknown (HELO localhost.localdomain) ([10.239.252.248]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2022 00:13:16 -0700 From: Weiyuan Li To: dts@dpdk.org Cc: Weiyuan Li , Jiale Song , Peng Yuan Subject: [dts][PATCH V2] tests/port_control: optimize the test script to make run stably Date: Thu, 15 Sep 2022 15:13:34 +0800 Message-Id: <20220915071334.7647-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}". 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..44e8a3ce 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("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)