From f21adc4ad165841fe6316ae8d561fe4ae4b97308 Mon Sep 17 00:00:00 2001 From: Russ Butler Date: Fri, 19 Aug 2016 11:54:46 -0500 Subject: [PATCH] Move utest handlers out of critical section In the function raise_failure move the test_failure and case_failure calls out of the critical section. This allows these handlers to run without interrupts disabled and enables them to use rtos features such as a mutex. This is required for heap metrics to work. --- features/frameworks/utest/source/utest_harness.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/features/frameworks/utest/source/utest_harness.cpp b/features/frameworks/utest/source/utest_harness.cpp index 4246d59726..a796c020f0 100644 --- a/features/frameworks/utest/source/utest_harness.cpp +++ b/features/frameworks/utest/source/utest_harness.cpp @@ -167,11 +167,12 @@ void Harness::raise_failure(const failure_reason_t reason) if (test_cases == NULL) return; utest::v1::status_t fail_status = STATUS_ABORT; + if (handlers.test_failure) handlers.test_failure(failure_t(reason, location)); + if (handlers.case_failure) fail_status = handlers.case_failure(case_current, failure_t(reason, location)); + { UTEST_ENTER_CRITICAL_SECTION; - if (handlers.test_failure) handlers.test_failure(failure_t(reason, location)); - if (handlers.case_failure) fail_status = handlers.case_failure(case_current, failure_t(reason, location)); if (fail_status != STATUS_IGNORE) case_failed++; if ((fail_status == STATUS_ABORT) && case_timeout_handle)