Commit 2dfc2a22 authored by Andrew Jeffery's avatar Andrew Jeffery

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's avatarAndrew Jeffery <andrew@aj.id.au>
parent 7c1588aa
...@@ -4,7 +4,8 @@ test_flash_copy_SOURCES = \ ...@@ -4,7 +4,8 @@ test_flash_copy_SOURCES = \
%reldir%/flash_copy.c \ %reldir%/flash_copy.c \
flash.c \ flash.c \
common.c mtd.c \ common.c mtd.c \
%reldir%/tmpf.c %reldir%/tmpf.c \
%reldir%/system.c
test_flash_erase_SOURCES = \ test_flash_erase_SOURCES = \
%reldir%/flash_erase.c \ %reldir%/flash_erase.c \
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "mboxd.h" #include "mboxd.h"
#include "flash.h" #include "flash.h"
#include "test/system.h"
#include "test/tmpf.h" #include "test/tmpf.h"
#define TEST_SIZE 4096 #define TEST_SIZE 4096
...@@ -26,7 +27,7 @@ void cleanup(void) ...@@ -26,7 +27,7 @@ void cleanup(void)
int main(void) int main(void)
{ {
struct mbox_context context; struct mbox_context context = {0};
ssize_t processed; ssize_t processed;
int rand_fd; int rand_fd;
char *src; char *src;
...@@ -35,6 +36,8 @@ int main(void) ...@@ -35,6 +36,8 @@ int main(void)
atexit(cleanup); atexit(cleanup);
system_set_mtd_sizes(TEST_SIZE, TEST_SIZE);
mbox_vlog = &mbox_log_console; mbox_vlog = &mbox_log_console;
src = malloc(TEST_SIZE); src = malloc(TEST_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment