-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Tests: kernel: mem_heap: increase k_heap test coverage #92740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
add test coverage for k_heap_aligned_alloc() k_heap API Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
Enhance k_heap_calloc() API coverage by testing overflow and zero-size edge cases Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
Enhance k_heap_free() API coverage by testing NULL free & double free edge cases Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
|
@andyross @peter-mitsis could you take a quick look? thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't assume k_heap_aligned_alloc()
may accept non-power-of-two
alignment. There is a special understanding between z_alloc_helper()
and sys_heap_aligned_alloc()
for the meaning of such a non-power-of-two
alignment value and that's not what you are testing here.
There was a time when z_alloc_helper()
was expressed in terms of
k_heap_aligned_alloc()
so the later had to accept special alignment values
from the former. This is no longer the case and k_heap_aligned_alloc()
should probably enforce proper alignment values now.
The double-free test is also highly dubious. Either you have assertions
enabled and there's a chance (no guarantee) this will be caught, or
assertions are disabled and you'll definitely and silently corrupt memory.
Add test for k_heap_aligned_alloc() API.
Enhance k_heap_free() and k_heap_calloc() APIs testing.