[dts] [PATCH V1] framework: add support config test case in execution.cfg

lihong lihongx.ma at intel.com
Thu Jul 9 05:22:31 CEST 2020


can config which test_case you want to run in file execution.cfg,
the format is:
suite_name:test_case_1/test_case_2/test_case_3,

Signed-off-by: lihong <lihongx.ma at intel.com>
---
 framework/dts.py       | 7 +++++++
 framework/test_case.py | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/framework/dts.py b/framework/dts.py
index d6c4fe5..05cc012 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -432,6 +432,12 @@ def dts_run_suite(duts, tester, test_suites, target, subtitle):
     """
     for suite_name in test_suites:
         try:
+            # check whether config the test cases
+            append_requested_case_list = None
+            if ':' in suite_name:
+                case_list = suite_name[suite_name.find(':')+1:]
+                append_requested_case_list = case_list.split('\\')
+                suite_name = suite_name[:suite_name.find(':')]
             result.test_suite = suite_name
             suite_module = __import__('TestSuite_' + suite_name)
             for test_classname, test_class in get_subclasses(suite_module, TestCase):
@@ -439,6 +445,7 @@ def dts_run_suite(duts, tester, test_suites, target, subtitle):
                 suite_obj = test_class(duts, tester, target, suite_name)
                 suite_obj.init_log()
                 suite_obj.set_requested_cases(requested_tests)
+                suite_obj.set_requested_cases(append_requested_case_list)
                 suite_obj.set_check_inst(check=check_case_inst)
                 suite_obj.set_subtitle(subtitle)
                 result.nic = suite_obj.nic
diff --git a/framework/test_case.py b/framework/test_case.py
index 282c96d..110dafb 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -221,7 +221,10 @@ class TestCase(object):
         """
         Pass down input cases list for check
         """
-        self._requested_tests = case_list
+        if self._requested_tests is None:
+            self._requested_tests = case_list
+        elif case_list is not None:
+            self._requested_tests += case_list
 
     def set_subtitle(self, subtitle):
         """
-- 
2.7.4



More information about the dts mailing list