test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V3] tests/link_status_interrupt: optimize link-down-on-close checking method
@ 2021-10-25  9:05 Jiale Song
  0 siblings, 0 replies; only message in thread
From: Jiale Song @ 2021-10-25  9:05 UTC (permalink / raw)
  To: dts; +Cc: Jiale Song

some nic no link-down-on-close

Signed-off-by: Jiale Song <songx.jiale@intel.com>
---
 tests/TestSuite_link_status_interrupt.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tests/TestSuite_link_status_interrupt.py b/tests/TestSuite_link_status_interrupt.py
index bdb43f42..b58099b0 100755
--- a/tests/TestSuite_link_status_interrupt.py
+++ b/tests/TestSuite_link_status_interrupt.py
@@ -79,14 +79,16 @@ class TestLinkStatusInterrupt(TestCase):
             set_flag = "ethtool --set-priv-flags %s %s on" % (intf, self.flag)
             out = self.tester.send_expect(check_flag, "#")
             p = re.compile('%s\s+:\s+(\w+)' % self.flag)
-            res = re.search(p, out).group(1)
-            if res == "off":
-                self.tester.send_expect(set_flag, "#")
-                time.sleep(0.5)
-                out = self.tester.send_expect(check_flag, "#")
-                self.verify(re.search(p, out).group(1) == "on", "set %s %s on failed" % (intf, self.flag))
-            elif not res:
-                self.logger.info("NIC %s might not support this case" % intf)
+            match = re.search(p, out)
+            if match:
+                res = match.group(1)
+                if res == "off":
+                    self.tester.send_expect(set_flag, "#")
+                    time.sleep(0.5)
+                    out = self.tester.send_expect(check_flag, "#")
+                    self.verify(re.search(p, out).group(1) == "on", "set %s %s on failed" % (intf, self.flag))
+                elif not res:
+                    self.logger.info("NIC %s might not support this case" % intf)
 
     def set_link_status_and_verify(self, dutPort, status):
         """
-- 
2.17.1


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

only message in thread, other threads:[~2021-10-25  9:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25  9:05 [dts] [PATCH V3] tests/link_status_interrupt: optimize link-down-on-close checking method Jiale Song

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).