diff mbox series

[V2] tests/port_control: optimize the test script to make run stably

Message ID 20220915071334.7647-1-weiyuanx.li@intel.com (mailing list archive)
State Superseded
Headers show
Series [V2] tests/port_control: optimize the test script to make run stably | expand


Context Check Description
ci/Intel-dts-suite-test fail Testing issues
ci/Intel-dts-pylama-test success Testing OK
ci/Intel-dts-format-test success Testing OK

Commit Message

Weiyuan Li Sept. 15, 2022, 7:13 a.m. UTC
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 <weiyuanx.li@intel.com>
Tested-by: Jiale Song < songx.jiale@intel.com>
Acked-by: Peng Yuan <yuan.peng@intel.com>

-modify pattern "*drv=vfio-vfio" to "*drv={self.drvier}".

 tests/TestSuite_port_control.py | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series


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)
         # start port