Skip to content

Commit

Permalink
memblock tests: Add memblock_alloc tests for top down
Browse files Browse the repository at this point in the history
Add checks for memblock_alloc for top down allocation direction.
The tested scenarios are:
  - Region can be allocated on the first fit (with and without
    region merging)
  - Region can be allocated on the second fit (with and without
    region merging)

Add checks for both allocation directions:
  - Region can be allocated between two already existing entries
  - Limited memory available
  - All memory is reserved
  - No available memory registered with memblock

Signed-off-by: Karolina Drobnik <karolinadrobnik@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/26ccf409b8ff0394559d38d792b2afb24b55887c.1646055639.git.karolinadrobnik@gmail.com
  • Loading branch information
Karolina Drobnik authored and Mike Rapoport committed Mar 9, 2022
1 parent 284d950 commit 142eac6
Show file tree
Hide file tree
Showing 4 changed files with 447 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/memblock/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \
-fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT
LDFLAGS += -fsanitize=address -fsanitize=undefined
TARGETS = main
TEST_OFILES = tests/basic_api.o tests/common.o
TEST_OFILES = tests/alloc_api.o tests/basic_api.o tests/common.o
DEP_OFILES = memblock.o lib/slab.o mmzone.o slab.o
OFILES = main.o $(DEP_OFILES) $(TEST_OFILES)
EXTR_SRC = ../../../mm/memblock.c
Expand Down
3 changes: 3 additions & 0 deletions tools/testing/memblock/main.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "tests/basic_api.h"
#include "tests/alloc_api.h"

int main(int argc, char **argv)
{
memblock_basic_checks();
memblock_alloc_checks();

return 0;
}
Loading

0 comments on commit 142eac6

Please sign in to comment.