On 06/15/2016 11:27 AM, Markus Armbruster wrote: > g_error() is not an acceptable way to report errors to the user: > > $ qemu-system-x86_64 -dfilter 1000+0 > > ** (process:17187): ERROR **: Failed to parse range in: 1000+0 > Trace/breakpoint trap (core dumped) > > g_assert() isn't, either: > > $ qemu-system-x86_64 -dfilter 1000x+64 > ** > ERROR:/work/armbru/qemu/util/log.c:180:qemu_set_dfilter_ranges: assertion > failed: (e == range_op) > Aborted (core dumped)
I see you're trying to improve my range.h patches, and got dragged into this stuff. > > Convert qemu_set_dfilter_ranges() to Error. Rework its deeply nested > control flow. Touch up the error messages. Call it with > &error_fatal. > > This also permits testing without a subprocess, so do that. > > Signed-off-by: Markus Armbruster <arm...@redhat.com> > --- > include/qemu/log.h | 2 +- > tests/test-logging.c | 49 ++++++++-------------- > util/log.c | 113 > ++++++++++++++++++++++++++------------------------- > vl.c | 2 +- > 4 files changed, 75 insertions(+), 91 deletions(-) > > + qemu_set_dfilter_ranges("0x1000+onehundred", &err); > + error_free_or_abort(&err); > + > + qemu_set_dfilter_ranges("0x1000+0", &err); > + error_free_or_abort(&err); > } > Maybe also worth testing "0x" and "0x1000+0x" for being invalid? Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature