diff mbox series

tests: change function check_hash_different

Message ID 20210413021711.39473-1-yuan.peng@intel.com (mailing list archive)
State Accepted
Headers show
Series tests: change function check_hash_different | expand

Commit Message

Peng, Yuan April 13, 2021, 2:17 a.m. UTC
adapt to the scenario that there are two or more hash values in the hashes list.

Signed-off-by: Peng Yuan <yuan.peng@intel.com>
--
v1

Comments

Tu, Lijuan May 7, 2021, 3:20 a.m. UTC | #1
> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Peng Yuan
> Sent: 2021年4月13日 10:17
> To: dts@dpdk.org
> Cc: Peng, Yuan <yuan.peng@intel.com>
> Subject: [dts] [PATCH]tests: change function check_hash_different
> 
> adapt to the scenario that there are two or more hash values in the hashes list.
> 
> Signed-off-by: Peng Yuan <yuan.peng@intel.com>

Applied, thanks
diff mbox series

Patch

diff --git a/tests/rte_flow_common.py b/tests/rte_flow_common.py
index e0a378f3..d8443d3b 100644
--- a/tests/rte_flow_common.py
+++ b/tests/rte_flow_common.py
@@ -728,17 +728,19 @@  class RssProcessing(object):
     def check_hash_different(self, out, key='', port_id=0):
         hashes, rss_distribute = self.get_hash_verify_rss_distribute(out, port_id)
         if len(key) == 0:
-            if hashes == self.current_saved_hash:
-                error_msg = 'hash value {} should be different ' \
-                            'with current saved hash {}'.format(hashes, self.current_saved_hash)
-                self.logger.error(error_msg)
-                self.error_msgs.append(error_msg)
+            for item in hashes:
+                if item in self.current_saved_hash:
+                    error_msg = 'hash value {} should be different ' \
+                    'with current saved hash {}'.format(item, self.current_saved_hash)
+                    self.logger.error(error_msg)
+                    self.error_msgs.append(error_msg)
         else:
-            if hashes == self.hash_records[key]:
-                error_msg = 'hash value {} should be different ' \
-                            'with {} {}'.format(hashes, key, self.hash_records[key])
-                self.logger.error(error_msg)
-                self.error_msgs.append(error_msg)
+            for item in hashes:
+                if item in self.hash_records[key]:
+                    error_msg = 'hash value {} should be different ' \
+                                'with {} {}'.format(item, key, self.hash_records[key])
+                    self.logger.error(error_msg)
+                    self.error_msgs.append(error_msg)
         if not rss_distribute:
             error_msg = 'the packet do not distribute by rss'
             self.logger.error(error_msg)