Skip to content

Commit 2722a2f

Browse files
committed
Allow build report data structure to be passed to SingleTestRunner
1 parent 9dcb51c commit 2722a2f

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

workspace_tools/test_api.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ def __init__(self,
162162
_opts_report_html_file_name=None,
163163
_opts_report_junit_file_name=None,
164164
_opts_report_build_file_name=None,
165+
_opts_build_report={},
166+
_opts_build_properties={},
165167
_test_spec={},
166168
_opts_goanna_for_mbed_sdk=None,
167169
_opts_goanna_for_tests=None,
@@ -185,7 +187,8 @@ def __init__(self,
185187
_opts_waterfall_test=None,
186188
_opts_consolidate_waterfall_test=None,
187189
_opts_extend_test_timeout=None,
188-
_opts_auto_detect=None):
190+
_opts_auto_detect=None,
191+
_opts_include_non_automated=False):
189192
""" Let's try hard to init this object
190193
"""
191194
from colorama import init
@@ -241,6 +244,10 @@ def __init__(self,
241244
self.opts_extend_test_timeout = _opts_extend_test_timeout
242245
self.opts_clean = _clean
243246
self.opts_auto_detect = _opts_auto_detect
247+
self.opts_include_non_automated = _opts_include_non_automated
248+
249+
self.build_report = _opts_build_report
250+
self.build_properties = _opts_build_properties
244251

245252
# File / screen logger initialization
246253
self.logger = CLITestLogger(file_name=self.opts_log_file_name) # Default test logger
@@ -382,7 +389,7 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep
382389
self.db_logger.update_build_id_info(self.db_logger_build_id, _extra=json.dumps(self.dump_options()))
383390
self.db_logger.disconnect();
384391

385-
valid_test_map_keys = self.get_valid_tests(test_map_keys, target, toolchain, test_ids)
392+
valid_test_map_keys = self.get_valid_tests(test_map_keys, target, toolchain, test_ids, self.opts_include_non_automated)
386393
skipped_test_map_keys = self.get_skipped_tests(test_map_keys, valid_test_map_keys)
387394

388395
for skipped_test_id in skipped_test_map_keys:
@@ -560,8 +567,6 @@ def execute(self):
560567
if self.opts_shuffle_test_seed is not None and self.is_shuffle_seed_float():
561568
self.shuffle_random_seed = round(float(self.opts_shuffle_test_seed), self.SHUFFLE_SEED_ROUND)
562569

563-
build_report = {}
564-
build_properties = {}
565570

566571
if self.opts_parallel_test_exec:
567572
###################################################################
@@ -575,7 +580,7 @@ def execute(self):
575580
# get information about available MUTs (per target).
576581
for target, toolchains in self.test_spec['targets'].iteritems():
577582
self.test_suite_properties_ext[target] = {}
578-
t = threading.Thread(target=self.execute_thread_slice, args = (q, target, toolchains, clean, test_ids, build_report, build_properties))
583+
t = threading.Thread(target=self.execute_thread_slice, args = (q, target, toolchains, clean, test_ids, self.build_report, self.build_properties))
579584
t.daemon = True
580585
t.start()
581586
execute_threads.append(t)
@@ -588,7 +593,7 @@ def execute(self):
588593
if target not in self.test_suite_properties_ext:
589594
self.test_suite_properties_ext[target] = {}
590595

591-
self.execute_thread_slice(q, target, toolchains, clean, test_ids, build_report, build_properties)
596+
self.execute_thread_slice(q, target, toolchains, clean, test_ids, self.build_report, self.build_properties)
592597
q.get()
593598

594599
if self.db_logger:
@@ -597,9 +602,9 @@ def execute(self):
597602
self.db_logger.update_build_id_info(self.db_logger_build_id, _status_fk=self.db_logger.BUILD_ID_STATUS_COMPLETED)
598603
self.db_logger.disconnect();
599604

600-
return self.test_summary, self.shuffle_random_seed, self.test_summary_ext, self.test_suite_properties_ext, build_report, build_properties
605+
return self.test_summary, self.shuffle_random_seed, self.test_summary_ext, self.test_suite_properties_ext, self.build_report, self.build_properties
601606

602-
def get_valid_tests(self, test_map_keys, target, toolchain, test_ids):
607+
def get_valid_tests(self, test_map_keys, target, toolchain, test_ids, include_non_automated):
603608
valid_test_map_keys = []
604609

605610
for test_id in test_map_keys:
@@ -626,7 +631,12 @@ def get_valid_tests(self, test_map_keys, target, toolchain, test_ids):
626631
print self.logger.log_line(self.logger.LogType.INFO, 'Peripheral test skipped for target %s'% (target))
627632
continue
628633

629-
if test.automated and test.is_supported(target, toolchain):
634+
if not include_non_automated and not test.automated:
635+
if self.opts_verbose_skipped_tests:
636+
print self.logger.log_line(self.logger.LogType.INFO, 'Non automated test skipped for target %s'% (target))
637+
continue
638+
639+
if test.is_supported(target, toolchain):
630640
if test.peripherals is None and self.opts_only_build_tests:
631641
# When users are using 'build only flag' and test do not have
632642
# specified peripherals we can allow test building by default

0 commit comments

Comments
 (0)