summaryrefslogtreecommitdiffstats
path: root/reporting
diff options
context:
space:
mode:
Diffstat (limited to 'reporting')
-rwxr-xr-xreporting/functest/reporting-status.py81
-rw-r--r--reporting/functest/reportingUtils.py8
2 files changed, 50 insertions, 39 deletions
diff --git a/reporting/functest/reporting-status.py b/reporting/functest/reporting-status.py
index b527b78..653448e 100755
--- a/reporting/functest/reporting-status.py
+++ b/reporting/functest/reporting-status.py
@@ -82,6 +82,10 @@ for version in conf.versions:
items = {}
scenario_result_criteria = {}
+ scenario_file_name = (conf.REPORTING_PATH +
+ "/functest/release/" + version +
+ "/scenario_history.txt")
+
# For all the scenarios get results
for s, s_result in scenario_results.items():
logger.info("---------------------------------")
@@ -185,11 +189,8 @@ for version in conf.versions:
scenario_criteria = conf.MAX_SCENARIO_CRITERIA
s_score = str(scenario_score) + "/" + str(scenario_criteria)
- s_score_percent = 0.0
- try:
- s_score_percent = float(scenario_score) / float(scenario_criteria) * 100
- except:
- logger.error("cannot calculate the score percent")
+ s_score_percent = utils.getScenarioPercent(scenario_score,
+ scenario_criteria)
s_status = "KO"
if scenario_score < scenario_criteria:
@@ -209,10 +210,7 @@ for version in conf.versions:
f.write(info)
# Save daily results in a file
- path_validation_file = (conf.REPORTING_PATH +
- "/functest/release/" + version +
- "/scenario_history.txt")
- with open(path_validation_file, "a") as f:
+ with open(scenario_file_name, "a") as f:
info = (reportingDate + "," + s + "," + installer +
"," + s_score + "," +
str(round(s_score_percent)) + "\n")
@@ -239,34 +237,39 @@ for version in conf.versions:
version=version,
date=reportingDate)
- with open(conf.REPORTING_PATH + "/functest/release/" + version +
- "/index-status-" + installer + ".html", "wb") as fh:
- fh.write(outputText)
+ # csv
+ # generate sub files based on scenario_history.txt
+ scenario_installer_file_name = (conf.REPORTING_PATH +
+ "/functest/release/" + version +
+ "/scenario_history_" + installer +
+ ".txt")
+ scenario_installer_file = open(scenario_installer_file_name, "a")
+ logger.info("Generate CSV...")
+ with open(scenario_file_name, "r") as f:
+ for line in f:
+ if installer in line:
+ logger.debug("Add new line... %s" % line)
+ scenario_installer_file.write(line)
+ scenario_installer_file.close
+
+ with open(conf.REPORTING_PATH + "/functest/release/" + version +
+ "/index-status-" + installer + ".html", "wb") as fh:
+ fh.write(outputText)
+ logger.info("CSV generated...")
- # Generate outputs for export
- # pdf
- try:
- pdf_path = ("http://testresults.opnfv.org/reporting/" +
- "functest/release/" + version +
- "/index-status-" + installer + ".html")
- pdf_doc_name = (conf.REPORTING_PATH +
- "/functest/release/" + version +
- "/status-" + installer + ".pdf")
- pdfkit.from_url(pdf_path, pdf_doc_name)
- except IOError:
- logger.info("pdf generated anyway...")
- except:
- logger.error("impossible to generate PDF")
- # csv
- # generate sub files based on scenario_history.txt
- scenario_installer_file_name = (conf.REPORTING_PATH +
- "/functest/release/" + version +
- "/scenario_history_" +
- installer + ".txt")
- scenario_installer_file = open(scenario_installer_file_name, "w")
-
- with open(path_validation_file, "r") as f:
- for line in f:
- if installer in line:
- scenario_installer_file.write(line)
- scenario_installer_file.close
+ # Generate outputs for export
+ # pdf
+ logger.info("Generate PDF...")
+ try:
+ pdf_path = ("http://testresults.opnfv.org/reporting/" +
+ "functest/release/" + version +
+ "/index-status-" + installer + ".html")
+ pdf_doc_name = (conf.REPORTING_PATH +
+ "/functest/release/" + version +
+ "/status-" + installer + ".pdf")
+ pdfkit.from_url(pdf_path, pdf_doc_name)
+ logger.info("PDF generated...")
+ except IOError:
+ logger.info("pdf generated anyway...")
+ except:
+ logger.error("impossible to generate PDF")
diff --git a/reporting/functest/reportingUtils.py b/reporting/functest/reportingUtils.py
index 9ba02e8..74d6f19 100644
--- a/reporting/functest/reportingUtils.py
+++ b/reporting/functest/reportingUtils.py
@@ -176,3 +176,11 @@ def getJenkinsUrl(build_tag):
print 'Impossible to get jenkins url:'
return jenkins_url
+
+def getScenarioPercent(scenario_score,scenario_criteria):
+ score = 0.0
+ try:
+ score = float(scenario_score) / float(scenario_criteria) * 100
+ except:
+ print 'Impossible to calculate the percentage score'
+ return score