mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-08-30 19:34:39 +00:00
The minimum possible mempool block size is either 8 or 16 for 32-bit or 64-bit targets respectively. Defining BYTES_TO_WRITE to 4 and using that with K_MEM_POOL_DEFINE() won't produce the expected result i.e. only 1 block at any time could be allocated instead of 4. Yet, the test does run successfully regardless of the block allocation loop in tpipe_block_put(). It turns out that the pipe buffer is large enough to consume all the block data synchronously, meaning that the mempool block is freed right away and available for the next loop iteration. This also means that the asynchronous delivery mechanism is never exercized. Fix both issues by defining PIPE_LEN and BYTES_TO_WRITE in terms of _MPOOL_MINBLK with the expected factor of 4, and adding a new test using the half-sized pipe where the pipe buffer gets saturated and mempool memory blocks are actually queued for asynchronous consumption. The source data string has to be extended to accommodate larger pipe sizes too. Signed-off-by: Nicolas Pitre <npitre@baylibre.com> |
||
---|---|---|
.. | ||
pipe | ||
pipe_api |