Skip to content

tests: stream_flash: fix hardcoded buf_len in buf_size_greater_than_page_size - #102

Merged
RichardSWheatley merged 1 commit into
mainfrom
fix/stream-flash-wbs-buf-len
Jul 10, 2026
Merged

tests: stream_flash: fix hardcoded buf_len in buf_size_greater_than_page_size#102
RichardSWheatley merged 1 commit into
mainfrom
fix/stream-flash-wbs-buf-len

Conversation

@RichardSWheatley

Copy link
Copy Markdown
Member

Fix test_stream_flash_buf_size_greater_than_page_size failing on flash
devices whose write_block_size does not divide 16.

stream_flash_init() returns -EFAULT when buf_len is not a multiple
of the device write_block_size (stream_flash.c:380). The hardcoded
buf_len = 0x10 only satisfies this on devices with write_block_size in
{1, 2, 4, 8, 16}. On hardware with larger block sizes (32, 64, 512 bytes
etc.) the "expected success" assertion spuriously fails.

Replace the constant with flash_get_parameters(fdev)->write_block_size so
the test is portable across all flash devices.

Fixes: zephyrproject-rtos#110948
Signed-off-by: Richard Wheatley dwheat@methodical-ep.com

@RichardSWheatley
RichardSWheatley force-pushed the fix/stream-flash-wbs-buf-len branch from f7eb496 to e35b1f9 Compare June 10, 2026 22:46
stream_flash_init() rejects buf_len values that are not a
multiple of the device write_block_size. Using 0x10 works
only when write_block_size <= 16; on hardware with larger
block sizes the call returns -EFAULT and the expected-
success assertion fails. Read the actual write_block_size
from flash parameters and use that as buf_len instead.

Fixes zephyrproject-rtos#110948
Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
@RichardSWheatley
RichardSWheatley force-pushed the fix/stream-flash-wbs-buf-len branch from e35b1f9 to 0178f4f Compare June 10, 2026 23:09
@RichardSWheatley
RichardSWheatley merged this pull request into main Jul 10, 2026
36 of 39 checks passed
@RichardSWheatley
RichardSWheatley deleted the fix/stream-flash-wbs-buf-len branch July 10, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant