@@ -77,25 +77,6 @@ void sem_callback(Semaphore *sem)
77
77
sem->release ();
78
78
}
79
79
80
- /* In order to successfully run this test suite when compiled with --profile=debug
81
- * error() has to be redefined as noop.
82
- *
83
- * RtosTimer calls RTX API which uses Event Recorder functionality. When compiled
84
- * with MBED_TRAP_ERRORS_ENABLED=1 (set in debug profile) EvrRtxTimerError() calls error()
85
- * which aborts test program.
86
- */
87
- #if defined(MBED_TRAP_ERRORS_ENABLED) && MBED_TRAP_ERRORS_ENABLED
88
- void error (const char *format, ...)
89
- {
90
- (void ) format;
91
- }
92
-
93
- mbed_error_status_t mbed_error (mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number)
94
- {
95
- return MBED_SUCCESS;
96
- }
97
- #endif
98
-
99
80
/* * Test one-shot not restarted when elapsed
100
81
*
101
82
* Given a one-shot RtosTimer
@@ -121,8 +102,11 @@ void test_oneshot_not_restarted()
121
102
122
103
slots = stopwatch.wait_until_stopped (DELAY_MS + DELTA_MS);
123
104
TEST_ASSERT_EQUAL (0 , slots);
105
+
106
+ #if !MBED_TRAP_ERRORS_ENABLED
124
107
status = rtostimer.stop ();
125
108
TEST_ASSERT_EQUAL (osErrorResource, status);
109
+ #endif
126
110
}
127
111
128
112
/* * Test periodic repeats continuously
@@ -160,8 +144,11 @@ void test_periodic_repeats()
160
144
161
145
slots = stopwatch.wait_until_stopped (DELAY_MS + DELTA_MS);
162
146
TEST_ASSERT_EQUAL (0 , slots);
147
+
148
+ #if !MBED_TRAP_ERRORS_ENABLED
163
149
status = rtostimer.stop ();
164
150
TEST_ASSERT_EQUAL (osErrorResource, status);
151
+ #endif
165
152
}
166
153
167
154
/* * Test timer can be started again
@@ -185,17 +172,21 @@ void test_start_again()
185
172
int32_t slots = sem.wait (DELAY_MS + DELTA_MS);
186
173
TEST_ASSERT_EQUAL (1 , slots);
187
174
175
+ #if !MBED_TRAP_ERRORS_ENABLED
188
176
status = rtostimer.stop ();
189
177
TEST_ASSERT_EQUAL (osErrorResource, status);
178
+ #endif
190
179
191
180
status = rtostimer.start (DELAY_MS);
192
181
TEST_ASSERT_EQUAL (osOK, status);
193
182
194
183
slots = sem.wait (DELAY_MS + DELTA_MS);
195
184
TEST_ASSERT_EQUAL (1 , slots);
196
185
186
+ #if !MBED_TRAP_ERRORS_ENABLED
197
187
status = rtostimer.stop ();
198
188
TEST_ASSERT_EQUAL (osErrorResource, status);
189
+ #endif
199
190
}
200
191
201
192
/* * Test timer restart updates delay
@@ -228,8 +219,10 @@ void test_restart_updates_delay()
228
219
TEST_ASSERT_EQUAL (1 , slots);
229
220
TEST_ASSERT_INT_WITHIN (DELTA_MS, DELAY2_MS, stopwatch.read_ms ());
230
221
222
+ #if !MBED_TRAP_ERRORS_ENABLED
231
223
status = rtostimer.stop ();
232
224
TEST_ASSERT_EQUAL (osErrorResource, status);
225
+ #endif
233
226
}
234
227
235
228
/* * Test timer is created in stopped state
@@ -241,8 +234,10 @@ void test_restart_updates_delay()
241
234
void test_created_stopped ()
242
235
{
243
236
RtosTimer rtostimer (mbed::callback (sem_callback, (Semaphore *) NULL ), osTimerOnce);
237
+ #if !MBED_TRAP_ERRORS_ENABLED
244
238
osStatus status = rtostimer.stop ();
245
239
TEST_ASSERT_EQUAL (osErrorResource, status);
240
+ #endif
246
241
}
247
242
248
243
/* * Test one-shot can be stopped
@@ -269,8 +264,10 @@ void test_stop()
269
264
slots = sem.wait (DELAY_MS + DELTA_MS);
270
265
TEST_ASSERT_EQUAL (0 , slots);
271
266
267
+ #if !MBED_TRAP_ERRORS_ENABLED
272
268
status = rtostimer.stop ();
273
269
TEST_ASSERT_EQUAL (osErrorResource, status);
270
+ #endif
274
271
}
275
272
276
273
/* * Test timer started with infinite delay
@@ -290,6 +287,7 @@ void test_wait_forever()
290
287
TEST_ASSERT_EQUAL (osOK, status);
291
288
}
292
289
290
+ #if !MBED_TRAP_ERRORS_ENABLED
293
291
/* * Test timer started with zero delay
294
292
*
295
293
* Given a one-shot RtosTimer
@@ -331,6 +329,7 @@ void test_isr_calls_fail()
331
329
332
330
wait_ms (DELAY_MS + DELTA_MS);
333
331
}
332
+ #endif // !MBED_TRAP_ERRORS_ENABLED
334
333
335
334
utest::v1::status_t test_setup (const size_t number_of_cases)
336
335
{
@@ -346,8 +345,10 @@ Case cases[] = {
346
345
Case (" Timer can be stopped" , test_stop),
347
346
Case (" Timer is created in stopped state" , test_created_stopped),
348
347
Case (" Timer started with infinite delay" , test_wait_forever),
348
+ #if !MBED_TRAP_ERRORS_ENABLED
349
349
Case (" Timer started with zero delay" , test_no_wait),
350
350
Case (" Calls from ISR fail" , test_isr_calls_fail)
351
+ #endif
351
352
};
352
353
353
354
Specification specification (test_setup, cases);
0 commit comments