Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 88191c27f -> a4aa979aa
Fix test fails due to duplicated prio in tasks Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/794572bf Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/794572bf Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/794572bf Branch: refs/heads/develop Commit: 794572bf473e1738327d87df6202bb441a15196c Parents: 0f1ec97 Author: Fabio Utzig <ut...@utzig.org> Authored: Thu Feb 9 20:24:15 2017 -0800 Committer: Fabio Utzig <ut...@utzig.org> Committed: Thu Feb 9 20:24:15 2017 -0800 ---------------------------------------------------------------------- kernel/os/test/src/callout_test.c | 14 +++++----- kernel/os/test/src/callout_test.h | 16 ++++++----- kernel/os/test/src/eventq_test.c | 8 ------ kernel/os/test/src/eventq_test.h | 28 +++++++++++--------- .../src/testcases/event_test_poll_single_sr.c | 11 -------- .../os/test/src/testcases/event_test_poll_sr.c | 11 -------- .../src/testcases/event_test_poll_timeout_sr.c | 11 -------- kernel/os/test/src/testcases/event_test_src.c | 11 -------- kernel/os/test/src/testcases/os_callout_test.c | 12 --------- .../test/src/testcases/os_callout_test_speak.c | 12 --------- .../test/src/testcases/os_callout_test_stop.c | 12 --------- .../test/src/testcases/flash_map_test_case_1.c | 4 --- .../test/src/testcases/flash_map_test_case_2.c | 4 --- 13 files changed, 30 insertions(+), 124 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/callout_test.c ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/callout_test.c b/kernel/os/test/src/callout_test.c index ff15357..d6ba912 100644 --- a/kernel/os/test/src/callout_test.c +++ b/kernel/os/test/src/callout_test.c @@ -131,10 +131,9 @@ callout_task_receive(void *arg) tm = os_callout_wakeup_ticks(now); TEST_ASSERT(tm == OS_TIMEOUT_NEVER); OS_EXIT_CRITICAL(sr); - + /* Finishes the test when OS has been started */ os_test_restart(); - } /* This is callout to send the stop_callout */ @@ -142,14 +141,13 @@ void callout_task_stop_send(void *arg) { int k; - int j; + int j; /* Should say whether callout is armed or not */ for(k = 0; k<MULTI_SIZE; k++){ j = os_callout_queued(&callout_stop_test[k]); TEST_ASSERT(j == 0); } - /* Show that callout is not armed after calling callout_stop */ for(k = 0; k<MULTI_SIZE; k++){ os_callout_stop(&callout_stop_test[k]); @@ -181,12 +179,12 @@ callout_task_stop_receive(void *arg) } - + /* Show that event is removed from the queued after calling callout_stop */ for(k=0; k<MULTI_SIZE; k++){ os_callout_stop(&callout_stop_test[k]); /* Testing that the event has been removed from queue */ - TEST_ASSERT_FATAL(1); + TEST_ASSERT_FATAL(1); } /* Finishes the test when OS has been started */ os_test_restart(); @@ -207,7 +205,7 @@ callout_task_stop_speak(void *arg) TEST_ASSERT(i == 1); os_callout_stop(&callout_speak); - + /* Send the callout */ os_time_delay(OS_TICKS_PER_SEC/ 100 ); /* Finishes the test when OS has been started */ @@ -232,7 +230,7 @@ TEST_CASE_DECL(callout_test_stop) TEST_CASE_DECL(callout_test) TEST_SUITE(os_callout_test_suite) -{ +{ callout_test(); callout_test_stop(); callout_test_speak(); http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/callout_test.h ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/callout_test.h b/kernel/os/test/src/callout_test.h index 494251d..4a6de9e 100644 --- a/kernel/os/test/src/callout_test.h +++ b/kernel/os/test/src/callout_test.h @@ -28,13 +28,15 @@ extern "C" { #endif +#define INITIAL_CALLOUT_TASK_PRIO (20) + /* Task 1 for sending */ -#define CALLOUT_STACK_SIZE (5120) -#define SEND_CALLOUT_TASK_PRIO (1) +#define CALLOUT_STACK_SIZE (5120) +#define SEND_CALLOUT_TASK_PRIO (INITIAL_CALLOUT_TASK_PRIO + 0) extern struct os_task callout_task_struct_send; extern os_stack_t callout_task_stack_send[CALLOUT_STACK_SIZE]; -#define RECEIVE_CALLOUT_TASK_PRIO (2) +#define RECEIVE_CALLOUT_TASK_PRIO (INITIAL_CALLOUT_TASK_PRIO + 1) extern struct os_task callout_task_struct_receive; extern os_stack_t callout_task_stack_receive[CALLOUT_STACK_SIZE]; @@ -43,11 +45,11 @@ extern struct os_eventq callout_evq; extern struct os_event callout_ev; /* The callout_stop task */ -#define SEND_STOP_CALLOUT_TASK_PRIO (3) +#define SEND_STOP_CALLOUT_TASK_PRIO (INITIAL_CALLOUT_TASK_PRIO + 2) extern struct os_task callout_task_struct_stop_send; extern os_stack_t callout_task_stack_stop_send[CALLOUT_STACK_SIZE]; -#define RECEIVE_STOP_CALLOUT_TASK_PRIO (4) +#define RECEIVE_STOP_CALLOUT_TASK_PRIO (INITIAL_CALLOUT_TASK_PRIO + 3) extern struct os_task callout_task_struct_stop_receive; extern os_stack_t callout_task_stack_stop_receive[CALLOUT_STACK_SIZE]; @@ -60,12 +62,12 @@ extern struct os_eventq callout_stop_evq[MULTI_SIZE]; extern struct os_event callout_stop_ev; /* Declearing varables for callout_speak */ -#define SPEAK_CALLOUT_TASK_PRIO (5) +#define SPEAK_CALLOUT_TASK_PRIO (INITIAL_CALLOUT_TASK_PRIO + 4) extern struct os_task callout_task_struct_speak; extern os_stack_t callout_task_stack_speak[CALLOUT_STACK_SIZE]; /* Declearing varaibles for listen */ -#define LISTEN_CALLOUT_TASK_PRIO (6) +#define LISTEN_CALLOUT_TASK_PRIO (INITIAL_CALLOUT_TASK_PRIO + 5) extern struct os_task callout_task_struct_listen; extern os_stack_t callout_task_stack_listen[CALLOUT_STACK_SIZE]; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/eventq_test.c ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/eventq_test.c b/kernel/os/test/src/eventq_test.c index a48546d..b716bd6 100644 --- a/kernel/os/test/src/eventq_test.c +++ b/kernel/os/test/src/eventq_test.c @@ -26,12 +26,10 @@ /* Task 1 sending task */ /* Define task stack and task object */ -#define SEND_TASK_PRIO (1) struct os_task eventq_task_s; os_stack_t eventq_task_stack_s[MY_STACK_SIZE]; /* Task 2 receiving task */ -#define RECEIVE_TASK_PRIO (2) struct os_task eventq_task_r; os_stack_t eventq_task_stack_r[MY_STACK_SIZE]; @@ -50,34 +48,28 @@ uint8_t my_event_type = 1; /* Setting up data for the poll */ /* Define the task stack for the eventq_task_poll_send */ -#define SEND_TASK_POLL_PRIO (3) struct os_task eventq_task_poll_s; os_stack_t eventq_task_stack_poll_s[POLL_STACK_SIZE]; /* Define the task stack for the eventq_task_poll_receive */ -#define RECEIVE_TASK_POLL_PRIO (4) struct os_task eventq_task_poll_r; os_stack_t eventq_task_stack_poll_r[POLL_STACK_SIZE ]; /* Setting the data for the poll timeout */ /* Define the task stack for the eventq_task_poll_timeout_send */ -#define SEND_TASK_POLL_TIMEOUT_PRIO (5) struct os_task eventq_task_poll_timeout_s; os_stack_t eventq_task_stack_poll_timeout_s[POLL_STACK_SIZE]; /* Define the task stack for the eventq_task_poll_receive */ -#define RECEIVE_TASK_POLL_TIMEOUT_PRIO (6) struct os_task eventq_task_poll_timeout_r; os_stack_t eventq_task_stack_poll_timeout_r[POLL_STACK_SIZE]; /* Setting the data for the poll single */ /* Define the task stack for the eventq_task_poll_single_send */ -#define SEND_TASK_POLL_SINGLE_PRIO (7) struct os_task eventq_task_poll_single_s; os_stack_t eventq_task_stack_poll_single_s[POLL_STACK_SIZE]; /* Define the task stack for the eventq_task_poll_single_receive */ -#define RECEIVE_TASK_POLL_SINGLE_PRIO (8) struct os_task eventq_task_poll_single_r; os_stack_t eventq_task_stack_poll_single_r[POLL_STACK_SIZE]; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/eventq_test.h ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/eventq_test.h b/kernel/os/test/src/eventq_test.h index 32c3377..7fea3a2 100644 --- a/kernel/os/test/src/eventq_test.h +++ b/kernel/os/test/src/eventq_test.h @@ -31,27 +31,29 @@ #endif #if MYNEWT_VAL(SELFTEST) -#define MY_STACK_SIZE (5120) -#define POLL_STACK_SIZE (4096) +#define MY_STACK_SIZE (5120) +#define POLL_STACK_SIZE (4096) #else -#define MY_STACK_SIZE (128) -#define POLL_STACK_SIZE (32) /* for now */ +#define MY_STACK_SIZE (128) +#define POLL_STACK_SIZE (32) /* for now */ #endif +#define INITIAL_EVENTQ_TASK_PRIO (10) + /* Task 1 sending task */ /* Define task stack and task object */ -#define SEND_TASK_PRIO (1) +#define SEND_TASK_PRIO (INITIAL_EVENTQ_TASK_PRIO + 1) extern struct os_task eventq_task_s; extern os_stack_t eventq_task_stack_s[MY_STACK_SIZE]; /* Task 2 receiving task */ -#define RECEIVE_TASK_PRIO (2) +#define RECEIVE_TASK_PRIO (INITIAL_EVENTQ_TASK_PRIO + 2) extern struct os_task eventq_task_r; extern os_stack_t eventq_task_stack_r[MY_STACK_SIZE]; extern struct os_eventq my_eventq; -#define SIZE_MULTI_EVENT (4) +#define SIZE_MULTI_EVENT (4) extern struct os_eventq multi_eventq[SIZE_MULTI_EVENT]; /* This is to set the events we will use below */ @@ -63,34 +65,34 @@ extern uint8_t my_event_type; /* Setting up data for the poll */ /* Define the task stack for the eventq_task_poll_send */ -#define SEND_TASK_POLL_PRIO (3) +#define SEND_TASK_POLL_PRIO (INITIAL_EVENTQ_TASK_PRIO + 3) extern struct os_task eventq_task_poll_s; extern os_stack_t eventq_task_stack_poll_s[POLL_STACK_SIZE]; /* Define the task stack for the eventq_task_poll_receive */ -#define RECEIVE_TASK_POLL_PRIO (4) +#define RECEIVE_TASK_POLL_PRIO (INITIAL_EVENTQ_TASK_PRIO + 4) extern struct os_task eventq_task_poll_r; extern os_stack_t eventq_task_stack_poll_r[POLL_STACK_SIZE ]; /* Setting the data for the poll timeout */ /* Define the task stack for the eventq_task_poll_timeout_send */ -#define SEND_TASK_POLL_TIMEOUT_PRIO (5) +#define SEND_TASK_POLL_TIMEOUT_PRIO (INITIAL_EVENTQ_TASK_PRIO + 5) extern struct os_task eventq_task_poll_timeout_s; extern os_stack_t eventq_task_stack_poll_timeout_s[POLL_STACK_SIZE]; /* Define the task stack for the eventq_task_poll_receive */ -#define RECEIVE_TASK_POLL_TIMEOUT_PRIO (6) +#define RECEIVE_TASK_POLL_TIMEOUT_PRIO (INITIAL_EVENTQ_TASK_PRIO + 6) extern struct os_task eventq_task_poll_timeout_r; extern os_stack_t eventq_task_stack_poll_timeout_r[POLL_STACK_SIZE]; /* Setting the data for the poll single */ /* Define the task stack for the eventq_task_poll_single_send */ -#define SEND_TASK_POLL_SINGLE_PRIO (7) +#define SEND_TASK_POLL_SINGLE_PRIO (INITIAL_EVENTQ_TASK_PRIO + 7) extern struct os_task eventq_task_poll_single_s; extern os_stack_t eventq_task_stack_poll_single_s[POLL_STACK_SIZE]; /* Define the task stack for the eventq_task_poll_single_receive */ -#define RECEIVE_TASK_POLL_SINGLE_PRIO (8) +#define RECEIVE_TASK_POLL_SINGLE_PRIO (INITIAL_EVENTQ_TASK_PRIO + 8) extern struct os_task eventq_task_poll_single_r; extern os_stack_t eventq_task_stack_poll_single_r[POLL_STACK_SIZE]; http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/testcases/event_test_poll_single_sr.c ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/testcases/event_test_poll_single_sr.c b/kernel/os/test/src/testcases/event_test_poll_single_sr.c index 416528b..50a28b4 100644 --- a/kernel/os/test/src/testcases/event_test_poll_single_sr.c +++ b/kernel/os/test/src/testcases/event_test_poll_single_sr.c @@ -24,11 +24,6 @@ TEST_CASE(event_test_poll_single_sr) { int i; -#if MYNEWT_VAL(SELFTEST) - /* Initializing the OS */ - os_init(NULL); - sysinit(); -#endif /* Initialize the task */ os_task_init(&eventq_task_poll_single_s, "eventq_task_poll_single_s", eventq_task_poll_single_send, NULL, SEND_TASK_POLL_SINGLE_PRIO, @@ -44,10 +39,4 @@ TEST_CASE(event_test_poll_single_sr) m_event[i].ev_arg = (void *)(intptr_t)(10 * i); } - -#if MYNEWT_VAL(SELFTEST) - /* Does not return until OS_restart is called */ - os_start(); -#endif - } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/testcases/event_test_poll_sr.c ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/testcases/event_test_poll_sr.c b/kernel/os/test/src/testcases/event_test_poll_sr.c index e3dfbf6..eba2763 100644 --- a/kernel/os/test/src/testcases/event_test_poll_sr.c +++ b/kernel/os/test/src/testcases/event_test_poll_sr.c @@ -23,11 +23,6 @@ TEST_CASE(event_test_poll_sr) { int i; -#if MYNEWT_VAL(SELFTEST) - /* Initializing the OS */ - os_init(NULL); - sysinit(); -#endif /* Initialize the task */ os_task_init(&eventq_task_poll_s, "eventq_task_poll_s", eventq_task_poll_send, NULL, SEND_TASK_POLL_PRIO, OS_WAIT_FOREVER, eventq_task_stack_poll_s, @@ -42,10 +37,4 @@ TEST_CASE(event_test_poll_sr) for (i = 0; i < SIZE_MULTI_EVENT; i++){ os_eventq_init(&multi_eventq[i]); } - -#if MYNEWT_VAL(SELFTEST) - /* Does not return until OS_restart is called */ - os_start(); -#endif - } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/testcases/event_test_poll_timeout_sr.c ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/testcases/event_test_poll_timeout_sr.c b/kernel/os/test/src/testcases/event_test_poll_timeout_sr.c index be92879..541cfcf 100644 --- a/kernel/os/test/src/testcases/event_test_poll_timeout_sr.c +++ b/kernel/os/test/src/testcases/event_test_poll_timeout_sr.c @@ -23,11 +23,6 @@ TEST_CASE(event_test_poll_timeout_sr) { int i; -#if MYNEWT_VAL(SELFTEST) - /* Initializing the OS */ - os_init(NULL); - sysinit(); -#endif /* Initialize the task */ os_task_init(&eventq_task_poll_timeout_s, "eventq_task_poll_timeout_s", eventq_task_poll_timeout_send, NULL, SEND_TASK_POLL_TIMEOUT_PRIO, @@ -44,10 +39,4 @@ TEST_CASE(event_test_poll_timeout_sr) m_event[i].ev_arg = NULL; } - -#if MYNEWT_VAL(SELFTEST) - /* Does not return until OS_restart is called */ - os_start(); -#endif - } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/testcases/event_test_src.c ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/testcases/event_test_src.c b/kernel/os/test/src/testcases/event_test_src.c index 76231c5..605fcb2 100644 --- a/kernel/os/test/src/testcases/event_test_src.c +++ b/kernel/os/test/src/testcases/event_test_src.c @@ -22,11 +22,6 @@ TEST_CASE(event_test_sr) { int i; -#if MYNEWT_VAL(SELFTEST) - /* Initializing the OS */ - os_init(NULL); - sysinit(); -#endif /* Initialize the task */ os_task_init(&eventq_task_s, "eventq_task_s", eventq_task_send, NULL, SEND_TASK_PRIO, OS_WAIT_FOREVER, eventq_task_stack_s, MY_STACK_SIZE); @@ -41,10 +36,4 @@ TEST_CASE(event_test_sr) for (i = 0; i < SIZE_MULTI_EVENT; i++){ os_eventq_init(&multi_eventq[i]); } - -#if MYNEWT_VAL(SELFTEST) - /* Does not return until OS_restart is called */ - os_start(); -#endif - } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/testcases/os_callout_test.c ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/testcases/os_callout_test.c b/kernel/os/test/src/testcases/os_callout_test.c index 5354a1d..1f791dc 100644 --- a/kernel/os/test/src/testcases/os_callout_test.c +++ b/kernel/os/test/src/testcases/os_callout_test.c @@ -21,13 +21,6 @@ /* Test case to test the basics of the callout */ TEST_CASE(callout_test) { - -#if MYNEWT_VAL(SELFTEST) - /* Initializing the OS */ - os_init(NULL); - sysinit(); -#endif - /* Initialize the sending task */ os_task_init(&callout_task_struct_send, "callout_task_send", callout_task_send, NULL, SEND_CALLOUT_TASK_PRIO, OS_WAIT_FOREVER, @@ -42,9 +35,4 @@ TEST_CASE(callout_test) /* Initialize the callout function */ os_callout_init(&callout_test_c, &callout_evq, my_callout, NULL); - -#if MYNEWT_VAL(SELFTEST) - /* Does not return until OS_restart is called */ - os_start(); -#endif } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/testcases/os_callout_test_speak.c ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/testcases/os_callout_test_speak.c b/kernel/os/test/src/testcases/os_callout_test_speak.c index bdd647b..1ce7634 100644 --- a/kernel/os/test/src/testcases/os_callout_test_speak.c +++ b/kernel/os/test/src/testcases/os_callout_test_speak.c @@ -21,13 +21,6 @@ /* Test case to test case for speak and listen */ TEST_CASE(callout_test_speak) { - -#if MYNEWT_VAL(SELFTEST) - /* Initializing the OS */ - os_init(NULL); - sysinit(); -#endif - /* Initialize the sending task */ os_task_init(&callout_task_struct_speak, "callout_task_speak", callout_task_stop_speak, NULL, SPEAK_CALLOUT_TASK_PRIO, @@ -43,9 +36,4 @@ TEST_CASE(callout_test_speak) /* Initialize the callout function */ os_callout_init(&callout_speak, &callout_evq, my_callout_speak_func, NULL); - -#if MYNEWT_VAL(SELFTEST) - /* Does not return until OS_restart is called */ - os_start(); -#endif } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/kernel/os/test/src/testcases/os_callout_test_stop.c ---------------------------------------------------------------------- diff --git a/kernel/os/test/src/testcases/os_callout_test_stop.c b/kernel/os/test/src/testcases/os_callout_test_stop.c index 98ba7e4..6497d13 100644 --- a/kernel/os/test/src/testcases/os_callout_test_stop.c +++ b/kernel/os/test/src/testcases/os_callout_test_stop.c @@ -23,12 +23,6 @@ TEST_CASE(callout_test_stop) { int k; -#if MYNEWT_VAL(SELFTEST) - /* Initializing the OS */ - os_init(NULL); - sysinit(); -#endif - /* Initialize the sending task */ os_task_init(&callout_task_struct_stop_send, "callout_task_stop_send", callout_task_stop_send, NULL, SEND_STOP_CALLOUT_TASK_PRIO, @@ -49,10 +43,4 @@ TEST_CASE(callout_test_stop) os_callout_init(&callout_stop_test[k], &callout_stop_evq[k], my_callout_stop_func, NULL); } - -#if MYNEWT_VAL(SELFTEST) - /* Does not return until OS_restart is called */ - os_start(); -#endif - } http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/sys/flash_map/test/src/testcases/flash_map_test_case_1.c ---------------------------------------------------------------------- diff --git a/sys/flash_map/test/src/testcases/flash_map_test_case_1.c b/sys/flash_map/test/src/testcases/flash_map_test_case_1.c index b4a7f79..883fba0 100644 --- a/sys/flash_map/test/src/testcases/flash_map_test_case_1.c +++ b/sys/flash_map/test/src/testcases/flash_map_test_case_1.c @@ -33,10 +33,6 @@ TEST_CASE(flash_map_test_case_1) int sect_cnt; uint32_t end; -#if MYNEWT_VAL(SELFTEST) - sysinit(); -#endif - for (i = 0; i < flash_map_entries; i++) { rc = flash_area_open(i, &fa); if (rc) { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/794572bf/sys/flash_map/test/src/testcases/flash_map_test_case_2.c ---------------------------------------------------------------------- diff --git a/sys/flash_map/test/src/testcases/flash_map_test_case_2.c b/sys/flash_map/test/src/testcases/flash_map_test_case_2.c index 412c320..ef978b7 100644 --- a/sys/flash_map/test/src/testcases/flash_map_test_case_2.c +++ b/sys/flash_map/test/src/testcases/flash_map_test_case_2.c @@ -33,10 +33,6 @@ TEST_CASE(flash_map_test_case_2) uint8_t wd[256]; uint8_t rd[256]; -#if MYNEWT_VAL(SELFTEST) - sysinit(); -#endif - rc = flash_area_open(FLASH_AREA_IMAGE_0, &fa); TEST_ASSERT_FATAL(rc == 0, "flash_area_open() fail");