[V1,1/1] tests/uni_pkt: optimize code for check result

Message ID 20230307042104.125247-2-jin.ling@intel.com (mailing list archive)
State Superseded
Headers
Series uni_pkt/optimize script |

Checks

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

Commit Message

Jin Ling March 7, 2023, 4:21 a.m. UTC
  The script only checks if there are flags in the output, but both hw and sw parts have flags,
which may lead to incorrect test results, so modified the code in this part to check the hw flag only.

Signed-off-by: Jin Ling <jin.ling@intel.com>
---
 tests/TestSuite_uni_pkt.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--
2.25.1
  

Patch

diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py
index e883b84d..5eb50ed1 100644
--- a/tests/TestSuite_uni_pkt.py
+++ b/tests/TestSuite_uni_pkt.py
@@ -16,6 +16,7 @@  translate the offloaded packet types into these 7 fields of information, for
 user applications
 """

+import re
 import time

 import framework.utils as utils
@@ -59,10 +60,13 @@  class TestUniPacket(TestCase):
             pkt = Packet(pkt_type=pkt_type)
             pkt.send_pkt(self.tester, tx_port=self.tester_iface, count=4)
             out = self.dut.get_session_output(timeout=2)
+            pattern = re.compile(r'hw ptype: (.*?)sw')
+            hw_ptype=re.findall(pattern,out)
             for pkt_layer_name in pkt_names:
-                if pkt_layer_name not in out:
-                    print((utils.RED("Fail to detect %s" % pkt_layer_name)))
-                    raise VerifyFailure("Failed to detect %s" % pkt_layer_name)
+                for tag in hw_ptype:
+                    if pkt_layer_name not in tag:
+                        print((utils.RED("Fail to detect %s" % pkt_layer_name)))
+                        raise VerifyFailure("Failed to detect %s" % pkt_layer_name)
             print((utils.GREEN("Detected %s successfully" % pkt_type)))

     def test_l2pkt_detect(self):