trending: fix re-pro showing wrong data
[csit.git] / resources / tools / presentation / generator_cpta.py
index fafa863..4063764 100644 (file)
@@ -838,21 +838,9 @@ def _generate_all_charts(spec, input_data):
 
     # Evaluate result:
     if anomaly_classifications:
-        test_reg_lst = []
-        nic_reg_lst = []
-        frmsize_reg_lst = []
-        trend_reg_lst = []
-        number_reg_lst = []
-        ltc_reg_lst = []
-        test_prog_lst = []
-        nic_prog_lst = []
-        frmsize_prog_lst = []
-        trend_prog_lst = []
-        number_prog_lst = []
-        ltc_prog_lst = []
         result = u"PASS"
 
-        class MaxLens():
+        class MaxLens:
             """Class to store the max lengths of strings displayed in
             regressions and progressions.
             """
@@ -874,17 +862,31 @@ def _generate_all_charts(spec, input_data):
                 self.run = run
                 self.ltc = ltc
 
-        max_len = MaxLens(0, 0, 0, 0, 0, 0)
-
         for job_name, job_data in anomaly_classifications.items():
             data = []
+            test_reg_lst = []
+            nic_reg_lst = []
+            frmsize_reg_lst = []
+            trend_reg_lst = []
+            number_reg_lst = []
+            ltc_reg_lst = []
+            test_prog_lst = []
+            nic_prog_lst = []
+            frmsize_prog_lst = []
+            trend_prog_lst = []
+            number_prog_lst = []
+            ltc_prog_lst = []
+            max_len = MaxLens(0, 0, 0, 0, 0, 0)
+
+            # tb - testbed (2n-skx, 3n-dnv, etc)
             tb = u"-".join(job_name.split(u"-")[-2:])
+            # data - read all txt dashboard files for tb
             for file in listdir(f"{spec.cpta[u'output-file']}"):
                 if tb in file and u"performance-trending-dashboard" in \
                         file and u"txt" in file:
                     file_to_read = f"{spec.cpta[u'output-file']}/{file}"
-                    with open(f"{file_to_read}", u"rt") as input:
-                        data = data + input.readlines()
+                    with open(f"{file_to_read}", u"rt") as f_in:
+                        data = data + f_in.readlines()
 
             for test_name, classification in job_data.items():
                 if classification != u"normal":
@@ -896,7 +898,7 @@ def _generate_all_charts(spec, input_data):
                         test_name = test_name.split("-", 1)
                         tst = test_name[1].split(".")[-1]
                         nic = test_name[0].split(".")[-1]
-                    frmsize = tst.split("-")[0].upper()
+                    frmsize = tst.split("-")[0]
                     tst = u"-".join(tst.split("-")[1:])
                     tst_name = f"{nic}-{frmsize}-{tst}"
                     if len(tst) > max_len.tst:
@@ -933,9 +935,6 @@ def _generate_all_charts(spec, input_data):
                                 number_prog_lst.append(number)
                                 ltc_prog_lst.append(ltc)
 
-                    if classification in (u"regression", u"outlier"):
-                        result = u"FAIL"
-
             text = u""
             for idx in range(len(test_reg_lst)):
                 text += (
@@ -943,7 +942,7 @@ def _generate_all_charts(spec, input_data):
                     f"{u' ' * (max_len.tst - len(test_reg_lst[idx]))}  "
                     f"{nic_reg_lst[idx]}"
                     f"{u' ' * (max_len.nic - len(nic_reg_lst[idx]))}  "
-                    f"{frmsize_reg_lst[idx]}"
+                    f"{frmsize_reg_lst[idx].upper()}"
                     f"{u' ' * (max_len.frmsize - len(frmsize_reg_lst[idx]))}  "
                     f"{trend_reg_lst[idx]}"
                     f"{u' ' * (max_len.trend - len(str(trend_reg_lst[idx])))}  "
@@ -971,7 +970,7 @@ def _generate_all_charts(spec, input_data):
                     f"{u' ' * (max_len.tst - len(test_prog_lst[idx]))}  "
                     f"{nic_prog_lst[idx]}"
                     f"{u' ' * (max_len.nic - len(nic_prog_lst[idx]))}  "
-                    f"{frmsize_prog_lst[idx]}"
+                    f"{frmsize_prog_lst[idx].upper()}"
                     f"{u' ' * (max_len.frmsize - len(frmsize_prog_lst[idx]))}  "
                     f"{trend_prog_lst[idx]}"
                     f"{u' ' * (max_len.trend -len(str(trend_prog_lst[idx])))}  "