From patchwork Mon Aug 17 01:51:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xiao, QimaiX" X-Patchwork-Id: 75569 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 02FD6A034D; Mon, 17 Aug 2020 04:15:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B1D131C0D9; Mon, 17 Aug 2020 04:15:46 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id A087D1C0BD for ; Mon, 17 Aug 2020 04:15:44 +0200 (CEST) IronPort-SDR: 5ieX1U+gUrrTqwKebJ+BGfCZLJhK/7qD8LHiCEfXbKfMFiXOI1wNe8LEKaRFsDBsFXNMJouIyp uTRpvUs0j9zA== X-IronPort-AV: E=McAfee;i="6000,8403,9715"; a="152027711" X-IronPort-AV: E=Sophos;i="5.76,322,1592895600"; d="scan'208";a="152027711" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2020 19:15:42 -0700 IronPort-SDR: G6ZhjA+cWOiCrTjJ9CVvI8EaAUlGSbjd2boqyNR1ycnTAK359NOYeOEfLjURN31LDdpUZHARO3 5N80EioonQ+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,322,1592895600"; d="scan'208";a="400056516" Received: from unknown (HELO localhost.localdomain) ([10.240.183.52]) by fmsmga001.fm.intel.com with ESMTP; 16 Aug 2020 19:15:42 -0700 From: Xiao Qimai To: dts@dpdk.org Cc: Xiao Qimai Date: Mon, 17 Aug 2020 01:51:29 +0000 Message-Id: <20200817015129.69113-1-qimaix.xiao@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dts] [PATCH V1]framework/test_case: fix tear down fail will lost suite results 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: , Errors-To: dts-bounces@dpdk.org Sender: "dts" *. this patch fix if got exception in tear down method of testsuite will lost result scilently Signed-off-by: Xiao Qimai Tested-by: Xiao Qimai --- framework/test_case.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/framework/test_case.py b/framework/test_case.py index 110dafb..300b6ac 100644 --- a/framework/test_case.py +++ b/framework/test_case.py @@ -350,7 +350,7 @@ class TestCase(object): 'update_expected' in self.get_suite_cfg() and \ self.get_suite_cfg()['update_expected'] == True: self._suite_conf.update_case_config(SUITE_SECTION_NAME) - self.tear_down() + self.execute_tear_down() return case_result def execute_test_cases(self): @@ -440,6 +440,16 @@ class TestCase(object): # destroy all vfs dutobj.destroy_all_sriov_vfs() + def execute_tear_down(self): + """ + execute suite tear_down function + """ + try: + self.tear_down() + except Exception: + self.logger.error('tear_down failed:\n' + traceback.format_exc()) + self.logger.warning("tear down %s failed, might iterfere next case's result!" % self.running_case) + def enable_history(self, history): """ Enable history for all CRB's default session