Skip to content

Commit 8902229

Browse files
committed
Merge pull request #1168 from bridadan/consolidate-waterfall
Consolidate waterfall test results
2 parents f10bb18 + 0d2effd commit 8902229

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

workspace_tools/singletest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ def get_version():
231231
_opts_mut_reset_type=opts.mut_reset_type,
232232
_opts_jobs=opts.jobs,
233233
_opts_waterfall_test=opts.waterfall_test,
234+
_opts_consolidate_waterfall_test=opts.consolidate_waterfall_test,
234235
_opts_extend_test_timeout=opts.extend_test_timeout)
235236

236237
# Runs test suite in CLI mode

workspace_tools/test_api.py

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def __init__(self,
179179
_opts_mut_reset_type=None,
180180
_opts_jobs=None,
181181
_opts_waterfall_test=None,
182+
_opts_consolidate_waterfall_test=None,
182183
_opts_extend_test_timeout=None):
183184
""" Let's try hard to init this object
184185
"""
@@ -236,6 +237,7 @@ def __init__(self,
236237
self.opts_mut_reset_type = _opts_mut_reset_type
237238
self.opts_jobs = _opts_jobs if _opts_jobs is not None else 1
238239
self.opts_waterfall_test = _opts_waterfall_test
240+
self.opts_consolidate_waterfall_test = _opts_consolidate_waterfall_test
239241
self.opts_extend_test_timeout = _opts_extend_test_timeout
240242
self.opts_clean = _clean
241243

@@ -485,18 +487,21 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep
485487
)
486488

487489
# Add detailed test result to test summary structure
488-
if target not in self.test_summary_ext[toolchain][target]:
489-
self.test_summary_ext[toolchain][target][test_id] = { 0: {
490-
'single_test_result' : self.TEST_RESULT_BUILD_FAILED,
491-
'single_test_output' : '',
492-
'target_name' : target,
493-
'toolchain_name' : toolchain,
494-
'test_id' : test_id,
495-
'test_description' : 'Toolchain build failed',
496-
'elapsed_time' : 0,
497-
'duration' : 0,
498-
'copy_method' : None
499-
}}
490+
if test_id not in self.test_summary_ext[toolchain][target]:
491+
self.test_summary_ext[toolchain][target][test_id] = []
492+
493+
self.test_summary_ext[toolchain][target][test_id].append({ 0: {
494+
'single_test_result' : self.TEST_RESULT_BUILD_FAILED,
495+
'single_test_output' : '',
496+
'target_name' : target,
497+
'target_name_unique': target,
498+
'toolchain_name' : toolchain,
499+
'test_id' : test_id,
500+
'test_description' : 'Toolchain build failed',
501+
'elapsed_time' : 0,
502+
'duration' : 0,
503+
'copy_method' : None
504+
}})
500505
continue
501506

502507
if self.opts_only_build_tests:
@@ -537,7 +542,15 @@ def execute_thread_slice(self, q, target, toolchains, clean, test_ids, build_rep
537542
if target not in self.test_summary_ext[toolchain][target]:
538543
if test_id not in self.test_summary_ext[toolchain][target]:
539544
self.test_summary_ext[toolchain][target][test_id] = []
540-
self.test_summary_ext[toolchain][target][test_id].append(detailed_test_results)
545+
546+
append_test_result = detailed_test_results
547+
548+
# If waterfall and consolidate-waterfall options are enabled,
549+
# only include the last test result in the report.
550+
if self.opts_waterfall_test and self.opts_consolidate_waterfall_test:
551+
append_test_result = {0: detailed_test_results[len(detailed_test_results) - 1]}
552+
553+
self.test_summary_ext[toolchain][target][test_id].append(append_test_result)
541554

542555
test_suite_properties['skipped'] = ', '.join(test_suite_properties['skipped'])
543556
self.test_suite_properties_ext[target][toolchain] = test_suite_properties
@@ -1835,6 +1848,12 @@ def get_default_test_options_parser():
18351848
dest='test_global_loops_value',
18361849
help='Set global number of test loops per test. Default value is set 1')
18371850

1851+
parser.add_option('', '--consolidate-waterfall',
1852+
dest='consolidate_waterfall_test',
1853+
default=False,
1854+
action="store_true",
1855+
help='Used with --waterfall option. Adds only one test to report reflecting outcome of waterfall test.')
1856+
18381857
parser.add_option('-W', '--waterfall',
18391858
dest='waterfall_test',
18401859
default=False,

0 commit comments

Comments
 (0)