Skip to content

Commit 80745d5

Browse files
committed
Test loops feature part 3: Finnaly commit. Added Loops info in pretty table in test sumary. Added Result resolving by test result list analysis.
1 parent 98ae711 commit 80745d5

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

workspace_tools/singletest.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,24 @@ def handle(self, test_spec, target_name, toolchain_name, test_loops=1):
321321
elapsed_time = time() - start_host_exec_time
322322
print print_test_result(test_result, target_name, toolchain_name,
323323
test_id, test_description, elapsed_time, duration)
324-
return (test_result, target_name, toolchain_name,
325-
test_id, test_description, round(elapsed_time, 2), duration)
324+
return (self.shape_global_test_loop_result(test_all_result), target_name, toolchain_name,
325+
test_id, test_description, round(elapsed_time, 2),
326+
duration, self.shape_test_loop_ok_result_count(test_all_result))
327+
328+
def shape_test_loop_ok_result_count(self, test_all_result):
329+
""" Reformats list of results to simple string """
330+
test_loop_count = len(test_all_result)
331+
test_loop_ok_result = test_all_result.count(self.TEST_RESULT_OK)
332+
return "%d/%d"% (test_loop_ok_result, test_loop_count)
333+
334+
def shape_global_test_loop_result(self, test_all_result):
335+
""" Reformats list of results to simple string """
336+
test_loop_count = len(test_all_result)
337+
test_loop_ok_result = test_all_result.count(self.TEST_RESULT_OK)
338+
result = self.TEST_RESULT_FAIL
339+
if all(test_all_result[0] == res for res in test_all_result):
340+
result = test_all_result[0]
341+
return result
326342

327343
def run_host_test(self, name, disk, port, duration, verbose=False, extra_serial=""):
328344
# print "{%s} port:%s disk:%s" % (name, port, disk),
@@ -657,7 +673,6 @@ def generate_test_summary_by_target(test_summary):
657673
if test[TEST_INDEX] not in result_dict:
658674
result_dict[test[TEST_INDEX]] = { }
659675
result_dict[test[TEST_INDEX]][test[TOOLCHAIN_INDEX]] = test[RESULT_INDEX]
660-
pass
661676

662677
pt_cols = ["Target", "Test ID", "Test Description"] + unique_toolchains
663678
pt = PrettyTable(pt_cols)
@@ -682,7 +697,7 @@ def generate_test_summary(test_summary):
682697
result = "Test summary:\n"
683698
# Pretty table package is used to print results
684699
pt = PrettyTable(["Result", "Target", "Toolchain", "Test ID", "Test Description",
685-
"Elapsed Time (sec)", "Timeout (sec)"])
700+
"Elapsed Time (sec)", "Timeout (sec)", "Loops"])
686701
pt.align["Result"] = "l" # Left align
687702
pt.align["Target"] = "l" # Left align
688703
pt.align["Toolchain"] = "l" # Left align

0 commit comments

Comments
 (0)