Skip to content

Commit 142eac6

Browse files
drobnikrppt
authored andcommitted
memblock tests: Add memblock_alloc tests for top down
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 <[email protected]> Signed-off-by: Mike Rapoport <[email protected]> Link: https://lore.kernel.org/r/26ccf409b8ff0394559d38d792b2afb24b55887c.1646055639.git.karolinadrobnik@gmail.com
1 parent 284d950 commit 142eac6

File tree

4 files changed

+447
-1
lines changed

4 files changed

+447
-1
lines changed

tools/testing/memblock/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \
66
-fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT
77
LDFLAGS += -fsanitize=address -fsanitize=undefined
88
TARGETS = main
9-
TEST_OFILES = tests/basic_api.o tests/common.o
9+
TEST_OFILES = tests/alloc_api.o tests/basic_api.o tests/common.o
1010
DEP_OFILES = memblock.o lib/slab.o mmzone.o slab.o
1111
OFILES = main.o $(DEP_OFILES) $(TEST_OFILES)
1212
EXTR_SRC = ../../../mm/memblock.c

tools/testing/memblock/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22
#include "tests/basic_api.h"
3+
#include "tests/alloc_api.h"
34

45
int main(int argc, char **argv)
56
{
67
memblock_basic_checks();
8+
memblock_alloc_checks();
9+
710
return 0;
811
}

0 commit comments

Comments
 (0)