summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuraj Jitindar Singh <sjitindarsingh@gmail.com>2017-05-03 16:57:25 +1000
committerAndrew Jeffery <andrew@aj.id.au>2017-05-04 01:20:23 +0000
commit6f3197df572db57f22d5ae6d8564fb1979a39259 (patch)
treef4da1ffc9a38bd61bc8fc8270586fbeae8142839
parent29b3e8a0bc057ed9a12a99c24cabff6998bcc3c8 (diff)
downloadphosphor-mboxbridge-6f3197df572db57f22d5ae6d8564fb1979a39259.tar.gz
phosphor-mboxbridge-6f3197df572db57f22d5ae6d8564fb1979a39259.zip
test: Set mbox_vlog in tests so we don't segfault
mbox_vlog contains the function pointer for the logging function called in MSG_<ERR/INFO/DEBUG>. Currently we don't set it in the <write/copy/erase>_flash tests meaning if there is any test output that we try to dereference a null pointer and thus segfault. Set it in these tests so that we can get test output which can be useful for debugging and most importantly so that we don't segfault which is annoying... Change-Id: If91725ded0ee5d6c3ab0a8925126065ec43b0cc3 Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
-rw-r--r--test/copy_flash.c2
-rw-r--r--test/erase_flash.c2
-rw-r--r--test/write_flash.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/test/copy_flash.c b/test/copy_flash.c
index 14ce854..5c40b53 100644
--- a/test/copy_flash.c
+++ b/test/copy_flash.c
@@ -51,6 +51,8 @@ int main(void)
atexit(cleanup);
+ mbox_vlog = &mbox_log_console;
+
src = malloc(TEST_SIZE);
dst = malloc(TEST_SIZE);
if (!(src && dst)) {
diff --git a/test/erase_flash.c b/test/erase_flash.c
index 23a536f..71e87b5 100644
--- a/test/erase_flash.c
+++ b/test/erase_flash.c
@@ -120,6 +120,8 @@ int main(void)
if (rc)
return rc;
+ mbox_vlog = &mbox_log_console;
+
n_ioctls = 0;
recorded = NULL;
diff --git a/test/write_flash.c b/test/write_flash.c
index 382a4a2..ebd0fb7 100644
--- a/test/write_flash.c
+++ b/test/write_flash.c
@@ -77,6 +77,8 @@ int main(void)
atexit(cleanup);
+ mbox_vlog = &mbox_log_console;
+
rc = init_flash_dev(context);
assert(rc == 0);
OpenPOWER on IntegriCloud