aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2023-05-22 14:04:33 -0500
committerEric Blake <eblake@redhat.com>2023-06-02 12:29:27 -0500
commit157367cf21ea01a9413fd6f16808b0bf34804138 (patch)
tree44f557f31fbb37f8651ff020d3cc2d22c1bd4c4d /util
parentedafce694a53bb5ca3025fce0f3dfe7a40056783 (diff)
downloadqemu-157367cf21ea01a9413fd6f16808b0bf34804138.zip
qemu-157367cf21ea01a9413fd6f16808b0bf34804138.tar.gz
qemu-157367cf21ea01a9413fd6f16808b0bf34804138.tar.bz2
test-cutils: Refactor qemu_strtosz tests for less boilerplate
No need to copy-and-paste lots of boilerplate per string tested, when we can consolidate that behind helper functions. Plus, this adds a bit more coverage (we now test all strings both with and without endptr, whereas before some tests skipped the NULL endptr case), which exposed a SEGFAULT on qemu_strtosz(NULL, NULL, &val) that will be fixed in an upcoming patch. Note that duplicating boilerplate has one advantage lost here - a failed test tells you which line number failed; but a helper function does not show the call stack that reached the failure. Since we call the helper more than once within many of the "unit tests", even the unit test name doesn't point out which call is failing. But that only matters when tests fail (they normally pass); at which point I'm debugging the failures under gdb anyways, so I'm not too worried about it. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Hanna Czenczek <hreitz@redhat.com> Message-Id: <20230522190441.64278-12-eblake@redhat.com>
Diffstat (limited to 'util')
0 files changed, 0 insertions, 0 deletions