[oe-commits] [openembedded-core] 24/41: resulttool/manualexecution: Enable test case configuration option

git at git.openembedded.org git at git.openembedded.org
Sun May 12 08:14:51 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch warrior
in repository openembedded-core.

commit d35de5383275a5d83317160ce3dc09a20661a572
Author: sangeeta jain <sangeeta.jain at intel.com>
AuthorDate: Fri Apr 19 16:22:26 2019 +0800

    resulttool/manualexecution: Enable test case configuration option
    
    Current manualexecution required user to exceute all test cases defined inside a "modulename.json" file in oeqa/manual
    
    There are cases when all test cases all not required to run for a module on specific DUT.
    
    Enable manualexecution to have the optional feature where it will use pre-defined json format test case configuration file
    where user will be able to select test cases from the "modulename.json" instead of running all of them. This will help
    in reducing testing time and reporting unneccesary skip or failures.
    
    Example pre-defined json format test case configuration file (for build-applince):
    
    {
        "testcases" : [
            "build-appliance.build-appliance.Create_core-image-sato-sdk_using_build_appliance",
            "build-appliance.build-appliance.Build_a_image_without_error_(added_recipe)"
        ]
    }
    
    Signed-off-by: sangeeta jain <sangeeta.jain at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 scripts/lib/resulttool/manualexecution.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/scripts/lib/resulttool/manualexecution.py b/scripts/lib/resulttool/manualexecution.py
index ea44219..dc368f3 100755
--- a/scripts/lib/resulttool/manualexecution.py
+++ b/scripts/lib/resulttool/manualexecution.py
@@ -17,6 +17,7 @@ import os
 import sys
 import datetime
 import re
+import copy
 from oeqa.core.runner import OETestResultJSONHelper
 
 
@@ -123,7 +124,7 @@ class ManualTestRunner(object):
     def _get_write_dir(self):
         return os.environ['BUILDDIR'] + '/tmp/log/manual/'
 
-    def run_test(self, case_file, config_options_file):
+    def run_test(self, case_file, config_options_file, testcase_config_file):
         test_module = self._get_test_module(case_file)
         cases = load_json_file(case_file)
         config_options = {}
@@ -132,6 +133,13 @@ class ManualTestRunner(object):
         configurations = self._get_config(config_options, test_module)
         result_id = 'manual_%s_%s' % (test_module, configurations['STARTTIME'])
         test_results = {}
+        if testcase_config_file:
+            test_case_config = load_json_file(testcase_config_file)
+            test_case_to_execute = test_case_config['testcases']
+            for case in copy.deepcopy(cases) :
+                if case['test']['@alias'] not in test_case_to_execute:
+                    cases.remove(case)
+
         print('\nTotal number of test cases in this test suite: %s\n' % len(cases))
         for c in cases:
             test_result = self._execute_test_steps(c)
@@ -184,7 +192,7 @@ def manualexecution(args, logger):
     if args.make_config_options_file:
         testrunner.make_config_option_file(logger, args.file, args.config_options_file)
         return 0
-    configurations, result_id, write_dir, test_results = testrunner.run_test(args.file, args.config_options_file)
+    configurations, result_id, write_dir, test_results = testrunner.run_test(args.file, args.config_options_file, args.testcase_config_file)
     resultjsonhelper = OETestResultJSONHelper()
     resultjsonhelper.dump_testresult_file(write_dir, configurations, result_id, test_results)
     return 0
@@ -200,3 +208,5 @@ def register_commands(subparsers):
                               help='the config options file to import and used as available configuration option selection or make config option file')
     parser_build.add_argument('-m', '--make-config-options-file', action='store_true',
                               help='make the configuration options file based on provided inputs')
+    parser_build.add_argument('-t', '--testcase-config-file', default='',
+                              help='the testcase configuration file to enable user to run a selected set of test case')
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list