Skip to content

Commit fb3bf48

Browse files
committed
Added result print below table
1 parent bca4f4e commit fb3bf48

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

workspace_tools/singletest.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,15 @@ class SingleTestRunner(object):
7373
""" Object wrapper for single test run which may involve multiple MUTs."""
7474

7575
re_detect_testcase_result = None
76+
TEST_RESULT_OK = "OK"
77+
TEST_RESULT_FAIL = "FAIL"
78+
TEST_RESULT_ERROR = "ERROR"
7679
TEST_RESULT_UNDEF = "UNDEF"
7780

7881
# mbed test suite -> SingleTestRunner
79-
TEST_RESULT_MAPPING = {"success" : "OK",
80-
"failure" : "FAIL",
81-
"error" : "ERROR",
82+
TEST_RESULT_MAPPING = {"success" : TEST_RESULT_OK,
83+
"failure" : TEST_RESULT_FAIL,
84+
"error" : TEST_RESULT_ERROR,
8285
"end" : TEST_RESULT_UNDEF}
8386

8487
def __init__(self):
@@ -391,6 +394,11 @@ def get_json_data_from_file(json_spec_filename, verbose=False):
391394

392395
# Human readable summary
393396
if not opts.suppress_summary:
397+
result_dict = { single_test.TEST_RESULT_OK : 0,
398+
single_test.TEST_RESULT_FAIL : 0,
399+
single_test.TEST_RESULT_ERROR : 0,
400+
single_test.TEST_RESULT_UNDEF : 0 }
401+
394402
print
395403
print "Test summary:"
396404
# Pretty table package is used to print results
@@ -404,6 +412,12 @@ def get_json_data_from_file(json_spec_filename, verbose=False):
404412
pt.padding_width = 1 # One space between column edges and contents (default)
405413

406414
for test in test_summary:
415+
if test[0] in result_dict:
416+
result_dict[test[0]] += 1
407417
pt.add_row(test)
408418
print pt
419+
420+
# Print result count
421+
print "Result: " + ' / '.join(['%s %s' % (value, key) for (key, value) in {k: v for k, v in result_dict.items() if v != 0}.iteritems()])
422+
#print result_dict
409423
print "Completed in %d sec" % (time() - start)

0 commit comments

Comments
 (0)