boot_serial; re-enable mynewt boot_serial unittests.

Signed-off-by: Marko Kiiskila <marko@runtime.io>
This commit is contained in:
Marko Kiiskila 2018-06-14 13:20:46 -07:00 committed by mkiiskila
parent c427af2e7e
commit 8b1ce3a6ce
4 changed files with 13 additions and 3 deletions

View File

@ -71,7 +71,7 @@
#endif #endif
static char in_buf[BOOT_SERIAL_INPUT_MAX + 1]; static char in_buf[BOOT_SERIAL_INPUT_MAX + 1];
static char dec_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 curr_off;
static uint32_t img_size; static uint32_t img_size;
static struct nmgr_hdr *bs_hdr; static struct nmgr_hdr *bs_hdr;

View File

@ -63,6 +63,7 @@ struct nmgr_hdr {
#define IMGMGR_NMGR_ID_UPLOAD 1 #define IMGMGR_NMGR_ID_UPLOAD 1
void boot_serial_input(char *buf, int len); void boot_serial_input(char *buf, int len);
extern const struct boot_uart_funcs *boot_uf;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -31,6 +31,7 @@
#include "hal/hal_flash.h" #include "hal/hal_flash.h"
#include "flash_map_backend/flash_map_backend.h" #include "flash_map_backend/flash_map_backend.h"
#include "boot_serial/boot_serial.h"
#include "boot_serial_priv.h" #include "boot_serial_priv.h"
TEST_CASE_DECL(boot_serial_setup) TEST_CASE_DECL(boot_serial_setup)
@ -39,6 +40,15 @@ TEST_CASE_DECL(boot_serial_empty_img_msg)
TEST_CASE_DECL(boot_serial_img_msg) TEST_CASE_DECL(boot_serial_img_msg)
TEST_CASE_DECL(boot_serial_upload_bigger_image) 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 void
tx_msg(void *src, int len) tx_msg(void *src, int len)
{ {
@ -57,6 +67,7 @@ TEST_SUITE(boot_serial_suite)
int int
boot_serial_test(void) boot_serial_test(void)
{ {
boot_uf = &test_uart;
boot_serial_suite(); boot_serial_suite();
return tu_any_failed; return tu_any_failed;
} }

View File

@ -23,8 +23,6 @@ TEST_CASE(boot_serial_empty_msg)
char buf[4]; char buf[4];
struct nmgr_hdr hdr; struct nmgr_hdr hdr;
boot_serial_input(buf, 0);
tx_msg(buf, 0); tx_msg(buf, 0);
strcpy(buf, "--"); strcpy(buf, "--");