test suite reviews and discussions
 help / color / mirror / Atom feed
From: Marvin Liu <yong.liu@intel.com>
To: dts@dpdk.org
Cc: Marvin Liu <yong.liu@intel.com>
Subject: [dts] [PATCH 1/4] framework dts: fix program exit when exception raised
Date: Thu,  4 Aug 2016 21:18:31 +0800	[thread overview]
Message-ID: <1470316714-14698-2-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1470316714-14698-1-git-send-email-yong.liu@intel.com>

After handled test suite exception, dts should continue to next suite.
Remove global configuration file object, it will be passed as parameter.
When exit from suite, should call tear_down_all to stop everything.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

diff --git a/framework/dts.py b/framework/dts.py
index 6077a04..e9879e5 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -64,7 +64,6 @@ reload(sys)
 sys.setdefaultencoding('UTF8')
 
 
-config = None
 requested_tests = None
 result = None
 excel_report = None
@@ -72,7 +71,7 @@ stats_report = None
 log_handler = None
 
 
-def dts_parse_param(section):
+def dts_parse_param(config, section):
     """
     Parse execution file parameters.
     """
@@ -112,7 +111,7 @@ def dts_parse_param(section):
         settings.save_global_setting(settings.FUNC_SETTING, 'no')
 
 
-def dts_parse_config(section):
+def dts_parse_config(config, section):
     """
     Parse execution file configuration.
     """
@@ -369,8 +368,8 @@ def dts_run_suite(duts, tester, test_suites, target):
     """
     Run each suite in test suite list.
     """
-    try:
-        for suite_name in test_suites:
+    for suite_name in test_suites:
+        try:
             result.test_suite = suite_name
             suite_module = __import__('TestSuite_' + suite_name)
             for test_classname, test_class in get_subclasses(suite_module, TestCase):
@@ -395,14 +394,19 @@ 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:
-        log_handler.error(" !!! DEBUG IT: " + traceback.format_exc())
-    except KeyboardInterrupt:
-        log_handler.error(" !!! STOPPING DCTS")
-    except Exception as e:
-        log_handler.error(str(e))
-    finally:
-        suite_obj.execute_tear_downall()
+        except VerifyFailure:
+            log_handler.error(" !!! DEBUG IT: " + traceback.format_exc())
+        except KeyboardInterrupt:
+            # stop/save result/skip execution
+            log_handler.error(" !!! STOPPING DTS")
+            suite_obj.execute_tear_downall()
+            save_all_results()
+            break
+        except Exception as e:
+            log_handler.error(str(e))
+        finally:
+            suite_obj.execute_tear_downall()
+            save_all_results()
 
 
 def run_all(config_file, pkgName, git, patch, skip_setup,
@@ -413,7 +417,6 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
     Main process of DTS, it will run all test suites in the config file.
     """
 
-    global config
     global requested_tests
     global result
     global excel_report
@@ -442,9 +445,9 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
 
     # enable debug mode
     if debug is True:
-        setting.set_local_variable(settings.DEBUG_SETTING, 'yes')
+        settings.save_global_setting(settings.DEBUG_SETTING, 'yes')
     if debugcase is True:
-        setting.set_local_variable(settings.DEBUG_CASE_SETTING, 'yes')
+        settings.save_global_setting(settings.DEBUG_CASE_SETTING, 'yes')
 
     # init log_handler handler
     if verbose is True:
@@ -482,10 +485,10 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
 
     # for all Exectuion sections
     for section in config.sections():
-        dts_parse_param(section)
+        dts_parse_param(config, section)
 
         # verify if the delimiter is good if the lists are vertical
-        dutIPs, targets, test_suites = dts_parse_config(section)
+        dutIPs, targets, test_suites = dts_parse_config(config, section)
         for dutIP in dutIPs:
             log_handler.info("\nDUT " + dutIP)
 
-- 
1.9.3

  reply	other threads:[~2016-08-04 13:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-04 13:18 [dts] [PATCH 0/4] enhance framework and fix some issues Marvin Liu
2016-08-04 13:18 ` Marvin Liu [this message]
2016-08-04 13:18 ` [dts] [PATCH 2/4] framework: fix cache option not work Marvin Liu
2016-08-04 13:18 ` [dts] [PATCH 3/4] framework: add session check function Marvin Liu
2016-08-04 13:18 ` [dts] [PATCH 4/4] tests: fix tope issue in suites Marvin Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470316714-14698-2-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).