From dfa9599ded94f72d2564e099c244573926179f40 Mon Sep 17 00:00:00 2001 From: Przemek Wirkus Date: Tue, 24 Feb 2015 13:46:45 +0000 Subject: [PATCH] Added mbed assertion detection Test suite will detect mbed assertion print and end test execution with MBED_ASSERT error --- workspace_tools/host_tests/host_test.py | 1 + workspace_tools/test_api.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/workspace_tools/host_tests/host_test.py b/workspace_tools/host_tests/host_test.py index 245b86ab32..c00c8ba2fe 100644 --- a/workspace_tools/host_tests/host_test.py +++ b/workspace_tools/host_tests/host_test.py @@ -259,6 +259,7 @@ class HostTestResults: self.RESULT_IOERR_COPY = "ioerr_copy" self.RESULT_PASSIVE = "passive" self.RESULT_NOT_DETECTED = "not_detected" + self.RESULT_MBED_ASSERT = "mbed_assert" import workspace_tools.host_tests as host_tests diff --git a/workspace_tools/test_api.py b/workspace_tools/test_api.py index d52485286e..7194d45d3a 100644 --- a/workspace_tools/test_api.py +++ b/workspace_tools/test_api.py @@ -122,6 +122,7 @@ class SingleTestRunner(object): TEST_RESULT_IOERR_SERIAL = "IOERR_SERIAL" TEST_RESULT_TIMEOUT = "TIMEOUT" TEST_RESULT_NO_IMAGE = "NO_IMAGE" + TEST_RESULT_MBED_ASSERT = "MBED_ASSERT" GLOBAL_LOOPS_COUNT = 1 # How many times each test should be repeated TEST_LOOPS_LIST = [] # We redefine no.of loops per test_id @@ -139,7 +140,8 @@ class SingleTestRunner(object): "ioerr_serial" : TEST_RESULT_IOERR_SERIAL, "timeout" : TEST_RESULT_TIMEOUT, "no_image" : TEST_RESULT_NO_IMAGE, - "end" : TEST_RESULT_UNDEF + "end" : TEST_RESULT_UNDEF, + "mbed_assert" : TEST_RESULT_MBED_ASSERT } def __init__(self, @@ -565,7 +567,8 @@ class SingleTestRunner(object): self.TEST_RESULT_IOERR_DISK : 0, self.TEST_RESULT_IOERR_SERIAL : 0, self.TEST_RESULT_NO_IMAGE : 0, - self.TEST_RESULT_TIMEOUT : 0 + self.TEST_RESULT_TIMEOUT : 0, + self.TEST_RESULT_MBED_ASSERT : 0 } for test in test_summary: @@ -878,6 +881,11 @@ class SingleTestRunner(object): update_once_flag['timeout'] = True duration = int(auto_timeout_val) + # Detect mbed assert: + if 'mbed assertation failed: ' in line: + output.append('{{mbed_assert}}') + break + # Check for test end if '{end}' in line: break