Skip to content

Commit f21adc4

Browse files
committed
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.
1 parent 8185905 commit f21adc4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

features/frameworks/utest/source/utest_harness.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,12 @@ void Harness::raise_failure(const failure_reason_t reason)
167167
if (test_cases == NULL) return;
168168

169169
utest::v1::status_t fail_status = STATUS_ABORT;
170+
if (handlers.test_failure) handlers.test_failure(failure_t(reason, location));
171+
if (handlers.case_failure) fail_status = handlers.case_failure(case_current, failure_t(reason, location));
172+
170173
{
171174
UTEST_ENTER_CRITICAL_SECTION;
172175

173-
if (handlers.test_failure) handlers.test_failure(failure_t(reason, location));
174-
if (handlers.case_failure) fail_status = handlers.case_failure(case_current, failure_t(reason, location));
175176
if (fail_status != STATUS_IGNORE) case_failed++;
176177

177178
if ((fail_status == STATUS_ABORT) && case_timeout_handle)

0 commit comments

Comments
 (0)