test: msgq: imporve test coverage for message queue
Add code to wake up a thread waiting for message on a message queue. Signed-off-by: Meng xianglin <xianglinx.meng@intel.com>
This commit is contained in:
parent
f70efbcd9b
commit
912914a915
2 changed files with 8 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_IRQ_OFFLOAD=y
|
||||
CONFIG_TEST_USERSPACE=y
|
||||
CONFIG_OBJECT_TRACING=y
|
||||
|
|
|
@ -399,6 +399,13 @@ void test_msgq_empty(void)
|
|||
k_sem_take(&end_sema, K_FOREVER);
|
||||
/* that getting thread is being blocked now */
|
||||
zassert_equal(tid->base.thread_state, _THREAD_PENDING, NULL);
|
||||
/* since there is a thread is waiting for message, this queue
|
||||
* can't be cleanup
|
||||
*/
|
||||
ret = k_msgq_cleanup(&msgq1);
|
||||
zassert_equal(ret, -EBUSY, NULL);
|
||||
/* put a message to wake that getting thread */
|
||||
k_msgq_put(&msgq1, &data[0], K_NO_WAIT);
|
||||
k_thread_abort(tid);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue