From 463a1fd56b516687dc4714ad87685530a0e9b8d1 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Thu, 11 Feb 2016 14:13:59 +0000 Subject: CI: Generate test report and push logs and report to the artifactory Script for CI job execution automatically generates final test report, collects log files and pushes these results into artifactory. Support for branch specific configuration file has been added. Change-Id: Ifdf13b1c4c389f8d20dbc8e0ed99f43273e0820b JIRA: VSPERF-181 Signed-off-by: Martin Klozik Reviewed-by: Maryam Tahhan --- vsperf | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'vsperf') diff --git a/vsperf b/vsperf index d141227c..db1d5ee5 100755 --- a/vsperf +++ b/vsperf @@ -53,7 +53,8 @@ VERBOSITY_LEVELS = { _TEMPLATE_RST = {'head' : 'tools/report/report_head.rst', 'foot' : 'tools/report/report_foot.rst', - 'final' : 'test_report.rst' + 'final' : 'test_report.rst', + 'tmp' : 'tools/report/report_tmp_caption.rst' } def parse_arguments(): @@ -279,13 +280,29 @@ def generate_final_report(path): 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) + test_report = os.path.join(path, '{}_{}'.format(settings.getValue('VSWITCH'), _TEMPLATE_RST['final'])) + # create report caption directly - it is not worth to execute jinja machinery + report_caption = '{}\n{} {}\n{}\n\n'.format( + '============================================================', + 'Performance report for', + Loader().get_vswitches()[settings.getValue('VSWITCH')].__doc__.strip().split('\n')[0], + + '============================================================') + + with open(_TEMPLATE_RST['tmp'], 'w') as file_: + file_.write(report_caption) + + retval = subprocess.call('cat {} {} {} {} > {}'.format(_TEMPLATE_RST['tmp'], _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.') + + # remove temporary file + os.remove(_TEMPLATE_RST['tmp']) + except subprocess.CalledProcessError: logging.error('Generatrion of overall test report has failed.') -- cgit 1.2.3-korg