[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/20] libqtest: Simplify qmp_fd_vsend() a bit
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PATCH 07/20] libqtest: Simplify qmp_fd_vsend() a bit |
Date: |
Thu, 12 Jul 2018 11:07:40 -0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 |
On 07/12/2018 08:12 AM, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> tests/libqtest.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/tests/libqtest.c b/tests/libqtest.c
> index c2c08a890c..3bfb062fcb 100644
> --- a/tests/libqtest.c
> +++ b/tests/libqtest.c
> @@ -488,24 +488,20 @@ QDict *qtest_qmp_receive(QTestState *s)
> */
> void qmp_fd_vsend(int fd, const char *fmt, va_list ap)
> {
> - va_list ap_copy;
> QObject *qobj;
>
> - /* qobject_from_jsonv() silently eats leading 0xff as invalid
> - * JSON, but we want to test sending them over the wire to force
> - * resyncs */
> + /*
> + * qobject_from_vjsonf_nofail() chokes on leading 0xff as invalid
> + * JSON, but tests/test-qga.c needs to send that to test QGA
> + * synchronization
> + */
> if (*fmt == '\377') {
> socket_send(fd, fmt, 1);
> fmt++;
> }
>
> - /* Going through qobject ensures we escape strings properly.
> - * This seemingly unnecessary copy is required in case va_list
> - * is an array type.
> - */
> - va_copy(ap_copy, ap);
> - qobj = qobject_from_jsonv(fmt, &ap_copy, &error_abort);
> - va_end(ap_copy);
> + /* Going through qobject ensures we escape strings properly */
> + qobj = qobject_from_vjsonf_nofail(fmt, ap);
>
> /* No need to send anything for an empty QObject. */
> if (qobj) {
>
- Re: [Qemu-devel] [PATCH 14/20] migration-test: Make wait_command() return the "return" member, (continued)
- [Qemu-devel] [PATCH 15/20] tests: New helper qtest_qmp_receive_success(), Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 04/20] libqtest: Clean up how we read the QMP greeting, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 10/20] tests: Pass literal format strings directly to qmp_FOO(), Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 07/20] libqtest: Simplify qmp_fd_vsend() a bit, Markus Armbruster, 2018/07/12
- Re: [Qemu-devel] [PATCH 07/20] libqtest: Simplify qmp_fd_vsend() a bit,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 17/20] migration-test: Clean up string interpolation into QMP, part 1, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 20/20] libqtest: Enable compile-time format string checking, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 05/20] qobject: Replace qobject_from_jsonf() by qobject_from_jsonf_nofail(), Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 19/20] migration-test: Clean up string interpolation into QMP, part 3, Markus Armbruster, 2018/07/12