test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH v2] tests: fix the bug of verifyResult_symmetric of pmdrss_hash
@ 2017-05-03 17:27 Peng Yuan
  2017-05-15  1:01 ` Liu, Yong
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Yuan @ 2017-05-03 17:27 UTC (permalink / raw)
  To: dts; +Cc: Peng Yuan

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

diff --git a/tests/TestSuite_pmdrss_hash.py b/tests/TestSuite_pmdrss_hash.py
index 78ae34d..612042d 100644
--- a/tests/TestSuite_pmdrss_hash.py
+++ b/tests/TestSuite_pmdrss_hash.py
@@ -374,9 +374,49 @@ class TestPmdrssHash(TestCase):
                 reta_line[name.strip()] = value.strip()
                 reta_lines.append(reta_line)
 
-        self.verifyResult_symmetric()
+    def verifyResult_simple_symmetric(self):
+        """
+        Verify whether or not the result passes.
+        """
+
+        global reta_lines
+        global reta_num
+        result = []
+        self.result_table_create(
+            ['packet index', 'RSS hash', 'hash index', 'queue id', 'actual queue id', 'pass '])
+
+        i = 0
+        for tmp_reta_line in reta_lines:
+            status = "true"
+            # compute the hash result of five tuple into the 7 LSBs value.
+            hash_index = int(tmp_reta_line["RSS hash"], 16) % reta_num
+            
+            if(i % 2 == 1):
+                if(pre_RSS_hash == tmp_reta_line["RSS hash"]):
+                    if(int(tmp_reta_line["RSS hash"], 16) > int("ffff", 16)):
+                        status = "true"
+                        result.insert((i - 1) / 2, 0)
+                    elif(reta_entries[hash_index] == int(tmp_reta_line["queue"])):
+                        status = "true"
+                        result.insert((i - 1) / 2, 0)
+                    else:
+                        status = "fail"
+                        result.insert((i - 1) / 2, 0)
+                else:
+                    status = "fail"
+                    result.insert((i - 1) / 2, 1)
+            pre_RSS_hash = tmp_reta_line["RSS hash"]
 
-    def verifyResult_symmetric(self):
+            self.result_table_add(
+                [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status])
+            i = i + 1
+
+        self.result_table_print()
+        reta_lines = []
+        self.verify(
+            sum(result) == 0, "the symmetric RSS hash function failed!")
+    
+    def verifyResult_toeplitz_symmetric(self):
         """
         Verify whether or not the result passes.
         """
@@ -395,8 +435,12 @@ class TestPmdrssHash(TestCase):
 
             if(i % 2 == 1):
                 if(pre_RSS_hash == tmp_reta_line["RSS hash"]):
-                    status = "true"
-                    result.insert((i - 1) / 2, 0)
+                    if(reta_entries[hash_index] == int(tmp_reta_line["queue"])):
+                        status = "true"
+                        result.insert((i - 1) / 2, 0)
+                    else:
+                        status = "fail"
+                        result.insert((i - 1) / 2, 0)
                 else:
                     status = "fail"
                     result.insert((i - 1) / 2, 1)
@@ -539,6 +583,8 @@ class TestPmdrssHash(TestCase):
 
                 self.send_packet_symmetric(itf, iptype)
 
+                self.verifyResult_toeplitz_symmetric()
+
             self.dut.send_expect("quit", "# ", 30)
 
     def test_simple(self):
@@ -649,6 +695,8 @@ class TestPmdrssHash(TestCase):
 
                 self.send_packet_symmetric(itf, iptype)
 
+                self.verifyResult_simple_symmetric()
+               
             self.dut.send_expect("quit", "# ", 30)
 
     def tear_down(self):
-- 
2.5.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dts] [PATCH v2] tests: fix the bug of verifyResult_symmetric of pmdrss_hash
  2017-05-03 17:27 [dts] [PATCH v2] tests: fix the bug of verifyResult_symmetric of pmdrss_hash Peng Yuan
@ 2017-05-15  1:01 ` Liu, Yong
  0 siblings, 0 replies; 2+ messages in thread
