Lines Matching full:timeout

16  * @brief Test fifo APIs timeout
18 * This module tests following fifo timeout scenarios
20 * First, the thread waits with a timeout and times out. Then it wait with a
21 * timeout, but gets the data in time.
23 * Then, multiple timeout tests are done for the threads, to test the ordering
24 * of queueing/dequeueing when timeout occurs, first on one fifo, then on
28 * data in time, except the last one: this tests that the timeout is
45 uint32_t timeout; member
101 static bool is_timeout_in_range(uint32_t start_time, uint32_t timeout) in is_timeout_in_range() argument
109 return timeout <= diff; in is_timeout_in_range()
115 uint32_t timeout = *((uint32_t *)p2); in test_thread_put_timeout() local
117 k_msleep(timeout); in test_thread_put_timeout()
131 packet = k_fifo_get(d->fifo, K_MSEC(d->timeout)); in test_thread_pend_and_timeout()
133 zassert_true(is_timeout_in_range(start_time, d->timeout)); in test_thread_pend_and_timeout()
137 /* Spins several threads that pend and timeout on fifos */
155 * estimation of a timeout occurring with the max deviation of an in test_multiple_threads_pending()
156 * additional tick. Hence the timeout order may slightly be different in test_multiple_threads_pending()
166 data->q_order, data->timeout, data->fifo); in test_multiple_threads_pending()
177 if (data->timeout > test_data[j].timeout) { in test_multiple_threads_pending()
178 diff_ms = data->timeout - test_data[j].timeout; in test_multiple_threads_pending()
180 diff_ms = test_data[j].timeout - data->timeout; in test_multiple_threads_pending()
186 data->q_order, data->timeout, data->fifo); in test_multiple_threads_pending()
199 /* a thread pends on a fifo with a timeout and gets the data in time */
205 packet = k_fifo_get(d->fifo, K_MSEC(d->timeout)); in test_thread_pend_and_get_data()
248 data->q_order, data->timeout, data->fifo); in test_multiple_threads_get_data()
265 data->q_order, data->timeout, data->fifo); in test_multiple_threads_get_data()
270 /* try getting data on fifo with special timeout value, return result in fifo */
297 * @brief Test empty fifo with timeout and K_NO_WAIT
303 uint32_t start_time, timeout; in ZTEST() local
307 /* Test empty fifo with timeout */ in ZTEST()
308 timeout = 10U; in ZTEST()
310 packet = k_fifo_get(&fifo_timeout[0], K_MSEC(timeout)); in ZTEST()
312 zassert_true(is_timeout_in_range(start_time, timeout)); in ZTEST()
314 /* Test empty fifo with timeout of K_NO_WAIT */ in ZTEST()
320 * @brief Test non empty fifo with timeout and K_NO_WAIT
343 * @brief Test fifo with timeout and K_NO_WAIT
344 * @details In first scenario test fifo with some timeout where child thread
346 * timeout of K_NO_WAIT and the fifo should be filled by the child thread
348 * k_fifo_get with timeout of K_FOREVER and the fifo should be filled by
356 uint32_t start_time, timeout; in ZTEST() local
361 * Test fifo with some timeout and child thread that puts in ZTEST()
364 timeout = 10U; in ZTEST()
369 &timeout, NULL, in ZTEST()
372 packet = k_fifo_get(&fifo_timeout[0], K_MSEC(timeout + 10)); in ZTEST()
374 zassert_true(is_timeout_in_range(start_time, timeout)); in ZTEST()
378 * Test k_fifo_get with timeout of K_NO_WAIT and the fifo in ZTEST()
394 * Test k_fifo_get with timeout of K_NO_WAIT and the fifo in ZTEST()
414 * Test k_fifo_get with timeout of K_FOREVER and the fifo in ZTEST()