diff options
author | Yuval Peress <peress@google.com> | 2022-11-04 00:39:07 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-11-04 23:00:28 +0000 |
commit | 365143e8cea63db9b1016ff336cad37463899c88 (patch) | |
tree | c35d479ddc19690422215891698ba200138a6ead /common/uart_printf.c | |
parent | 0fe46137f42b811762bcaedcd93f2f4587f6ccfa (diff) | |
download | chrome-ec-365143e8cea63db9b1016ff336cad37463899c88.tar.gz |
test: unit test uart_printf.c
Add unit tests to get uart_printf.c to 100% coverage.
BRANCH=none
BUG=none
TEST=twister
Signed-off-by: Yuval Peress <peress@google.com>
Change-Id: I2fdbea71a7048a2187c599052bf7180a97ee3ad2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4004509
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'common/uart_printf.c')
-rw-r--r-- | common/uart_printf.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/common/uart_printf.c b/common/uart_printf.c index 01fd1353d2..a4fecf5c73 100644 --- a/common/uart_printf.c +++ b/common/uart_printf.c @@ -31,9 +31,10 @@ int uart_putc(int c) int uart_puts(const char *outstr) { /* Put all characters in the output buffer */ - while (*outstr) { - if (__tx_char(NULL, *outstr++) != 0) + for (; *outstr != '\0'; ++outstr) { + if (__tx_char(NULL, *outstr) != 0) { break; + } } uart_tx_start(); @@ -48,8 +49,9 @@ int uart_put(const char *out, int len) /* Put all characters in the output buffer */ for (written = 0; written < len; written++) { - if (__tx_char(NULL, *out++) != 0) + if (__tx_char(NULL, *out++) != 0) { break; + } } uart_tx_start(); @@ -63,8 +65,9 @@ int uart_put_raw(const char *out, int len) /* Put all characters in the output buffer */ for (written = 0; written < len; written++) { - if (uart_tx_char_raw(NULL, *out++) != 0) + if (uart_tx_char_raw(NULL, *out++) != 0) { break; + } } uart_tx_start(); |