zephyr/tests/lib/heap_align
Nicolas Pitre 1e52b1123e tests/lib/heap_align: improve test
Many issues:

- heapmem[] is of type uint64_t meaning that it contains HEAP_SZ * 16
  bytes but the heap is initialized with only 1/16 of that, making
  this test's memory footprint way too large.

- The test to ensure the heap is empty uses an allocation size of
  (heap_end - heap_start - 8) which is wrong as heap_end and heap_start
  are uint64_t pointer types and therefore their difference will be 8x
  smaller than intended. Furthermore, the 8 here is unnessary as the
  chunk header size is already included in the location of heap_start.

- The heap start address misalignment bare no purpose as the misaligned
  start of the free heap is already controlled by the variable prefix
  allocation size.

- Alignment and sizes should rather be expressed in terms of size_t
  rather than uintptr_t.

Fix those issues, and add a few more test angles:

- Make the prefix allocation itterate across the entire alignment range
  to exercize all possible misalignments.

- Vary the aligned allocation size to better exercize the pre-alignment
  allocation and suffix handling.

- Double the aligned allocation to add more variability in the heap
  structure.

- Test the testing of emptiness by making sure that no more allocations
  are possible when we think we allocated it all.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-06-28 23:43:42 -04:00
..
src
CMakeLists.txt
prj.conf
testcase.yaml