From 76a7a130b2084a8fbb0122061044b945a39dc401 Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Mon, 15 May 2017 13:40:37 +1000 Subject: core/test: Test pre-init memory reservations Signed-off-by: Oliver O'Halloran Signed-off-by: Stewart Smith --- core/test/run-mem_region_reservations.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/test/run-mem_region_reservations.c b/core/test/run-mem_region_reservations.c index bb402e2..8764953 100644 --- a/core/test/run-mem_region_reservations.c +++ b/core/test/run-mem_region_reservations.c @@ -74,7 +74,7 @@ bool lock_held_by_me(struct lock *l) return l->lock_val; } -#define TEST_HEAP_ORDER 12 +#define TEST_HEAP_ORDER 14 #define TEST_HEAP_SIZE (1ULL << TEST_HEAP_ORDER) static void add_mem_node(uint64_t start, uint64_t len) @@ -203,14 +203,17 @@ int main(void) buf = real_malloc(1024*1024); add_mem_node((unsigned long)buf, 1024*1024); - /* Now convert. */ - mem_region_init(); - - /* create our reservations */ + /* add pre-init reservations */ for (i = 0; i < ARRAY_SIZE(test_regions); i++) mem_reserve_hw(test_regions[i].name, test_regions[i].addr, 0x1000); + /* Now convert. */ + mem_region_init(); + + /* add a post-init reservation */ + mem_reserve_hw("test.4", 0x5000, 0x1000); + /* release unused */ mem_region_release_unused(); @@ -218,7 +221,7 @@ int main(void) mem_region_add_dt_reserved(); /* ensure we can't create further reservations */ - r = new_region("test.4", 0x5000, 0x1000, NULL, REGION_RESERVED); + r = new_region("test.5", 0x5000, 0x1000, NULL, REGION_RESERVED); assert(!add_region(r)); /* check old property-style reservations */ -- cgit v1.1