diff options
Diffstat (limited to 'meta/lib/oeqa/core/context.py')
-rw-r--r-- | meta/lib/oeqa/core/context.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/meta/lib/oeqa/core/context.py b/meta/lib/oeqa/core/context.py index 16320af115..b9a28ce319 100644 --- a/meta/lib/oeqa/core/context.py +++ b/meta/lib/oeqa/core/context.py | |||
@@ -116,6 +116,9 @@ class OETestContextExecutor(object): | |||
116 | default=self.default_output_log, | 116 | default=self.default_output_log, |
117 | help="results output log, default: %s" % self.default_output_log) | 117 | help="results output log, default: %s" % self.default_output_log) |
118 | 118 | ||
119 | self.parser.add_argument('--json-result-dir', action='store', | ||
120 | help="json result output dir, create testresults.json here if set") | ||
121 | |||
119 | group = self.parser.add_mutually_exclusive_group() | 122 | group = self.parser.add_mutually_exclusive_group() |
120 | group.add_argument('--run-tests', action='store', nargs='+', | 123 | group.add_argument('--run-tests', action='store', nargs='+', |
121 | default=self.default_tests, | 124 | default=self.default_tests, |
@@ -178,6 +181,22 @@ class OETestContextExecutor(object): | |||
178 | 181 | ||
179 | self.module_paths = args.CASES_PATHS | 182 | self.module_paths = args.CASES_PATHS |
180 | 183 | ||
184 | def _get_json_result_dir(self, args): | ||
185 | return args.json_result_dir | ||
186 | |||
187 | def _get_configuration(self): | ||
188 | td = self.tc_kwargs['init']['td'] | ||
189 | configuration = {'TEST_TYPE': self.name, | ||
190 | 'MACHINE': td.get("MACHINE"), | ||
191 | 'DISTRO': td.get("DISTRO"), | ||
192 | 'IMAGE_BASENAME': td.get("IMAGE_BASENAME"), | ||
193 | 'DATETIME': td.get("DATETIME")} | ||
194 | return configuration | ||
195 | |||
196 | def _get_result_id(self, configuration): | ||
197 | return '%s_%s_%s_%s' % (configuration['TEST_TYPE'], configuration['IMAGE_BASENAME'], | ||
198 | configuration['MACHINE'], configuration['DATETIME']) | ||
199 | |||
181 | def _pre_run(self): | 200 | def _pre_run(self): |
182 | pass | 201 | pass |
183 | 202 | ||
@@ -196,7 +215,16 @@ class OETestContextExecutor(object): | |||
196 | else: | 215 | else: |
197 | self._pre_run() | 216 | self._pre_run() |
198 | rc = self.tc.runTests(**self.tc_kwargs['run']) | 217 | rc = self.tc.runTests(**self.tc_kwargs['run']) |
199 | rc.logDetails() | 218 | |
219 | json_result_dir = self._get_json_result_dir(args) | ||
220 | if json_result_dir: | ||
221 | configuration = self._get_configuration() | ||
222 | rc.logDetails(json_result_dir, | ||
223 | configuration, | ||
224 | self._get_result_id(configuration)) | ||
225 | else: | ||
226 | rc.logDetails() | ||
227 | |||
200 | rc.logSummary(self.name) | 228 | rc.logSummary(self.name) |
201 | 229 | ||
202 | output_link = os.path.join(os.path.dirname(args.output_log), | 230 | output_link = os.path.join(os.path.dirname(args.output_log), |