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

Function testcase

components/drivers/ipc/utest/completion_timeout_tc.c:165–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163rt_thread_t _watching_thread2;
164
165static void testcase(void)
166{
167 /* Initialize completion object */
168 rt_completion_init(&_prod_completion);
169 rt_completion_init(&_cons_completion);
170
171 /* Create producer and consumer threads */
172 rt_thread_t producer_thread =
173 rt_thread_create("producer", producer_thread_entry, RT_NULL,
174 UTEST_THR_STACK_SIZE, UTEST_THR_PRIORITY, 100);
175 rt_thread_t consumer_thread =
176 rt_thread_create("consumer", consumer_thread_entry, producer_thread,
177 UTEST_THR_STACK_SIZE, UTEST_THR_PRIORITY, 100);
178 uassert_true(producer_thread != RT_NULL);
179 uassert_true(consumer_thread != RT_NULL);
180 _watching_thread1 = consumer_thread;
181 _watching_thread2 = producer_thread;
182
183 rt_thread_startup(consumer_thread);
184
185 for (size_t i = 0; i < 2; i++)
186 {
187 rt_sem_take(&_thr_exit_sem, RT_WAITING_FOREVER);
188 }
189
190 LOG_I("Summary:\n"
191 "\tTest times: %ds(%d times)\n"
192 "\tAsync interruption count: %d\n",
193 TEST_LOOP_TIMES / RT_TICK_PER_SECOND, TEST_LOOP_TIMES,
194 _async_intr_count);
195}
196
197static rt_err_t utest_tc_init(void)
198{

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