test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] framework test_case: recover all dut ports before execution
@ 2016-10-28  2:08 Marvin Liu
  0 siblings, 0 replies; only message in thread
From: Marvin Liu @ 2016-10-28  2:08 UTC (permalink / raw)
  To: dts

Bind all dut ports to configured driver before suite execution.
This will help when some suites forgot to recover nic driver.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/test_case.py b/framework/test_case.py
index 85fdb70..7a14d4d 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -60,12 +60,20 @@ class TestCase(object):
         self.logger.config_suite(class_name)
         # local variable
         self._requested_tests = None
+        self.drivername = load_global_setting(HOST_DRIVER_SETTING)
 
         # check session and reconnect if possible
         for dutobj in self.duts:
             self._check_and_reconnect(crb=dutobj)
         self._check_and_reconnect(crb=self.tester)
 
+        # try to recover all dut ports
+        for portid in range(len(self.dut.ports_info)):
+            port = self.dut.ports_info[portid]['port']
+            if len(port.get_sriov_vfs_pci()):
+                port.destroy_sriov_vfs()
+            port.bind_driver(self.drivername)
+
         # covert netdevice to codename
         self.nics = []
         for portid in range(len(self.dut.ports_info)):
@@ -107,7 +115,6 @@ class TestCase(object):
         else:
             self._debug_case = False
 
-        self.drivername = load_global_setting(HOST_DRIVER_SETTING)
 
         # create rst format report for this suite
         self._rst_obj = RstReport('rst_report', target, self.nic, self.suite_name, self._enable_perf)
-- 
1.9.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-28  2:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-28  2:08 [dts] [PATCH] framework test_case: recover all dut ports before execution Marvin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).