test: mbox: LPC reserve memory size is not MTD size
The backing file for the LPC reserved memory region was being allocated
as the size of the MTD device. These sizes are completely unrelated.
The current configuration causes segfaults when the reserved memory
region exceeds the size of the flash.
Instead, resize the backing file once we know how big it needs to be.
Thankfully __init_lpc_dev() doesn't need the file to be sized to the
reported reserved memory size.
Change-Id: I89fd85ffe991ce0503055117684ac7d4d7b8abb1
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/test/mbox.c b/test/mbox.c
index 6c62ddb..932c4d7 100644
--- a/test/mbox.c
+++ b/test/mbox.c
@@ -243,10 +243,10 @@
rc = fallocate(test.flash.fd, 0, 0, test.context.mtd_info.size);
assert(rc == 0);
- rc = fallocate(test.lpc.fd, 0, 0, test.context.mtd_info.size);
+ rc = __init_lpc_dev(&test.context, test.lpc.path);
assert(rc == 0);
- rc = __init_lpc_dev(&test.context, test.lpc.path);
+ rc = fallocate(test.lpc.fd, 0, 0, test.context.mem_size);
assert(rc == 0);
rc = init_windows(&test.context);