[V1] tests/ice_iavf_fdir: optimize script

Message ID 20230113144822.25213-1-hongbox.li@intel.com (mailing list archive)
State Changes Requested
Headers
Series [V1] tests/ice_iavf_fdir: optimize script |

Checks

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

Commit Message

Li, HongboX Jan. 13, 2023, 2:48 p.m. UTC
  some platforms cannot get the product name, which leads to test interruption, so catch exceptions to ensure that the test can continue

Signed-off-by: Hongbo Li <hongbox.li@intel.com>
---
 tests/TestSuite_ice_iavf_fdir.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
  

Patch

diff --git a/tests/TestSuite_ice_iavf_fdir.py b/tests/TestSuite_ice_iavf_fdir.py
index 458368ad..1d1ef12a 100644
--- a/tests/TestSuite_ice_iavf_fdir.py
+++ b/tests/TestSuite_ice_iavf_fdir.py
@@ -10475,10 +10475,13 @@  class TestICEIAVFFdir(TestCase):
                 'lspci -s {} -vvv |grep "Product Name"'.format(pf_pci), "#"
             )
             res = re.search(r"Network Adapter\s+(?P<product_name>E810-.*)", out)
-            self.verify(res, "product name not found'")
             # if card is chapman beach 100g*2, one pf port equals a general 100g*2 card,so 118 profiles can be used for vf
-            if "E810-2CQDA2" in res.group("product_name"):
-                nex_cnt = 118 // 8
+            try:
+                self.verify(res, "product name not found")
+                if "E810-2CQDA2" in res.group("product_name"):
+                    nex_cnt = 118 // 8
+            except Exception as e:
+                self.logger.warning(e)
 
         else:
             self.verify(False, "The number of ports is not supported")