diff options
author | sangeeta jain <sangeeta.jain@intel.com> | 2019-06-03 16:17:47 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-06-18 11:28:58 +0100 |
commit | 6d26364a7e5264d30e4b1f78da8b135d227ed46c (patch) | |
tree | 32b8c33d2ba1f563794ce0770784960946caa59f /scripts | |
parent | bdc1b24bc2ffb4f51f67b12a86a40d396b627c0a (diff) | |
download | poky-6d26364a7e5264d30e4b1f78da8b135d227ed46c.tar.gz |
resulttool/manualexecution: Enable creation of test case configuration
Allow the creation of test case configuration file based on user inputs.
Where this testcase configuration file will be used by the the manual
execution to run selected test cases for a module rather than compulsory
run all test cases in manual json file.
(From OE-Core rev: 2ab748e4d8e4c64571f51d5e090b723b93dd5c5d)
Signed-off-by: sangeeta jain <sangeeta.jain@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/lib/resulttool/manualexecution.py | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/scripts/lib/resulttool/manualexecution.py b/scripts/lib/resulttool/manualexecution.py index df28e1d21e..ecb27c5933 100755 --- a/scripts/lib/resulttool/manualexecution.py +++ b/scripts/lib/resulttool/manualexecution.py | |||
@@ -181,11 +181,38 @@ class ManualTestRunner(object): | |||
181 | write_json_file(config_options_file, config_options) | 181 | write_json_file(config_options_file, config_options) |
182 | logger.info('Configuration option file created at %s' % config_options_file) | 182 | logger.info('Configuration option file created at %s' % config_options_file) |
183 | 183 | ||
184 | def make_testcase_config_file(self, logger, case_file, testcase_config_file): | ||
185 | if testcase_config_file: | ||
186 | if os.path.exists(testcase_config_file): | ||
187 | print('\nTest configuration file with name %s already exists. Please provide a unique file name' % (testcase_config_file)) | ||
188 | return 0 | ||
189 | |||
190 | if not testcase_config_file: | ||
191 | testcase_config_file = os.path.join(self._get_write_dir(), "testconfig_new.json") | ||
192 | |||
193 | testcase_config = {} | ||
194 | cases = load_json_file(case_file) | ||
195 | new_test_module = self._get_test_module(case_file) | ||
196 | new_testcase_config = {} | ||
197 | new_testcase_config['testcases'] = [] | ||
198 | |||
199 | print('\nAdd testcases for this configuration file:') | ||
200 | for case in cases: | ||
201 | print('\n' + case['test']['@alias']) | ||
202 | add_tc_config = self._get_true_false_input('\nDo you want to add this test case to test configuration : (Y)es/(N)o\n') | ||
203 | if add_tc_config: | ||
204 | new_testcase_config['testcases'].append(case['test']['@alias']) | ||
205 | write_json_file(testcase_config_file, new_testcase_config) | ||
206 | logger.info('Testcase Configuration file created at %s' % testcase_config_file) | ||
207 | |||
184 | def manualexecution(args, logger): | 208 | def manualexecution(args, logger): |
185 | testrunner = ManualTestRunner() | 209 | testrunner = ManualTestRunner() |
186 | if args.make_config_options_file: | 210 | if args.make_config_options_file: |
187 | testrunner.make_config_option_file(logger, args.file, args.config_options_file) | 211 | testrunner.make_config_option_file(logger, args.file, args.config_options_file) |
188 | return 0 | 212 | return 0 |
213 | if args.make_testcase_config_file: | ||
214 | testrunner.make_testcase_config_file(logger, args.file, args.testcase_config_file) | ||
215 | return 0 | ||
189 | configurations, result_id, write_dir, test_results = testrunner.run_test(args.file, args.config_options_file, args.testcase_config_file) | 216 | configurations, result_id, write_dir, test_results = testrunner.run_test(args.file, args.config_options_file, args.testcase_config_file) |
190 | resultjsonhelper = OETestResultJSONHelper() | 217 | resultjsonhelper = OETestResultJSONHelper() |
191 | resultjsonhelper.dump_testresult_file(write_dir, configurations, result_id, test_results) | 218 | resultjsonhelper.dump_testresult_file(write_dir, configurations, result_id, test_results) |
@@ -203,4 +230,6 @@ def register_commands(subparsers): | |||
203 | parser_build.add_argument('-m', '--make-config-options-file', action='store_true', | 230 | parser_build.add_argument('-m', '--make-config-options-file', action='store_true', |
204 | help='make the configuration options file based on provided inputs') | 231 | help='make the configuration options file based on provided inputs') |
205 | parser_build.add_argument('-t', '--testcase-config-file', default='', | 232 | parser_build.add_argument('-t', '--testcase-config-file', default='', |
206 | help='the testcase configuration file to enable user to run a selected set of test case') \ No newline at end of file | 233 | help='the testcase configuration file to enable user to run a selected set of test case or make a testcase configuration file') |
234 | parser_build.add_argument('-d', '--make-testcase-config-file', action='store_true', | ||
235 | help='make the testcase configuration file to run a set of test cases based on user selection') \ No newline at end of file | ||