MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / testcase

Function testcase

components/drivers/ipc/utest/completion_tc.c:156–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156static void testcase(void)
157{
158 /* Initialize completion object */
159 rt_completion_init(&_prod_completion);
160 rt_completion_init(&_cons_completion);
161
162 /* Create producer and consumer threads */
163 rt_thread_t producer_thread =
164 rt_thread_create("producer", producer_thread_entry, RT_NULL,
165 UTEST_THR_STACK_SIZE, UTEST_THR_PRIORITY, 100);
166 rt_thread_t consumer_thread =
167 rt_thread_create("consumer", consumer_thread_entry, producer_thread,
168 UTEST_THR_STACK_SIZE, UTEST_THR_PRIORITY, 100);
169 uassert_true(producer_thread != RT_NULL);
170 uassert_true(consumer_thread != RT_NULL);
171
172 LOG_I("Summary:\n"
173 "\tTest times: %ds(%d)",
174 TEST_LOOP_TIMES / RT_TICK_PER_SECOND, TEST_LOOP_TIMES);
175
176 rt_thread_startup(consumer_thread);
177
178 for (size_t i = 0; i < 2; i++)
179 {
180 rt_sem_take(&_thr_exit_sem, RT_WAITING_FOREVER);
181 }
182}
183
184static rt_err_t utest_tc_init(void)
185{

Callers

nothing calls this directly

Calls 4

rt_thread_createFunction · 0.85
rt_thread_startupFunction · 0.85
rt_sem_takeFunction · 0.85
rt_completion_initFunction · 0.50

Tested by

no test coverage detected