diff --git a/readme.txt b/readme.txt index a272b62d2..dc89f5fe6 100644 --- a/readme.txt +++ b/readme.txt @@ -89,6 +89,7 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process, collide with external libraries. - Added a benchmark to the test suit that measures the mass reschedulation performance. +- Added a test_terminate_threads() function to the test framework. - Made the Cortex-M3 port preemption code more readable. *** 0.6.8 *** diff --git a/test/test.c b/test/test.c index 3f2cc9514..2c180ba4b 100644 --- a/test/test.c +++ b/test/test.c @@ -148,6 +148,14 @@ void test_assert_time_window(systime_t start, systime_t end) { /* * Threads utils. */ +void test_terminate_threads(void) { + int i; + + for (i = 0; i < MAX_THREADS; i++) + if (threads[i]) + chThdTerminate(threads[i]); +} + void test_wait_threads(void) { int i; diff --git a/test/test.h b/test/test.h index 7a2e86f0b..3bee948cd 100644 --- a/test/test.h +++ b/test/test.h @@ -50,6 +50,7 @@ extern "C" { void test_assert(bool_t condition, char * msg); void test_assert_sequence(char *expected); void test_assert_time_window(systime_t start, systime_t end); + void test_terminate_threads(void); void test_wait_threads(void); systime_t test_wait_tick(void); void test_cpu_pulse(systime_t ms); diff --git a/test/testbmk.c b/test/testbmk.c index f2fcb94dc..acdfa50e8 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -236,11 +236,7 @@ static void bmk6_execute(void) { ChkIntSources(); #endif } while (!test_timer_done); - chThdTerminate(threads[0]); - chThdTerminate(threads[1]); - chThdTerminate(threads[2]); - chThdTerminate(threads[3]); - chThdTerminate(threads[4]); + test_terminate_threads(); chSemReset(&sem1, 0); test_wait_threads();