From: Liu, Yong @ 2017-05-15  1:01 UTC (permalink / raw)
  To: Peng Yuan, dts

Yuan, please add some descriptions for your changes in the commit log.

On 05/04/2017 01:27 AM, Peng Yuan wrote:
> Signed-off-by: Peng Yuan <yuan.peng@intel.com>
>
> diff --git a/tests/TestSuite_pmdrss_hash.py b/tests/TestSuite_pmdrss_hash.py
> index 78ae34d..612042d 100644
> --- a/tests/TestSuite_pmdrss_hash.py
> +++ b/tests/TestSuite_pmdrss_hash.py
> @@ -374,9 +374,49 @@ class TestPmdrssHash(TestCase):
>                   reta_line[name.strip()] = value.strip()
>                   reta_lines.append(reta_line)
>   
> -        self.verifyResult_symmetric()
> +    def verifyResult_simple_symmetric(self):
> +        """
> +        Verify whether or not the result passes.
> +        """
> +
> +        global reta_lines
> +        global reta_num
> +        result = []
> +        self.result_table_create(
> +            ['packet index', 'RSS hash', 'hash index', 'queue id', 'actual queue id', 'pass '])
> +
> +        i = 0
> +        for tmp_reta_line in reta_lines:
> +            status = "true"
> +            # compute the hash result of five tuple into the 7 LSBs value.
> +            hash_index = int(tmp_reta_line["RSS hash"], 16) % reta_num
> +
> +            if(i % 2 == 1):
> +                if(pre_RSS_hash == tmp_reta_line["RSS hash"]):
> +                    if(int(tmp_reta_line["RSS hash"], 16) > int("ffff", 16)):
> +                        status = "true"
> +                        result.insert((i - 1) / 2, 0)
> +                    elif(reta_entries[hash_index] == int(tmp_reta_line["queue"])):
> +                        status = "true"
> +                        result.insert((i - 1) / 2, 0)
> +                    else:
> +                        status = "fail"
> +                        result.insert((i - 1) / 2, 0)
> +                else:
> +                    status = "fail"
> +                    result.insert((i - 1) / 2, 1)
> +            pre_RSS_hash = tmp_reta_line["RSS hash"]
>   
> -    def verifyResult_symmetric(self):
> +            self.result_table_add(
> +                [i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status])
> +            i = i + 1
> +
> +        self.result_table_print()
> +        reta_lines = []
> +        self.verify(
> +            sum(result) == 0, "the symmetric RSS hash function failed!")
> +
> +    def verifyResult_toeplitz_symmetric(self):
>           """
>           Verify whether or not the result passes.
>           """
> @@ -395,8 +435,12 @@ class TestPmdrssHash(TestCase):
>   
>               if(i % 2 == 1):
>                   if(pre_RSS_hash == tmp_reta_line["RSS hash"]):
> -                    status = "true"
> -                    result.insert((i - 1) / 2, 0)
> +                    if(reta_entries[hash_index] == int(tmp_reta_line["queue"])):
> +                        status = "true"
> +                        result.insert((i - 1) / 2, 0)
> +                    else:
> +                        status = "fail"
> +                        result.insert((i - 1) / 2, 0)
>                   else:
>                       status = "fail"
>                       result.insert((i - 1) / 2, 1)
> @@ -539,6 +583,8 @@ class TestPmdrssHash(TestCase):
>   
>                   self.send_packet_symmetric(itf, iptype)
>   
> +                self.verifyResult_toeplitz_symmetric()
> +
>               self.dut.send_expect("quit", "# ", 30)
>   
>       def test_simple(self):
> @@ -649,6 +695,8 @@ class TestPmdrssHash(TestCase):
>   
>                   self.send_packet_symmetric(itf, iptype)
>   
> +                self.verifyResult_simple_symmetric()
> +
>               self.dut.send_expect("quit", "# ", 30)
>   
>       def tear_down(self):

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-15  1:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 17:27 [dts] [PATCH v2] tests: fix the bug of verifyResult_symmetric of pmdrss_hash Peng Yuan
2017-05-15  1:01 ` Liu, Yong

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