Make a black list for yardstick reporting
[releng.git] / utils / test / reporting / yardstick / reporting-status.py
index 546bf08..60f1523 100644 (file)
@@ -16,6 +16,7 @@ import yaml
 import reportingUtils as utils
 import reportingConf as conf
 import scenarioResult as sr
+from scenarios import config as cf
 
 # Logger
 logger = utils.getLogger("Yardstick-Status")
@@ -26,36 +27,50 @@ logger.info("*   Data retention = %s days              *" % conf.PERIOD)
 logger.info("*                                         *")
 logger.info("*******************************************")
 
+
 # For all the versions
 for version in conf.versions:
     # For all the installers
     for installer in conf.installers:
         # get scenarios results data
         scenario_results = utils.getScenarioStatus(installer, version)
+        if 'colorado' == version:
+            stable_result = utils.getScenarioStatus(installer, 'stable/colorado')
+            for k,v in stable_result.items():
+                if not scenario_results.has_key(k):
+                    scenario_results[k] = []
+                scenario_results[k] += stable_result[k]
         scenario_result_criteria = {}
 
+        for s in scenario_results.keys():
+            if cf.has_key(installer) and cf[installer].has_key(s):
+                scenario_results.pop(s)
+
         # From each scenarios get results list
         for s, s_result in scenario_results.items():
             logger.info("---------------------------------")
             logger.info("installer %s, version %s, scenario %s:" % (installer, version, s))
 
-            s_status = 'KO'
-            scenario_criteria = len(s_result)
-            scenario_score = 0
-
+            ten_criteria = len(s_result)
+            ten_score = 0
             for v in s_result:
-                if v['details'] == 'SUCCESS':
-                    scenario_score += 1
+                ten_score += v
 
-            if scenario_score == scenario_criteria:
-                s_status = 'OK'
-                logger.info(">>>>> scenario OK, save the information")
-            else:
-                logger.info(">>>> scenario not OK, score = %s/%s" % (scenario_score, scenario_criteria))
+            four_result = s_result[:conf.LASTEST_TESTS]
+            four_criteria = len(four_result)
+            four_score = 0
+            for v in four_result:
+                four_score += v
 
-            s_score = str(scenario_score) + '/' + str(scenario_criteria)
-            scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_score)
+            s_status = str(utils.get_status(four_result, s_result))
+            s_four_score = str(four_score) + '/' + str(four_criteria)
+            s_ten_score = str(ten_score) + '/' + str(ten_criteria)
+            scenario_result_criteria[s] = sr.ScenarioResult(s_status, s_four_score, s_ten_score)
 
+            if '100' == s_status:
+                logger.info(">>>>> scenario OK, save the information")
+            else:
+                logger.info(">>>> scenario not OK, last 4 iterations = %s, last 10 days = %s" % (s_four_score, s_ten_score))
             logger.info("--------------------------")
 
         templateLoader = jinja2.FileSystemLoader(conf.REPORTING_PATH)