boot_serial; re-enable mynewt boot_serial unittests.
Signed-off-by: Marko Kiiskila <marko@runtime.io>
diff --git a/boot/boot_serial/src/boot_serial.c b/boot/boot_serial/src/boot_serial.c
index 9b63043..6257613 100644
--- a/boot/boot_serial/src/boot_serial.c
+++ b/boot/boot_serial/src/boot_serial.c
@@ -71,7 +71,7 @@
#endif
static char in_buf[BOOT_SERIAL_INPUT_MAX + 1];
static char dec_buf[BOOT_SERIAL_INPUT_MAX + 1];
-static const struct boot_uart_funcs *boot_uf;
+const struct boot_uart_funcs *boot_uf;
static uint32_t curr_off;
static uint32_t img_size;
static struct nmgr_hdr *bs_hdr;
diff --git a/boot/boot_serial/src/boot_serial_priv.h b/boot/boot_serial/src/boot_serial_priv.h
index 3b4c1ec..9275f3f 100644
--- a/boot/boot_serial/src/boot_serial_priv.h
+++ b/boot/boot_serial/src/boot_serial_priv.h
@@ -63,6 +63,7 @@
#define IMGMGR_NMGR_ID_UPLOAD 1
void boot_serial_input(char *buf, int len);
+extern const struct boot_uart_funcs *boot_uf;
#ifdef __cplusplus
}
diff --git a/boot/boot_serial/test/src/boot_test.c b/boot/boot_serial/test/src/boot_test.c
index 3beb379..e8deb7e 100644
--- a/boot/boot_serial/test/src/boot_test.c
+++ b/boot/boot_serial/test/src/boot_test.c
@@ -31,6 +31,7 @@
#include "hal/hal_flash.h"
#include "flash_map_backend/flash_map_backend.h"
+#include "boot_serial/boot_serial.h"
#include "boot_serial_priv.h"
TEST_CASE_DECL(boot_serial_setup)
@@ -39,6 +40,15 @@
TEST_CASE_DECL(boot_serial_img_msg)
TEST_CASE_DECL(boot_serial_upload_bigger_image)
+static void
+test_uart_write(const char *str, int len)
+{
+}
+
+static const struct boot_uart_funcs test_uart = {
+ .write = test_uart_write
+};
+
void
tx_msg(void *src, int len)
{
@@ -57,6 +67,7 @@
int
boot_serial_test(void)
{
+ boot_uf = &test_uart;
boot_serial_suite();
return tu_any_failed;
}
diff --git a/boot/boot_serial/test/src/testcases/boot_serial_empty_msg.c b/boot/boot_serial/test/src/testcases/boot_serial_empty_msg.c
index a4bd470..12b6457 100644
--- a/boot/boot_serial/test/src/testcases/boot_serial_empty_msg.c
+++ b/boot/boot_serial/test/src/testcases/boot_serial_empty_msg.c
@@ -23,8 +23,6 @@
char buf[4];
struct nmgr_hdr hdr;
- boot_serial_input(buf, 0);
-
tx_msg(buf, 0);
strcpy(buf, "--");