- text = ""
- for idx in range(threads_nr):
- text += "Thread {idx} ".format(idx=idx)
- text += "vpp_main\n" if idx == 0 else \
- "vpp_wk_{idx}\n".format(idx=idx-1)
- txt_table = None
- for row in table[idx]:
- if txt_table is None:
- txt_table = prettytable.PrettyTable(row)
- else:
- if any(row[1:]):
- txt_table.add_row(row)
- txt_table.set_style(prettytable.MSWORD_FRIENDLY)
- txt_table.align["Name"] = "l"
- txt_table.align["Calls"] = "r"
- txt_table.align["Vectors"] = "r"
- txt_table.align["Suspends"] = "r"
- txt_table.align["Clocks"] = "r"
-
- text += txt_table.get_string(sortby="Name") + '\n'
-
- text = text.replace('\n', ' |br| ').replace('\r', '').\
- replace('"', "'")
- try:
- self._data["tests"][self._test_ID]["show-run"] += " |br| "
- self._data["tests"][self._test_ID]["show-run"] += \
- "**DUT" + str(self._show_run_lookup_nr) + ":** |br| " \
- + text
- except KeyError:
- pass
-
- # TODO: Remove when definitely no NDRPDRDISC tests are used:
- def _get_latency(self, msg, test_type):
- """Get the latency data from the test message.
-
- :param msg: Message to be parsed.
- :param test_type: Type of the test - NDR or PDR.
- :type msg: str
- :type test_type: str
- :returns: Latencies parsed from the message.
- :rtype: dict
- """
-
- if test_type == "NDR":
- groups = re.search(self.REGEX_LAT_NDR, msg)
- groups_range = range(1, 7)
- elif test_type == "PDR":
- groups = re.search(self.REGEX_LAT_PDR, msg)
- groups_range = range(1, 3)
- else:
- return {}
-
- latencies = list()
- for idx in groups_range:
- try:
- lat = [int(item) for item in str(groups.group(idx)).split('/')]
- except (AttributeError, ValueError):
- lat = [-1, -1, -1]
- latencies.append(lat)
-
- keys = ("min", "avg", "max")
- latency = {
- "direction1": {
- },
- "direction2": {
- }
- }
-
- latency["direction1"]["100"] = dict(zip(keys, latencies[0]))
- latency["direction2"]["100"] = dict(zip(keys, latencies[1]))
- if test_type == "NDR":
- latency["direction1"]["50"] = dict(zip(keys, latencies[2]))
- latency["direction2"]["50"] = dict(zip(keys, latencies[3]))
- latency["direction1"]["10"] = dict(zip(keys, latencies[4]))
- latency["direction2"]["10"] = dict(zip(keys, latencies[5]))
-
- return latency
+ text = ""
+ for idx in range(threads_nr):
+ text += f"Thread {idx} "
+ text += u"vpp_main\n" if idx == 0 else f"vpp_wk_{idx-1}\n"
+ txt_table = None
+ for row in table[idx]:
+ if txt_table is None:
+ txt_table = prettytable.PrettyTable(row)
+ else:
+ if any(row[1:]):
+ txt_table.add_row(row)
+ txt_table.set_style(prettytable.MSWORD_FRIENDLY)
+ txt_table.align[u"Name"] = u"l"
+ txt_table.align[u"Calls"] = u"r"
+ txt_table.align[u"Vectors"] = u"r"
+ txt_table.align[u"Suspends"] = u"r"
+ txt_table.align[u"Clocks"] = u"r"
+ txt_table.align[u"Vectors/Calls"] = u"r"
+
+ text += txt_table.get_string(sortby=u"Name") + u'\n'
+ text = f" \n **DUT: {host}/{socket}** \n {text}".\
+ replace(u'\n', u' |br| ').\
+ replace(u'\r', u'').\
+ replace(u'"', u"'")
+ self._data[u"tests"][self._test_id][u"show-run"] += text