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 <ebl...@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.
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?
Regardless (with the subject fixed, though):
Reviewed-by: Hanna Czenczek <hre...@redhat.com>