Bugfix: fixed function printing table with test results per target (switch -t)

pull/443/head
Przemek Wirkus 2014-08-12 13:47:08 +01:00
parent 698fe930e6
commit 0e6803b787
1 changed files with 11 additions and 6 deletions

View File

@ -348,14 +348,18 @@ class SingleTestRunner(object):
unique_toolchains = get_unique_value_from_summary(test_summary, TOOLCHAIN_INDEX) unique_toolchains = get_unique_value_from_summary(test_summary, TOOLCHAIN_INDEX)
result = "Test summary:\n" result = "Test summary:\n"
result_dict = {} # test : { toolchain : result }
for target in unique_targets: for target in unique_targets:
result_dict = {} # test : { toolchain : result }
unique_target_toolchains = []
for test in test_summary: for test in test_summary:
if test[TARGET_INDEX] == target:
if test[TOOLCHAIN_INDEX] not in unique_target_toolchains:
unique_target_toolchains.append(test[TOOLCHAIN_INDEX])
if test[TEST_INDEX] not in result_dict: if test[TEST_INDEX] not in result_dict:
result_dict[test[TEST_INDEX]] = {} result_dict[test[TEST_INDEX]] = {}
result_dict[test[TEST_INDEX]][test[TOOLCHAIN_INDEX]] = test[RESULT_INDEX] result_dict[test[TEST_INDEX]][test[TOOLCHAIN_INDEX]] = test[RESULT_INDEX]
pt_cols = ["Target", "Test ID", "Test Description"] + unique_toolchains pt_cols = ["Target", "Test ID", "Test Description"] + unique_target_toolchains
pt = PrettyTable(pt_cols) pt = PrettyTable(pt_cols)
for col in pt_cols: for col in pt_cols:
pt.align[col] = "l" pt.align[col] = "l"
@ -365,6 +369,7 @@ class SingleTestRunner(object):
test_results = result_dict[test] test_results = result_dict[test]
row = [target, test, unique_test_desc[test]] row = [target, test, unique_test_desc[test]]
for toolchain in unique_toolchains: for toolchain in unique_toolchains:
if toolchain in test_results:
row.append(test_results[toolchain]) row.append(test_results[toolchain])
pt.add_row(row) pt.add_row(row)
result += pt.get_string() result += pt.get_string()