X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fgenerator_tables.py;h=6f9925fede7acfa73c5ddfd2e17414d3d327414c;hp=7fc1d0cfd713701ed811cceb9d80f23670571670;hb=8d8c5c429ef242d3903f2ad3f4743fcac50d6253;hpb=de778ee617ed29443bdd8dfa393a2ec4b811b1b9 diff --git a/resources/tools/presentation/generator_tables.py b/resources/tools/presentation/generator_tables.py index 7fc1d0cfd7..6f9925fede 100644 --- a/resources/tools/presentation/generator_tables.py +++ b/resources/tools/presentation/generator_tables.py @@ -96,7 +96,7 @@ def table_details(table, input_data): try: col_data = str(data[job][build][test][column["data"]. split(" ")[1]]).replace('"', '""') - if column["data"].split(" ")[1] in ("vat-history", + if column["data"].split(" ")[1] in ("conf-history", "show-run"): col_data = replace(col_data, " |br| ", "", maxreplace=1) @@ -161,7 +161,7 @@ def table_merged_details(table, input_data): try: col_data = str(data[test][column["data"]. split(" ")[1]]).replace('"', '""') - if column["data"].split(" ")[1] in ("vat-history", + if column["data"].split(" ")[1] in ("conf-history", "show-run"): col_data = replace(col_data, " |br| ", "", maxreplace=1) @@ -858,6 +858,57 @@ def table_performance_trending_dashboard_html(table, input_data): return +def table_last_failed_tests(table, input_data): + """Generate the table(s) with algorithm: table_last_failed_tests + specified in the specification file. + + :param table: Table to generate. + :param input_data: Data to process. + :type table: pandas.Series + :type input_data: InputData + """ + + logging.info(" Generating the table {0} ...". + format(table.get("title", ""))) + + # Transform the data + logging.info(" Creating the data set for the {0} '{1}'.". + format(table.get("type", ""), table.get("title", ""))) + data = input_data.filter_data(table, continue_on_error=True) + + if data is None or data.empty: + logging.warn(" No data for the {0} '{1}'.". + format(table.get("type", ""), table.get("title", ""))) + return + + tbl_list = list() + for job, builds in table["data"].items(): + for build in builds: + build = str(build) + try: + version = input_data.metadata(job, build).get("version", "") + except KeyError: + logging.error("Data for {job}: {build} is not present.". + format(job=job, build=build)) + return + tbl_list.append(build) + tbl_list.append(version) + for tst_name, tst_data in data[job][build].iteritems(): + if tst_data["status"] != "FAIL": + continue + groups = re.search(REGEX_NIC, tst_data["parent"]) + if not groups: + continue + nic = groups.group(0) + tbl_list.append("{0}-{1}".format(nic, tst_data["name"])) + + file_name = "{0}{1}".format(table["output-file"], table["output-file-ext"]) + logging.info(" Writing file: '{0}'".format(file_name)) + with open(file_name, "w") as file_handler: + for test in tbl_list: + file_handler.write(test + '\n') + + def table_failed_tests(table, input_data): """Generate the table(s) with algorithm: table_failed_tests specified in the specification file.