X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Finput_data_parser.py;h=60c5af2870260a184db066609cb063a9d51237a1;hp=73b9ea114a89949ce8b84a88e6c8979f84a47bb0;hb=c81eac1e36b37c78f144a4218c231da846a908f6;hpb=11b0380f850883bc89b5047cb0163886b7b1d7c7 diff --git a/resources/tools/presentation/input_data_parser.py b/resources/tools/presentation/input_data_parser.py index 73b9ea114a..60c5af2870 100644 --- a/resources/tools/presentation/input_data_parser.py +++ b/resources/tools/presentation/input_data_parser.py @@ -220,6 +220,8 @@ class ExecutionChecker(ResultVisitor): r'Latency at 50% PDR:.*\[\'(.*)\', \'(.*)\'\].*\n' r'Latency at 10% PDR:.*\[\'(.*)\', \'(.*)\'\].*\n' ) + REGEX_MRR_MSG_INFO = re.compile(r'.*\[(.*)\]') + # TODO: Remove when not needed REGEX_NDRPDR_LAT_BASE = re.compile( r'LATENCY.*\[\'(.*)\', \'(.*)\'\]\s\n.*\n.*\n' @@ -355,15 +357,34 @@ class ExecutionChecker(ResultVisitor): """ return self._data + def _get_data_from_mrr_test_msg(self, msg): + """Get info from message of MRR performance tests. + + :param msg: Message to be processed. + :type msg: str + :returns: Processed message or original message if a problem occurs. + :rtype: str + """ + + groups = re.search(self.REGEX_MRR_MSG_INFO, msg) + if not groups or groups.lastindex != 1: + return msg + + try: + data = groups.group(1).split(u", ") + except (AttributeError, IndexError, ValueError, KeyError): + return msg + + out_str = u"[" + try: + for item in data: + out_str += f"{(float(item) / 1e6):.2f}, " + return out_str[:-2] + u"]" + except (AttributeError, IndexError, ValueError, KeyError): + return msg + def _get_data_from_perf_test_msg(self, msg): - """Get - - NDR_LOWER - - LATENCY - - NDR_UPPER - - PDR_LOWER - - LATENCY - - PDR_UPPER - from message of NDRPDR performance tests. + """Get info from message of NDRPDR performance tests. :param msg: Message to be processed. :type msg: str @@ -423,14 +444,19 @@ class ExecutionChecker(ResultVisitor): return u"" if hdr_lat_1 and hdr_lat_2: - return ( - f"{hdr_lat_1.get_value_at_percentile(50.0)} " - f"{hdr_lat_1.get_value_at_percentile(90.0)} " - f"{hdr_lat_1.get_value_at_percentile(99.0)} , " - f"{hdr_lat_2.get_value_at_percentile(50.0)} " - f"{hdr_lat_2.get_value_at_percentile(90.0)} " - f"{hdr_lat_2.get_value_at_percentile(99.0)}" - ) + hdr_lat_1_50 = hdr_lat_1.get_value_at_percentile(50.0) + hdr_lat_1_90 = hdr_lat_1.get_value_at_percentile(90.0) + hdr_lat_1_99 = hdr_lat_1.get_value_at_percentile(99.0) + hdr_lat_2_50 = hdr_lat_2.get_value_at_percentile(50.0) + hdr_lat_2_90 = hdr_lat_2.get_value_at_percentile(90.0) + hdr_lat_2_99 = hdr_lat_2.get_value_at_percentile(99.0) + + if (hdr_lat_1_50 + hdr_lat_1_90 + hdr_lat_1_99 + + hdr_lat_2_50 + hdr_lat_2_90 + hdr_lat_2_99): + return ( + f"{hdr_lat_1_50} {hdr_lat_1_90} {hdr_lat_1_99} " + f"{hdr_lat_2_50} {hdr_lat_2_90} {hdr_lat_2_99}" + ) return u"" @@ -441,18 +467,18 @@ class ExecutionChecker(ResultVisitor): data[u'pdr_lat_50_2']) pdr_lat_90 = _process_lat(data[u'pdr_lat_90_1'], data[u'pdr_lat_90_2']) - pdr_lat_10 = f"\n3. {pdr_lat_10}" if pdr_lat_10 else u"" - pdr_lat_50 = f"\n4. {pdr_lat_50}" if pdr_lat_50 else u"" - pdr_lat_90 = f"\n5. {pdr_lat_90}" if pdr_lat_90 else u"" + pdr_lat_10 = f"\n3. {pdr_lat_10} (10% PDR)" if pdr_lat_10 else u"" + pdr_lat_50 = f"\n4. {pdr_lat_50} (50% PDR)" if pdr_lat_50 else u"" + pdr_lat_90 = f"\n5. {pdr_lat_90} (90% PDR)" if pdr_lat_90 else u"" return ( - u" |prein| " - f"1. {(data[u'ndr_low'] / 1e6):.2f} {data[u'ndr_low_b']:.2f}" - f"\n2. {(data[u'pdr_low'] / 1e6):.2f} {data[u'pdr_low_b']:.2f}" + f"1. {(data[u'ndr_low'] / 1e6):.2f} {data[u'ndr_low_b']:.2f} " + f"(NDR)" + f"\n2. {(data[u'pdr_low'] / 1e6):.2f} {data[u'pdr_low_b']:.2f} " + f"(PDR)" f"{pdr_lat_10}" f"{pdr_lat_50}" f"{pdr_lat_90}" - u" |preout| " ) except (AttributeError, IndexError, ValueError, KeyError): return msg @@ -944,7 +970,7 @@ class ExecutionChecker(ResultVisitor): replace(u'\r', u'').\ replace(u'[', u' |br| [').\ replace(u' |br| [', u'[', 1) - test_result[u"msg"] = self._get_data_from_perf_test_msg(test.message).\ + test_result[u"msg"] = test.message.\ replace(u'\n', u' |br| ').\ replace(u'\r', u'').\ replace(u'"', u"'") @@ -986,6 +1012,11 @@ class ExecutionChecker(ResultVisitor): if test.status == u"PASS": if u"NDRPDR" in tags: + test_result[u"msg"] = self._get_data_from_perf_test_msg( + test.message). \ + replace(u'\n', u' |br| '). \ + replace(u'\r', u''). \ + replace(u'"', u"'") test_result[u"type"] = u"NDRPDR" test_result[u"throughput"], test_result[u"status"] = \ self._get_ndrpdr_throughput(test.message) @@ -1000,6 +1031,11 @@ class ExecutionChecker(ResultVisitor): groups = re.search(self.REGEX_TCP, test.message) test_result[u"result"] = int(groups.group(2)) elif u"MRR" in tags or u"FRMOBL" in tags or u"BMRR" in tags: + test_result[u"msg"] = self._get_data_from_mrr_test_msg( + test.message). \ + replace(u'\n', u' |br| '). \ + replace(u'\r', u''). \ + replace(u'"', u"'") if u"MRR" in tags: test_result[u"type"] = u"MRR" else: @@ -1030,6 +1066,8 @@ class ExecutionChecker(ResultVisitor): } except (AttributeError, IndexError, ValueError, TypeError): test_result[u"status"] = u"FAIL" + elif u"DEVICETEST" in tags: + test_result[u"type"] = u"DEVICETEST" else: test_result[u"status"] = u"FAIL" self._data[u"tests"][self._test_id] = test_result