@@ -87,6 +87,19 @@ void release_sem(Semaphore *sem)
87
87
88
88
testcase_data current_case;
89
89
90
+ Thread wdg_kicking_thread (osPriorityNormal, 768 );
91
+ Semaphore kick_wdg_during_test_teardown (0 , 1 );
92
+
93
+ void wdg_kicking_thread_fun ()
94
+ {
95
+ kick_wdg_during_test_teardown.acquire ();
96
+ Watchdog &watchdog = Watchdog::get_instance ();
97
+ while (true ) {
98
+ watchdog.kick ();
99
+ wait_us (20000 );
100
+ }
101
+ }
102
+
90
103
bool send_reset_notification (testcase_data *tcdata, uint32_t delay_ms)
91
104
{
92
105
char msg_value[12 ];
@@ -124,7 +137,7 @@ void test_simple_reset()
124
137
125
138
// Watchdog reset should have occurred during wait_ms() above;
126
139
127
- watchdog. kick (); // Just to buy some time for testsuite failure handling.
140
+ kick_wdg_during_test_teardown. release (); // For testsuite failure handling.
128
141
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
129
142
}
130
143
@@ -161,7 +174,7 @@ void test_sleep_reset()
161
174
162
175
// Watchdog reset should have occurred during sem.wait() (sleep) above;
163
176
164
- watchdog. kick (); // Just to buy some time for testsuite failure handling.
177
+ kick_wdg_during_test_teardown. release (); // For testsuite failure handling.
165
178
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
166
179
}
167
180
@@ -196,7 +209,7 @@ void test_deepsleep_reset()
196
209
197
210
// Watchdog reset should have occurred during sem.wait() (deepsleep) above;
198
211
199
- watchdog. kick (); // Just to buy some time for testsuite failure handling.
212
+ kick_wdg_during_test_teardown. release (); // For testsuite failure handling.
200
213
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
201
214
}
202
215
#endif
@@ -241,7 +254,7 @@ void test_restart_reset()
241
254
242
255
// Watchdog reset should have occurred during that wait() above;
243
256
244
- watchdog. kick (); // Just to buy some time for testsuite failure handling.
257
+ kick_wdg_during_test_teardown. release (); // For testsuite failure handling.
245
258
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
246
259
}
247
260
@@ -274,7 +287,7 @@ void test_kick_reset()
274
287
275
288
// Watchdog reset should have occurred during that wait() above;
276
289
277
- watchdog. kick (); // Just to buy some time for testsuite failure handling.
290
+ kick_wdg_during_test_teardown. release (); // For testsuite failure handling.
278
291
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
279
292
}
280
293
@@ -309,6 +322,10 @@ int testsuite_setup(const size_t number_of_cases)
309
322
return utest::v1::STATUS_ABORT;
310
323
}
311
324
325
+ // The thread is started here, but feeding the watchdog will start
326
+ // when the semaphore is released during a test case teardown.
327
+ wdg_kicking_thread.start (mbed::callback (wdg_kicking_thread_fun));
328
+
312
329
utest_printf (" This test suite is composed of %i test cases. Starting at index %i.\n " , number_of_cases,
313
330
current_case.start_index );
314
331
return current_case.start_index ;
0 commit comments