From e046e0a2b2cc80afa38b4b2e921b7e26d7fffd52 Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Fri, 11 Aug 2017 10:03:55 +0200 Subject: [PATCH 1/3] mbedmicro-rtos-mbed tests : reduce memory consumption --- TESTS/mbedmicro-rtos-mbed/malloc/main.cpp | 2 +- TESTS/mbedmicro-rtos-mbed/threads/main.cpp | 34 +++++++++++----------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/TESTS/mbedmicro-rtos-mbed/malloc/main.cpp b/TESTS/mbedmicro-rtos-mbed/malloc/main.cpp index 8c4cae324f3..19d0afccb91 100644 --- a/TESTS/mbedmicro-rtos-mbed/malloc/main.cpp +++ b/TESTS/mbedmicro-rtos-mbed/malloc/main.cpp @@ -21,7 +21,7 @@ #error [NOT_SUPPORTED] test not supported #endif -#define NUM_THREADS 5 +#define NUM_THREADS 2 #if defined(__CORTEX_A9) #define THREAD_STACK_SIZE DEFAULT_STACK_SIZE diff --git a/TESTS/mbedmicro-rtos-mbed/threads/main.cpp b/TESTS/mbedmicro-rtos-mbed/threads/main.cpp index 1ece21524df..de88903a5d1 100644 --- a/TESTS/mbedmicro-rtos-mbed/threads/main.cpp +++ b/TESTS/mbedmicro-rtos-mbed/threads/main.cpp @@ -25,7 +25,7 @@ #error [NOT_SUPPORTED] test not supported #endif -#define THREAD_STACK_SIZE 768 +#define THREAD_STACK_SIZE 512 using namespace utest::v1; @@ -272,7 +272,7 @@ void signal_wait_multibit_tout() template void test_thread_signal() { - Thread t_wait; + Thread t_wait(osPriorityNormal, THREAD_STACK_SIZE); t_wait.start(callback(F)); @@ -308,7 +308,7 @@ void signal_clr() */ void test_thread_signal_clr() { - Thread t_wait; + Thread t_wait(osPriorityNormal, THREAD_STACK_SIZE); t_wait.start(callback(signal_clr)); @@ -412,7 +412,7 @@ void test_deleted_thread() */ void test_deleted() { - Thread t; + Thread t(osPriorityNormal, THREAD_STACK_SIZE); TEST_ASSERT_EQUAL(Thread::Deleted, t.get_state()); @@ -435,7 +435,7 @@ void test_delay_thread() */ void test_delay() { - Thread t; + Thread t(osPriorityNormal, THREAD_STACK_SIZE); t.start(callback(test_delay_thread)); @@ -460,7 +460,7 @@ void test_signal_thread() */ void test_signal() { - Thread t; + Thread t(osPriorityNormal, THREAD_STACK_SIZE); t.start(callback(test_signal_thread)); @@ -484,7 +484,7 @@ void test_evt_flag_thread(osEventFlagsId_t evtflg) */ void test_evt_flag() { - Thread t; + Thread t(osPriorityNormal, THREAD_STACK_SIZE); mbed_rtos_storage_event_flags_t evtflg_mem; osEventFlagsAttr_t evtflg_attr; osEventFlagsId_t evtflg; @@ -516,7 +516,7 @@ void test_mutex_thread(Mutex *mutex) */ void test_mutex() { - Thread t; + Thread t(osPriorityNormal, THREAD_STACK_SIZE); Mutex mutex; mutex.lock(); @@ -543,7 +543,7 @@ void test_semaphore_thread(Semaphore *sem) */ void test_semaphore() { - Thread t; + Thread t(osPriorityNormal, THREAD_STACK_SIZE); Semaphore sem; t.start(callback(test_semaphore_thread, &sem)); @@ -568,7 +568,7 @@ void test_msg_get_thread(Queue *queue) */ void test_msg_get() { - Thread t; + Thread t(osPriorityNormal, THREAD_STACK_SIZE); Queue queue; t.start(callback(test_msg_get_thread, &queue)); @@ -594,7 +594,7 @@ void test_msg_put_thread(Queue *queue) */ void test_msg_put() { - Thread t; + Thread t(osPriorityNormal, THREAD_STACK_SIZE); Queue queue; queue.put((int32_t *)0xE1EE7); @@ -642,7 +642,7 @@ void test_thread_ext_stack() { then priority is changed and can be retrieved using @a get_priority */ void test_thread_prio() { - Thread t(osPriorityNormal); + Thread t(osPriorityNormal, THREAD_STACK_SIZE); t.start(callback(thread_wait_signal)); TEST_ASSERT_EQUAL(osPriorityNormal, t.get_priority()); @@ -666,23 +666,23 @@ utest::v1::status_t test_setup(const size_t number_of_cases) { // macros don't play nicely with the templates (extra comma). static const case_t cases[] = { {"Testing single thread", test_single_thread, DEFAULT_HANDLERS}, - {"Testing parallel threads", test_parallel_threads<3, increment> , DEFAULT_HANDLERS}, + {"Testing parallel threads", test_parallel_threads<2, increment> , DEFAULT_HANDLERS}, {"Testing serial threads", test_serial_threads<10, increment> , DEFAULT_HANDLERS}, {"Testing single thread with yield", test_single_thread, DEFAULT_HANDLERS}, - {"Testing parallel threads with yield", test_parallel_threads<3, increment_with_yield>, DEFAULT_HANDLERS}, + {"Testing parallel threads with yield", test_parallel_threads<2, increment_with_yield>, DEFAULT_HANDLERS}, {"Testing serial threads with yield", test_serial_threads<10, increment_with_yield>, DEFAULT_HANDLERS}, {"Testing single thread with wait", test_single_thread, DEFAULT_HANDLERS}, - {"Testing parallel threads with wait", test_parallel_threads<3, increment_with_wait>, DEFAULT_HANDLERS}, + {"Testing parallel threads with wait", test_parallel_threads<2, increment_with_wait>, DEFAULT_HANDLERS}, {"Testing serial threads with wait", test_serial_threads<10, increment_with_wait>, DEFAULT_HANDLERS}, {"Testing single thread with child", test_single_thread, DEFAULT_HANDLERS}, - {"Testing parallel threads with child", test_parallel_threads<3, increment_with_child>, DEFAULT_HANDLERS}, + {"Testing parallel threads with child", test_parallel_threads<1, increment_with_child>, DEFAULT_HANDLERS}, {"Testing serial threads with child", test_serial_threads<10, increment_with_child>, DEFAULT_HANDLERS}, {"Testing single thread with murder", test_single_thread, DEFAULT_HANDLERS}, - {"Testing parallel threads with murder", test_parallel_threads<3, increment_with_murder>, DEFAULT_HANDLERS}, + {"Testing parallel threads with murder", test_parallel_threads<1, increment_with_murder>, DEFAULT_HANDLERS}, {"Testing serial threads with murder", test_serial_threads<10, increment_with_murder>, DEFAULT_HANDLERS}, {"Testing thread self terminate", test_self_terminate, DEFAULT_HANDLERS}, From 0ebcf6726f50f803bf0b665f3e2590c4106201f4 Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Wed, 6 Sep 2017 12:45:54 +0200 Subject: [PATCH 2/3] Malloc test update --- TESTS/mbedmicro-rtos-mbed/malloc/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TESTS/mbedmicro-rtos-mbed/malloc/main.cpp b/TESTS/mbedmicro-rtos-mbed/malloc/main.cpp index 19d0afccb91..5bac9259859 100644 --- a/TESTS/mbedmicro-rtos-mbed/malloc/main.cpp +++ b/TESTS/mbedmicro-rtos-mbed/malloc/main.cpp @@ -21,7 +21,7 @@ #error [NOT_SUPPORTED] test not supported #endif -#define NUM_THREADS 2 +#define NUM_THREADS 3 #if defined(__CORTEX_A9) #define THREAD_STACK_SIZE DEFAULT_STACK_SIZE @@ -55,8 +55,8 @@ void task_using_malloc(void) int main() { Thread *thread_list[NUM_THREADS]; - int test_time = 15; - GREENTEA_SETUP(20, "default_auto"); + int test_time = 30; + GREENTEA_SETUP(40, "default_auto"); // Allocate threads for the test for (int i = 0; i < NUM_THREADS; i++) { From 5248425cc63f6ae5c80ad77bee50c4f0688ed1ca Mon Sep 17 00:00:00 2001 From: jeromecoutant Date: Wed, 27 Sep 2017 14:14:51 +0200 Subject: [PATCH 3/3] threads test update --- TESTS/mbedmicro-rtos-mbed/threads/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TESTS/mbedmicro-rtos-mbed/threads/main.cpp b/TESTS/mbedmicro-rtos-mbed/threads/main.cpp index de88903a5d1..f5152aec8a6 100644 --- a/TESTS/mbedmicro-rtos-mbed/threads/main.cpp +++ b/TESTS/mbedmicro-rtos-mbed/threads/main.cpp @@ -25,7 +25,11 @@ #error [NOT_SUPPORTED] test not supported #endif +#if defined(TARGET_NUCLEO_F070RB) || defined(TARGET_NUCLEO_F072RB) #define THREAD_STACK_SIZE 512 +#else +#define THREAD_STACK_SIZE 768 +#endif using namespace utest::v1;