[PATCH 2/9] test: Adjust print_ut test to use unsigned char

Simon Glass sjg at chromium.org
Tue Nov 5 16:14:58 CET 2024


Hi Heinrich,

On Mon, 4 Nov 2024 at 13:51, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
>
>
> Am 4. November 2024 14:39:46 MEZ schrieb Simon Glass <sjg at chromium.org>:
> >Since char is unsigned on arm64, this test currently fails. It seems
> >better to use unsigned anyway, since 0xff is written into the string at
> >the start.
> >
> >Signed-off-by: Simon Glass <sjg at chromium.org>
> >---
> >
> > test/print_ut.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> >diff --git a/test/print_ut.c b/test/print_ut.c
> >index f5e607b21a3..7e5c015f3a7 100644
> >--- a/test/print_ut.c
> >+++ b/test/print_ut.c
> >@@ -242,7 +242,7 @@ PRINT_TEST(print_display_buffer, UTF_CONSOLE);
> >
> > static int print_hexdump_line(struct unit_test_state *uts)
> > {
> >-      char *linebuf;
> >+      u8 *linebuf;
> >       u8 *buf;
> >       int i;
> >
> >@@ -255,10 +255,10 @@ static int print_hexdump_line(struct unit_test_state *uts)
> >       linebuf = map_sysmem(0x400, BUF_SIZE);
> >       memset(linebuf, '\xff', BUF_SIZE);
> >       ut_asserteq(-ENOSPC, hexdump_line(0, buf, 1, 0x10, 0, linebuf, 75));
> >-      ut_asserteq(-1, linebuf[0]);
> >+      ut_asserteq(0xff, linebuf[0]);
> >       ut_asserteq(0x10, hexdump_line(0, buf, 1, 0x10, 0, linebuf, 76));
> >       ut_asserteq(0, linebuf[75]);
>
> Should we add a ut_asserteq_str() here to check all characters?

I believe it is...that's why it checks the \0 at the end of the
string. Or are you asking about the bytes after the string?

>
> Reviewed-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>
> >-      ut_asserteq(-1, linebuf[76]);
> >+      ut_asserteq(0xff, linebuf[76]);
> >
> >       unmap_sysmem(buf);
> >

Regards,
Simon


More information about the U-Boot mailing list