test/flash_copy: Configure MTD device to avoid undefined behaviour
Otherwise we observe invalid memory accesses due to uninitialised
variables.
Change-Id: I8b9063ccc9a25b225a562ebe120f2a99a28788ca
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/test/Makefile.am.include b/test/Makefile.am.include
index 845c13a..de1bfce 100644
--- a/test/Makefile.am.include
+++ b/test/Makefile.am.include
@@ -4,7 +4,8 @@
%reldir%/flash_copy.c \
flash.c \
common.c mtd.c \
- %reldir%/tmpf.c
+ %reldir%/tmpf.c \
+ %reldir%/system.c
test_flash_erase_SOURCES = \
%reldir%/flash_erase.c \
diff --git a/test/flash_copy.c b/test/flash_copy.c
index 08dfc1a..3b88b76 100644
--- a/test/flash_copy.c
+++ b/test/flash_copy.c
@@ -13,6 +13,7 @@
#include "mboxd.h"
#include "flash.h"
+#include "test/system.h"
#include "test/tmpf.h"
#define TEST_SIZE 4096
@@ -26,7 +27,7 @@
int main(void)
{
- struct mbox_context context;
+ struct mbox_context context = {0};
ssize_t processed;
int rand_fd;
char *src;
@@ -35,6 +36,8 @@
atexit(cleanup);
+ system_set_mtd_sizes(TEST_SIZE, TEST_SIZE);
+
mbox_vlog = &mbox_log_console;
src = malloc(TEST_SIZE);