[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 14/19] test-cutils: Add more coverage to qemu_strtosz11;rg
|
From: |
Eric Blake |
|
Subject: |
Re: [PATCH v2 14/19] test-cutils: Add more coverage to qemu_strtosz11;rgb:1e1e/1e1e/1e1e |
|
Date: |
Fri, 19 May 2023 13:02:54 -0500 |
|
User-agent: |
NeoMutt/20230517 |
On Fri, May 19, 2023 at 05:26:12PM +0200, Hanna Czenczek wrote:
> On 12.05.23 04:10, Eric Blake wrote:
> > Add some more strings that the user might send our way. In
> > particular, some of these additions include FIXME comments showing
> > where our parser doesn't quite behave the way we want.
> >
> > Signed-off-by: Eric Blake <eblake@redhat.com>
> >
> > ---
> >
> > v2: even more tests added, pad a string to avoid out-of-bounds
> > randomness [Hanna]
> > ---
> > tests/unit/test-cutils.c | 147 +++++++++++++++++++++++++++++++++++----
> > 1 file changed, 135 insertions(+), 12 deletions(-)
>
> The subject line appears as if it contained an ANSI escape sequence.
Yep, and I even flagged that in reply to the cover letter.
>
> > diff --git a/tests/unit/test-cutils.c b/tests/unit/test-cutils.c
> > index 1936c7b5795..7800caf9b0e 100644
> > --- a/tests/unit/test-cutils.c
> > +++ b/tests/unit/test-cutils.c
> > @@ -3162,7 +3162,12 @@ static void do_strtosz_full(const char *str,
> > qemu_strtosz_fn fn,
> > ret = fn(str, &endptr, &val);
> > g_assert_cmpint(ret, ==, exp_ptr_ret);
> > g_assert_cmpuint(val, ==, exp_ptr_val);
> > - g_assert_true(endptr == str + exp_ptr_offset);
> > + if (str) {
> > + g_assert_true(endptr == str + exp_ptr_offset);
> > + } else {
> > + g_assert_cmpint(exp_ptr_offset, ==, 0);
> > + g_assert_null(endptr);
> > + }
>
> This patch adds no new cases that call do_strtosz*() with a NULL str – did
> you intent for this to go into patch 12?
Oh, indeed - it was patch 12 that added do_strtosz(NULL, -EINVAL,
0xbaadf00d, 0); it's a shame the compiler doesn't complain about 'NULL
+ 0' as being an odd expression. Yes, I'll hoist this hunk to 12 for
v3...
>
> Regardless (with the subject fixed, though):
>
> Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
...while keeping your R-b.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- Re: [PATCH v2 07/19] cutils: Adjust signature of parse_uint[_full], (continued)
- [PATCH v2 09/19] test-cutils: Add coverage of qemu_strtod, Eric Blake, 2023/05/11
- [PATCH v2 11/19] test-cutils: Refactor qemu_strtosz tests for less boilerplate, Eric Blake, 2023/05/11
- [PATCH v2 14/19] test-cutils: Add more coverage to qemu_strtosz11; rgb:1e1e/1e1e/1e1e, Eric Blake, 2023/05/11
- [PATCH v2 12/19] cutils: Allow NULL str in qemu_strtosz, Eric Blake, 2023/05/11
- [PATCH v2 16/19] cutils: Set value in all integral qemu_strto* error paths, Eric Blake, 2023/05/11
- [PATCH v2 15/19] cutils: Set value in all qemu_strtosz* error paths, Eric Blake, 2023/05/11
- [PATCH v2 06/19] cutils: Document differences between parse_uint and qemu_strtou64, Eric Blake, 2023/05/11
- [PATCH v2 13/19] numa: Check for qemu_strtosz_MiB error, Eric Blake, 2023/05/11
- [PATCH v2 18/19] cutils: Improve qemu_strtod* error paths, Eric Blake, 2023/05/11