diff options
author | Maryam Tahhan <maryam.tahhan@intel.com> | 2016-01-25 15:16:34 +0000 |
---|---|---|
committer | Maryam Tahhan <maryam.tahhan@intel.com> | 2016-01-25 15:47:24 +0000 |
commit | e35cbd393b2c2df7648ac5ba73544069983acd51 (patch) | |
tree | 92373f233b076ffab8c80e25ca1d8565709a9817 /vsperf | |
parent | 60fb39e7c69b2aa8f5624e31878c6359f3714ae2 (diff) |
report: create test report for all executed TCs
Every testcase generates report with its results into separate file.
It is required to merge all partial reports into final overall
report for whole set of TCs executed by VSPERF.
Hugepages are mounted also for TestPMD packet forwarder.
Change-Id: Iee9466825cab35c96e36238f7e03d9da15c583e6
JIRA: VSPERF-181
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
>
(cherry picked from commit da081ab2603eb34baf7d7fe7b61f681ef15d865e)
Diffstat (limited to 'vsperf')
-rwxr-xr-x | vsperf | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -27,6 +27,8 @@ import shutil import unittest import xmlrunner import locale +import glob +import subprocess sys.dont_write_bytecode = True @@ -46,6 +48,10 @@ VERBOSITY_LEVELS = { 'critical': logging.CRITICAL } +_TEMPLATE_RST = {'head' : 'tools/report/report_head.rst', + 'foot' : 'tools/report/report_foot.rst', + 'final' : 'test_report.rst' + } def parse_arguments(): """ @@ -250,6 +256,25 @@ def check_and_set_locale(): logging.warning("Locale was not properly configured. Default values were set. Old locale: %s, New locale: %s", system_locale, locale.getdefaultlocale()) +def generate_final_report(path): + """ Function will check if partial test results are available + and generates final report in rst format. + """ + + # check if there are any results in rst format + rst_results = glob.glob(os.path.join(path, 'result*rst')) + if len(rst_results): + try: + test_report = os.path.join(path, _TEMPLATE_RST['final']) + retval = subprocess.call('cat {} {} {} > {}'.format(_TEMPLATE_RST['head'], ' '.join(rst_results), + _TEMPLATE_RST['foot'], test_report), shell=True) + if retval == 0 and os.path.isfile(test_report): + logging.info('Overall test report written to "%s"', test_report) + else: + logging.error('Generatrion of overall test report has failed.') + except subprocess.CalledProcessError: + logging.error('Generatrion of overall test report has failed.') + class MockTestCase(unittest.TestCase): """Allow use of xmlrunner to generate Jenkins compatible output without using xmlrunner to actually run tests. @@ -449,6 +474,9 @@ def main(): suite.addTest(MockTestCase(str(ex), False, test.name)) logger.info("Continuing with next test...") + # generate final rst report with results of all executed TCs + generate_final_report(results_path) + if settings.getValue('XUNIT'): xmlrunner.XMLTestRunner( output=settings.getValue('XUNIT_DIR'), outsuffix="", |