diff options
author | Martin Klozik <martinx.klozik@intel.com> | 2016-01-21 09:33:30 +0000 |
---|---|---|
committer | Maryam Tahhan <maryam.tahhan@intel.com> | 2016-01-22 16:49:04 +0000 |
commit | e9e3bc022f50b246dfe290e77b596835c5dbcd9d (patch) | |
tree | 147d2043429be1e09d2f65a387a46f0868e2b1d4 /tools/report/report.py | |
parent | b7865213f0942217ce8396d60f27ccac7f65cd07 (diff) |
report: add rst template for results reporting
Add a template that can be used for reporting vsperf release B results.
This patch also fixes the line length issues in the markdown template.
Change-Id: Id03f5c7eb84536697deca73d3fb397629b647a85
JIRA: VSPERF-181
Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com>
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
(cherry picked from commit e4718a97deafdb853335b13d472de0e273e191af)
Diffstat (limited to 'tools/report/report.py')
-rw-r--r-- | tools/report/report.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/tools/report/report.py b/tools/report/report.py index 4264c055..1e0f87bc 100644 --- a/tools/report/report.py +++ b/tools/report/report.py @@ -27,7 +27,7 @@ from core.results.results_constants import ResultsConstants from conf import settings as S from tools import systeminfo -_TEMPLATE_FILE = 'report.jinja' +_TEMPLATE_FILES = ['report.jinja', 'report_rst.jinja'] _ROOT_DIR = os.path.normpath(os.path.dirname(os.path.realpath(__file__))) @@ -48,7 +48,7 @@ def _get_env(result): env = { 'os': systeminfo.get_os(), 'kernel': systeminfo.get_kernel(), - 'nic': systeminfo.get_nic(), + 'nics': systeminfo.get_nic(), 'cpu': systeminfo.get_cpu(), 'cpu_cores': systeminfo.get_cpu_cores(), 'memory' : systeminfo.get_memory(), @@ -78,11 +78,10 @@ def generate(input_file, tc_results, tc_stats): :returns: Path to generated report """ - output_file = '.'.join([os.path.splitext(input_file)[0], 'md']) - + output_files = [('.'.join([os.path.splitext(input_file)[0], 'md'])), + ('.'.join([os.path.splitext(input_file)[0], 'rst']))] template_loader = jinja2.FileSystemLoader(searchpath=_ROOT_DIR) template_env = jinja2.Environment(loader=template_loader) - template = template_env.get_template(_TEMPLATE_FILE) tests = [] try: @@ -112,17 +111,20 @@ def generate(input_file, tc_results, tc_stats): template_vars = { 'tests': tests, } - - output_text = template.render(template_vars) #pylint: disable=no-member - with open(output_file, 'w') as file_: - file_.write(output_text) - logging.info('Test report written to "%s"', output_file) + i = 0 + for output_file in output_files: + template = template_env.get_template(_TEMPLATE_FILES[i]) + output_text = template.render(template_vars) #pylint: disable=no-member + with open(output_file, 'w') as file_: + file_.write(output_text) + logging.info('Test report written to "%s"', output_file) + i += 1 except KeyError: logging.info("Report: Ignoring file (Wrongly defined columns): %s", (input_file)) raise - return output_file + return output_files if __name__ == '__main__': |