PAL: Accept reconf time in scientific notation
[csit.git] / resources / tools / presentation / input_data_parser.py
index 2416e05..c63e3eb 100644 (file)
@@ -283,7 +283,7 @@ class ExecutionChecker(ResultVisitor):
 
     REGEX_VERSION_DPDK = re.compile(r"(DPDK version:\s*|DPDK Version:\s*)(.*)")
 
-    REGEX_TCP = re.compile(r'Total\s(rps|cps|throughput):\s([0-9]*).*$')
+    REGEX_TCP = re.compile(r'Total\s(rps|cps|throughput):\s(\d*).*$')
 
     REGEX_MRR = re.compile(r'MaxReceivedRate_Results\s\[pkts/(\d*)sec\]:\s'
                            r'tx\s(\d*),\srx\s(\d*)')
@@ -291,13 +291,16 @@ class ExecutionChecker(ResultVisitor):
     REGEX_BMRR = re.compile(r'Maximum Receive Rate trial results'
                             r' in packets per second: \[(.*)\]')
 
+    REGEX_RECONF_LOSS = re.compile(r'Packets lost due to reconfig: (\d*)')
+    REGEX_RECONF_TIME = re.compile(r'Implied time lost: (\d*.[\de-]*)')
+
     REGEX_TC_TAG = re.compile(r'\d+[tT]\d+[cC]')
 
     REGEX_TC_NAME_OLD = re.compile(r'-\d+[tT]\d+[cC]-')
 
     REGEX_TC_NAME_NEW = re.compile(r'-\d+[cC]-')
 
-    REGEX_TC_NUMBER = re.compile(r'tc[0-9]{2}-')
+    REGEX_TC_NUMBER = re.compile(r'tc\d{2}-')
 
     def __init__(self, metadata, mapping, ignore):
         """Initialisation.
@@ -457,7 +460,7 @@ class ExecutionChecker(ResultVisitor):
                 self._data["tests"][self._test_ID]["conf-history"] = str()
             else:
                 self._msg_type = None
-            text = re.sub("[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3} "
+            text = re.sub("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3} "
                           "VAT command history:", "", msg.message, count=1). \
                 replace("\n\n", "\n").replace('\n', ' |br| ').\
                 replace('\r', '').replace('"', "'")
@@ -479,7 +482,7 @@ class ExecutionChecker(ResultVisitor):
                 self._data["tests"][self._test_ID]["conf-history"] = str()
             else:
                 self._msg_type = None
-            text = re.sub("[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3} "
+            text = re.sub("\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3} "
                           "PAPI command history:", "", msg.message, count=1). \
                 replace("\n\n", "\n").replace('\n', ' |br| ').\
                 replace('\r', '').replace('"', "'")
@@ -802,6 +805,7 @@ class ExecutionChecker(ResultVisitor):
             groups = re.search(self.REGEX_TC_NAME_OLD, self._test_ID)
             if not groups:
                 tag_count = 0
+                tag_tc = str()
                 for tag in test_result["tags"]:
                     groups = re.search(self.REGEX_TC_TAG, tag)
                     if groups:
@@ -830,7 +834,8 @@ class ExecutionChecker(ResultVisitor):
                                       "SOAK" in tags or
                                       "TCP" in tags or
                                       "MRR" in tags or
-                                      "BMRR" in tags):
+                                      "BMRR" in tags or
+                                      "RECONF" in tags):
             # TODO: Remove when definitely no NDRPDRDISC tests are used:
             if "NDRDISC" in tags:
                 test_result["type"] = "NDR"
@@ -847,6 +852,8 @@ class ExecutionChecker(ResultVisitor):
                 test_result["type"] = "MRR"
             elif "FRMOBL" in tags or "BMRR" in tags:
                 test_result["type"] = "BMRR"
+            elif "RECONF" in tags:
+                test_result["type"] = "RECONF"
             else:
                 test_result["status"] = "FAIL"
                 self._data["tests"][self._test_ID] = test_result
@@ -908,6 +915,18 @@ class ExecutionChecker(ResultVisitor):
                         AvgStdevMetadataFactory.from_data([
                             float(groups.group(3)) / float(groups.group(1)), ])
 
+            elif test_result["type"] == "RECONF":
+                test_result["result"] = None
+                try:
+                    grps_loss = re.search(self.REGEX_RECONF_LOSS, test.message)
+                    grps_time = re.search(self.REGEX_RECONF_TIME, test.message)
+                    test_result["result"] = {
+                        "loss": int(grps_loss.group(1)),
+                        "time": float(grps_time.group(1))
+                    }
+                except (AttributeError, IndexError, ValueError, TypeError):
+                    test_result["status"] = "FAIL"
+
         self._data["tests"][self._test_ID] = test_result
 
     def end_test(self, test):