memblock tests: Add memblock_add tests
authorKarolina Drobnik <karolinadrobnik@gmail.com>
Wed, 2 Feb 2022 11:03:11 +0000 (12:03 +0100)
committerMike Rapoport <rppt@linux.ibm.com>
Mon, 21 Feb 2022 06:12:36 +0000 (08:12 +0200)
commit1f1180d46d21506325b7217da5a546235a2263a2
treef3942c7668d256e247e05ae3e0f3b597fd02cd7b
parentf3252a22d1f59d89cca769431efa1c95d6343929
memblock tests: Add memblock_add tests

Add checks for adding a new region in different scenarios:
 - The region does not overlap with existing entries
 - The region overlaps with one of the previous entries: from the top
  (its end address is bigger than the base of the existing region) or
  from the bottom (its base address is smaller than the end address of
  one of the regions)
 - The region is within an already defined region
 - The same region is added twice to the collection of available memory
   regions

Add checks for memblock initialization to verify it sets memblock data
structures to expected values.

Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@kernel.org>
Link: https://lore.kernel.org/r/b6c26525025bccec0bf7419473d4d1293eb82b3b.1643796665.git.karolinadrobnik@gmail.com
tools/testing/memblock/tests/basic_api.c