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@kernel.org>
Wed, 9 Feb 2022 07:17:57 +0000 (09:17 +0200)
commitc294f4708f0116a0e5a9695a471a0cafd05d2899
tree8e5c2f1d347b9df64669acff6d627aac8534a8ef
parentd047055e609e23190c4d46899816dc32a6cc297b
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