@@ -139,7 +139,7 @@ void Harness::raise_failure(const failure_reason_t reason)
139
139
140
140
status_t fail_status = STATUS_ABORT;
141
141
{
142
- mbed::util::CriticalSectionLock lock ;
142
+ UTEST_ENTER_CRITICAL_SECTION ;
143
143
144
144
if (handlers.test_failure ) handlers.test_failure (failure_t (reason, location));
145
145
if (handlers.case_failure ) fail_status = handlers.case_failure (case_current, failure_t (reason, location));
@@ -150,6 +150,7 @@ void Harness::raise_failure(const failure_reason_t reason)
150
150
scheduler.cancel (case_timeout_handle);
151
151
case_timeout_handle = NULL ;
152
152
}
153
+ UTEST_LEAVE_CRITICAL_SECTION;
153
154
}
154
155
155
156
if (fail_status == STATUS_ABORT || reason & REASON_CASE_SETUP) {
@@ -212,12 +213,13 @@ void Harness::schedule_next_case()
212
213
void Harness::handle_timeout ()
213
214
{
214
215
{
215
- mbed::util::CriticalSectionLock lock ;
216
+ UTEST_ENTER_CRITICAL_SECTION ;
216
217
217
218
if (case_timeout_handle != NULL ) {
218
219
case_timeout_handle = NULL ;
219
220
case_timeout_occurred = true ;
220
221
}
222
+ UTEST_LEAVE_CRITICAL_SECTION;
221
223
}
222
224
if (case_timeout_occurred) {
223
225
raise_failure (failure_reason_t (REASON_TIMEOUT | ((case_control.repeat & REPEAT_ON_TIMEOUT) ? REASON_IGNORE : 0 )));
@@ -227,7 +229,7 @@ void Harness::handle_timeout()
227
229
228
230
void Harness::validate_callback (const control_t control)
229
231
{
230
- mbed::util::CriticalSectionLock lock ;
232
+ UTEST_ENTER_CRITICAL_SECTION ;
231
233
case_validation_count++;
232
234
233
235
if (case_timeout_handle != NULL || case_control.timeout == TIMEOUT_FOREVER)
@@ -239,15 +241,18 @@ void Harness::validate_callback(const control_t control)
239
241
case_control.timeout = TIMEOUT_NONE;
240
242
scheduler.post (schedule_next_case, 0 );
241
243
}
244
+ UTEST_LEAVE_CRITICAL_SECTION;
242
245
}
243
246
244
247
bool Harness::is_busy ()
245
248
{
246
- mbed::util::CriticalSectionLock lock ;
249
+ UTEST_ENTER_CRITICAL_SECTION ;
247
250
if (!test_cases) return false ;
248
251
if (!case_current) return false ;
249
252
250
- return (case_current < (test_cases + test_length));
253
+ bool res = (case_current < (test_cases + test_length));
254
+ UTEST_LEAVE_CRITICAL_SECTION;
255
+ return res;
251
256
}
252
257
253
258
void Harness::run_next_case ()
@@ -267,11 +272,12 @@ void Harness::run_next_case()
267
272
268
273
repeat_t setup_repeat;
269
274
{
270
- mbed::util::CriticalSectionLock lock ;
275
+ UTEST_ENTER_CRITICAL_SECTION ;
271
276
case_validation_count = 0 ;
272
277
case_timeout_occurred = false ;
273
278
setup_repeat = case_control.repeat ;
274
279
case_control = control_t ();
280
+ UTEST_LEAVE_CRITICAL_SECTION;
275
281
}
276
282
277
283
if (setup_repeat & REPEAT_SETUP_TEARDOWN) {
@@ -296,7 +302,7 @@ void Harness::run_next_case()
296
302
case_repeat_count++;
297
303
298
304
{
299
- mbed::util::CriticalSectionLock lock ;
305
+ UTEST_ENTER_CRITICAL_SECTION ;
300
306
if (case_validation_count) case_control.repeat = repeat_t (case_control.repeat & ~REPEAT_ON_TIMEOUT);
301
307
302
308
// if timeout valid
@@ -313,6 +319,7 @@ void Harness::run_next_case()
313
319
else {
314
320
scheduler.post (schedule_next_case, 0 );
315
321
}
322
+ UTEST_LEAVE_CRITICAL_SECTION;
316
323
}
317
324
}
318
325
else if (handlers.test_teardown ) {
0 commit comments