From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id D9D5F271 for ; Wed, 28 Jun 2017 07:58:13 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jun 2017 22:58:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,274,1496127600"; d="scan'208";a="1187802726" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.240.176.135]) by fmsmga002.fm.intel.com with ESMTP; 27 Jun 2017 22:58:09 -0700 From: "xu,huilong" To: dts@dpdk.org Cc: "xu,huilong" Date: Wed, 28 Jun 2017 13:59:29 +0800 Message-Id: <1498629570-20724-2-git-send-email-huilongx.xu@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1498629570-20724-1-git-send-email-huilongx.xu@intel.com> References: <1498629570-20724-1-git-send-email-huilongx.xu@intel.com> Subject: [dts] [PATCH V2 2/3] update exec case function 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: Wed, 28 Jun 2017 05:58:14 -0000 when test case run failed, failed case will re run some times. if have passed result, this case will passed. Signed-off-by: xu,huilong --- framework/test_case.py | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/framework/test_case.py b/framework/test_case.py index d97d898..0f33768 100644 --- a/framework/test_case.py +++ b/framework/test_case.py @@ -36,6 +36,7 @@ import re import debugger import traceback import signal +import time from exception import VerifyFailure, TimeoutException from settings import DRIVERS, NICS, get_nic_name, load_global_setting @@ -44,7 +45,6 @@ from rst import RstReport from test_result import ResultTable, Result from logger import getLogger - class TestCase(object): def __init__(self, duts, tester, target, suitename): @@ -244,20 +244,20 @@ class TestCase(object): self._suite_result.test_case = case_obj.__name__ self._rst_obj.write_title("Test Case: " + case_name) - + case_result = True if self._check_inst is not None: if self._check_inst.case_skip(case_name[len("test_"):]): self.logger.info('Test Case %s Result SKIPED:' % case_name) self._rst_obj.write_result("N/A") self._suite_result.test_case_skip(self._check_inst.comments) - return + return case_result if self._support_inst is not None: if not self._support_inst.case_support(case_name[len("test_"):]): self.logger.info('Test Case %s Result SKIPED:' % case_name) self._rst_obj.write_result("N/A") self._suite_result.test_case_skip(self._support_inst.comments) - return + return case_result if self._enable_perf: self._rst_obj.write_annex_title("Annex: " + case_name) @@ -287,6 +287,7 @@ class TestCase(object): self.logger.info('Test Case %s Result PASSED:' % case_name) except VerifyFailure as v: + case_result = False self._suite_result.test_case_failed(str(v)) self._rst_obj.write_result("FAIL") self.logger.error('Test Case %s Result FAILED: ' % (case_name) + str(v)) @@ -296,25 +297,37 @@ class TestCase(object): self.tear_down() raise KeyboardInterrupt("Stop DTS") except TimeoutException as e: + case_result = False self._rst_obj.write_result("FAIL") - msg = str(e) - self._suite_result.test_case_failed(msg) - self.logger.error('Test Case %s Result FAILED: ' % (case_name) + msg) + self._suite_result.test_case_failed(str(e)) + self.logger.error('Test Case %s Result FAILED: ' % (case_name) + str(e)) self.logger.error('%s' % (e.get_output())) except Exception: + case_result = False trace = traceback.format_exc() self._suite_result.test_case_failed(trace) self.logger.error('Test Case %s Result ERROR: ' % (case_name) + trace) finally: self.tear_down() + return case_result def execute_test_cases(self): """ Execute all test cases in one suite. """ + if load_global_setting(FUNC_SETTING) == 'yes': for case_obj in self._get_functional_cases(): - self._execute_test_case(case_obj) + for i in range(self.tester.re_run_time + 1): + if self._execute_test_case(case_obj): + break + else: + for dutobj in self.duts: + dutobj.get_session_output(timeout = 0.5 * (i + 1)) + self.tester.get_session_output(timeout = 0.5 * (i + 1)) + time.sleep(i + 1) + self.logger.info(" Test case %s re-run %d time" % (case_obj.__name__, i + 1)) + if load_global_setting(PERF_SETTING) == 'yes': for case_obj in self._get_performance_cases(): self._execute_test_case(case_obj) -- 1.9.3