test suite reviews and discussions
 help / color / mirror / Atom feed
From: yufengmx <yufengx.mo@intel.com>
To: dts@dpdk.org, lei.a.yao@intel.com
Cc: yufengmx <yufengx.mo@intel.com>
Subject: [dts] [PATCH V1 1/1] power_branch_ratio: fix port release issue
Date: Tue,  7 Jul 2020 13:38:54 +0800	[thread overview]
Message-ID: <20200707053854.13787-2-yufengx.mo@intel.com> (raw)
In-Reply-To: <20200707053854.13787-1-yufengx.mo@intel.com>


#. fix port release issue.

Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
 tests/TestSuite_power_branch_ratio.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/tests/TestSuite_power_branch_ratio.py b/tests/TestSuite_power_branch_ratio.py
index 8bd82d4..b45ebcb 100644
--- a/tests/TestSuite_power_branch_ratio.py
+++ b/tests/TestSuite_power_branch_ratio.py
@@ -303,10 +303,12 @@ class TestPowerBranchRatio(TestCase):
         self.dut.build_install_dpdk(self.target)
 
     @contextmanager
-    def restore_compilation(self):
+    def restore_environment(self):
         try:
             yield
         finally:
+            time.sleep(10)
+            self.restore_port_drv()
             sw_table = [
                 "CONFIG_RTE_LIBRTE_POWER",
                 "CONFIG_RTE_LIBRTE_POWER_DEBUG",
@@ -319,6 +321,17 @@ class TestPowerBranchRatio(TestCase):
             # re-compile dpdk source code
             self.dut.build_install_dpdk(self.target)
 
+    def restore_port_drv(self):
+        driver = self.drivername
+        for port in self.dut.ports_info:
+            netdev = port.get('port')
+            if not netdev:
+                continue
+            cur_drv = netdev.get_nic_driver()
+            if cur_drv == driver:
+                continue
+            netdev.bind_driver(driver)
+
     def init_vm_power_mgr(self):
         self.vm_power_mgr = self.prepare_binary('vm_power_manager')
 
@@ -652,7 +665,7 @@ class TestPowerBranchRatio(TestCase):
         """
         Run after each test suite.
         """
-        with self.restore_compilation():
+        with self.restore_environment():
             self.close_vm()
 
     def set_up(self):
-- 
2.21.0


  reply	other threads:[~2020-07-07  5:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07  5:38 [dts] [PATCH V1 0/1] " yufengmx
2020-07-07  5:38 ` yufengmx [this message]
2020-07-20  7:01   ` [dts] [PATCH V1 1/1] " Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200707053854.13787-2-yufengx.mo@intel.com \
    --to=yufengx.mo@intel.com \
    --cc=dts@dpdk.org \
    --cc=lei.a.yao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).