[V2] tests/rte_flow_common: optimize scripts

Message ID 20221111113846.26996-1-songx.jiale@intel.com (mailing list archive)
State Accepted
Headers
Series [V2] tests/rte_flow_common: optimize scripts |

Checks

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

Commit Message

Jiale, SongX Nov. 11, 2022, 11:38 a.m. UTC
  1. some packages that mismatch the rule do not have hash values. 
add a parameter "check_hash_num" to determine whether to detect the number of hash values.
2. change "log_msg" to a string.

Signed-off-by: Song Jiale <songx.jiale@intel.com>
---

v2:
-"log_msg" need to return a string, not an exception.

 tests/rte_flow_common.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
  

Comments

Weiyuan Li Nov. 18, 2022, 2:23 a.m. UTC | #1
> -----Original Message-----
> From: Song Jiale <songx.jiale@intel.com>
> Sent: Friday, November 11, 2022 7:39 PM
> To: dts@dpdk.org
> Cc: Jiale, SongX <songx.jiale@intel.com>
> Subject: [dts] [PATCH V2] tests/rte_flow_common: optimize scripts
> 
> 1. some packages that mismatch the rule do not have hash values.
> add a parameter "check_hash_num" to determine whether to detect the
> number of hash values.
> 2. change "log_msg" to a string.
> 
> Signed-off-by: Song Jiale <songx.jiale@intel.com>
> ---
Tested-by: Weiyuan Li <weiyuanx.li@intel.com>
  
Tu, Lijuan Nov. 18, 2022, 8:50 a.m. UTC | #2
On Fri, 11 Nov 2022 11:38:46 +0000, Song Jiale <songx.jiale@intel.com> wrote:
> 1. some packages that mismatch the rule do not have hash values. 
> add a parameter "check_hash_num" to determine whether to detect the number of hash values.
> 2. change "log_msg" to a string.
> 
> Signed-off-by: Song Jiale <songx.jiale@intel.com>


Applied, thanks
  

Patch

diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py
index 02c85f85..b692ba06 100644
--- a/tests/rte_flow_common.py
+++ b/tests/rte_flow_common.py
@@ -133,7 +133,7 @@  def check_output_log_queue_region_mismatched(out, func_param, expect_results):
     try:
         check_queue(out, expect_pkts, check_param, stats=False)
     except Exception as ex:
-        log_msg = ex
+        log_msg = str(ex)
         return False, log_msg
     else:
         log_msg = ""
@@ -156,7 +156,7 @@  def check_output_log_in_queue_mismatched(out, func_param, expect_results):
     try:
         check_queue(out, expect_pkts, check_param, stats=False)
     except Exception as ex:
-        log_msg = ex
+        log_msg = str(ex)
         return False, log_msg
     else:
         log_msg = ""
@@ -346,7 +346,7 @@  def verify(passed, description):
         raise AssertionError(description)
 
 
-def check_rss(out, pkt_num, check_param, stats=True):
+def check_rss(out, pkt_num, check_param, stats=True, check_hash_num=True):
     """
     check whether the packet directed by rss or not according to the specified parameters
     :param out: information received by testpmd after sending packets and port statistics
@@ -359,7 +359,8 @@  def check_rss(out, pkt_num, check_param, stats=True):
     rxq = check_param.get("rxq")
     p = re.compile("RSS\shash=(\w+)\s-\sRSS\squeue=(\w+)")
     pkt_info = p.findall(out)
-    verify(len(pkt_info) == pkt_num, "some packets no hash:{}".format(p.pattern))
+    if check_hash_num:
+        verify(len(pkt_info) == pkt_num, "some packets no hash:{}".format(p.pattern))
     pkt_queue = set([int(i[1], 16) for i in pkt_info])
     if stats:
         verify(
@@ -400,7 +401,7 @@  def check_queue(out, pkt_num, check_param, stats=True):
             if not any(q in queue for q in pkt_queue):
                 print((GREEN("pass: queue id %s not matched" % pkt_queue)))
             else:
-                check_rss(out, pkt_num, check_param, stats=True)
+                check_rss(out, pkt_num, check_param, stats=True, check_hash_num=False)
         return pkt_queue
     else:
         raise Exception("got wrong output, not match pattern %s" % p.pattern)