X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=resources%2Ftools%2Fpresentation%2Finput_data_parser.py;h=25e258f75aedf875e884405abf2fa26446868000;hb=859a3f724c077f9db9a2f40f76b6dad27f199003;hp=bae7b5eead9da385d62a53d9c0efc593b2e068eb;hpb=b763901692e207a8f07386bb3bcba254cdeaa790;p=csit.git diff --git a/resources/tools/presentation/input_data_parser.py b/resources/tools/presentation/input_data_parser.py index bae7b5eead..25e258f75a 100644 --- a/resources/tools/presentation/input_data_parser.py +++ b/resources/tools/presentation/input_data_parser.py @@ -23,6 +23,7 @@ import re import resource import pandas as pd import logging +import prettytable from robot.api import ExecutionResult, ResultVisitor from robot import errors @@ -280,8 +281,7 @@ class ExecutionChecker(ResultVisitor): REGEX_VERSION_VPP = re.compile(r"(return STDOUT Version:\s*|" r"VPP Version:\s*|VPP version:\s*)(.*)") - REGEX_VERSION_DPDK = re.compile(r"(return STDOUT testpmd)([\d\D\n]*)" - r"(RTE Version: 'DPDK )(.*)(')") + REGEX_VERSION_DPDK = re.compile(r"DPDK Version: (\d*.\d*)") REGEX_TCP = re.compile(r'Total\s(rps|cps|throughput):\s([0-9]*).*$') @@ -422,10 +422,10 @@ class ExecutionChecker(ResultVisitor): :returns: Nothing. """ - if msg.message.count("return STDOUT testpmd"): + if msg.message.count("DPDK Version:"): try: self._version = str(re.search( - self.REGEX_VERSION_DPDK, msg.message). group(4)) + self.REGEX_VERSION_DPDK, msg.message). group(1)) self._data["metadata"]["version"] = self._version except IndexError: pass @@ -496,17 +496,54 @@ class ExecutionChecker(ResultVisitor): :type msg: Message :returns: Nothing. """ - if msg.message.count("Thread 0 vpp_main"): + if msg.message.count("Runtime:"): self._show_run_lookup_nr += 1 if self._lookup_kw_nr == 1 and self._show_run_lookup_nr == 1: self._data["tests"][self._test_ID]["show-run"] = str() if self._lookup_kw_nr > 1: self._msg_type = None if self._show_run_lookup_nr == 1: - text = msg.message.replace("vat# ", "").\ - replace("return STDOUT ", "").replace("\n\n", "\n").\ - replace('\n', ' |br| ').\ - replace('\r', '').replace('"', "'") + message = str(msg.message).replace(' ', '').replace('\n', '').\ + replace("'", '"').replace('b"', '"').replace('u"', '"')[8:] + runtime = loads(message) + try: + threads_nr = len(runtime[0]["clocks"]) + except (IndexError, KeyError): + return + tbl_hdr = ["Name", "Calls", "Vectors", "Suspends", "Clocks"] + table = [[tbl_hdr, ] for _ in range(threads_nr)] + for item in runtime: + for idx in range(threads_nr): + table[idx].append([ + item["name"], + item["calls"][idx], + item["vectors"][idx], + item["suspends"][idx], + item["clocks"][idx] + ]) + 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"] += \ @@ -944,7 +981,7 @@ class ExecutionChecker(ResultVisitor): self._lookup_kw_nr += 1 self._show_run_lookup_nr = 0 self._msg_type = "test-show-runtime" - elif test_kw.name.count("Start The L2fwd Test") and not self._version: + elif test_kw.name.count("Install Dpdk Test") and not self._version: self._msg_type = "dpdk-version" else: return