From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id C03945598 for ; Thu, 29 Dec 2016 09:08:44 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 29 Dec 2016 00:08:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,425,1477983600"; d="scan'208";a="1087740805" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.240.176.135]) by fmsmga001.fm.intel.com with ESMTP; 29 Dec 2016 00:08:43 -0800 From: Marvin Liu To: dts@dpdk.org Cc: Marvin Liu Date: Thu, 29 Dec 2016 16:09:47 +0800 Message-Id: <1482998987-21640-2-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1482998987-21640-1-git-send-email-yong.liu@intel.com> References: <1482998987-21640-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH 2/2] framework dts: report error in execution process X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 08:08:45 -0000 Add error report in execution process, now framework report build/setup/execution/generic errors. When those types of error happened, system exit value will be changed as pre-defined value in settings module. Signed-off-by: Marvin Liu diff --git a/framework/dts.py b/framework/dts.py index e9879e5..369599d 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -51,7 +51,6 @@ from test_case import TestCase from test_result import Result from stats_reporter import StatsReporter from excel_reporter import ExcelReporter -import utils from exception import TimeoutException, ConfigParseException, VerifyFailure from logger import getLogger import logger @@ -316,6 +315,14 @@ def dts_run_prerequisties(duts, tester, pkgName, patch, dts_commands, serializer dts_run_commands(tester, dts_commands) tester.prerequisites() dts_run_commands(tester, dts_commands) + except Exception as ex: + log_handler.error(" PREREQ EXCEPTION " + traceback.format_exc()) + log_handler.info('CACHE: Discarding cache.') + serializer.discard_cache() + settings.report_error("TESTER_SETUP_ERR") + return False + + try: for dutobj in duts: dutobj.set_package(pkgName, patch) dutobj.prerequisites() @@ -327,6 +334,7 @@ def dts_run_prerequisties(duts, tester, pkgName, patch, dts_commands, serializer result.add_failed_dut(duts[0], str(ex)) log_handler.info('CACHE: Discarding cache.') serializer.discard_cache() + settings.report_error("DUT_SETUP_ERR") return False @@ -348,9 +356,11 @@ def dts_run_target(duts, tester, targets, test_suites): dutobj.set_target(target) except AssertionError as ex: log_handler.error(" TARGET ERROR: " + str(ex)) + settings.report_error("DPDK_BUILD_ERR") result.add_failed_target(result.dut, target, str(ex)) continue except Exception as ex: + settings.report_error("GENERIC_ERR") log_handler.error(" !!! DEBUG IT: " + traceback.format_exc()) result.add_failed_target(result.dut, target, str(ex)) continue @@ -395,6 +405,7 @@ def dts_run_suite(duts, tester, test_suites, target): log_handler.info("\nTEST SUITE ENDED: " + test_classname) dts_log_execution(duts, tester, log_handler) except VerifyFailure: + settings.report_error("SUITE_EXECUTE_ERR") log_handler.error(" !!! DEBUG IT: " + traceback.format_exc()) except KeyboardInterrupt: # stop/save result/skip execution @@ -403,6 +414,7 @@ def dts_run_suite(duts, tester, test_suites, target): save_all_results() break except Exception as e: + settings.report_error("GENERIC_ERR") log_handler.error(str(e)) finally: suite_obj.execute_tear_downall() @@ -510,7 +522,7 @@ def run_all(config_file, pkgName, git, patch, skip_setup, duts, tester = dts_crbs_init(crbInsts, skip_setup, read_cache, project, base_dir, serializer, virttype) # register exit action - atexit.register(close_all_sessions, duts, tester) + atexit.register(quit_execution, duts, tester) check_case_inst = check_case_skip(duts[0]) support_case_inst = check_case_support(duts[0]) @@ -547,9 +559,10 @@ def save_all_results(): stats_report.save(result) -def close_all_sessions(duts, tester): +def quit_execution(duts, tester): """ - Close session to DUT and tester. + Close session to DUT and tester before quit. + Return exit status when failure occurred. """ # close all nics for dutobj in duts: @@ -562,3 +575,6 @@ def close_all_sessions(duts, tester): if tester is not None: tester.close() log_handler.info("DTS ended") + + # return value + settings.exit_error() -- 1.9.3