[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/20] migration-test: Make wait_command() cope with
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH 16/20] migration-test: Make wait_command() cope with '%' |
Date: |
Thu, 12 Jul 2018 13:12:17 +0200 |
wait_command() passes its argument @command to qtest_qmp_send().
Falls apart if @command contain '%'. Two ways to disarm this trap:
suppress interpretation of '%' by passing @command as argument to
format string "%s", or fix it by having wait_command() take the
variable arguments to go with @command. Do the latter.
This is another step towards compile-time format string checking
without triggering -Wformat-nonliteral.
Cc: Juan Quintela <address@hidden>
Cc: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
tests/migration-test.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/migration-test.c b/tests/migration-test.c
index 267342fd3e..55f9d006ec 100644
--- a/tests/migration-test.c
+++ b/tests/migration-test.c
@@ -156,9 +156,15 @@ static void stop_cb(void *opaque, const char *name, QDict
*data)
/*
* Events can get in the way of responses we are actually waiting for.
*/
-static QDict *wait_command(QTestState *who, const char *command)
+GCC_FMT_ATTR(2, 3)
+static QDict *wait_command(QTestState *who, const char *command, ...)
{
- qtest_qmp_send(who, command);
+ va_list ap;
+
+ va_start(ap, command);
+ qtest_qmp_vsend(who, command, ap);
+ va_end(ap);
+
return qtest_qmp_receive_success(who, stop_cb, NULL);
}
--
2.17.1
- [Qemu-devel] [PATCH 00/20] tests: Compile-time format string checking for libqtest.h, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 03/20] libqtest: Clean up how we read device_del messages, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 16/20] migration-test: Make wait_command() cope with '%',
Markus Armbruster <=
- [Qemu-devel] [PATCH 01/20] libqtest: Document calling conventions, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 09/20] qobject: qobject_from_jsonv() is dangerous, hide it away, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 12/20] cpu-plug-test: Don't pass integers as strings to device_add, Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 06/20] qobject: New qobject_from_vjsonf_nofail(), qdict_from_vjsonf_nofail(), Markus Armbruster, 2018/07/12
- [Qemu-devel] [PATCH 18/20] migration-test: Clean up string interpolation into QMP, part 2, Markus Armbruster, 2018/07/12