]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
migration-test: Make wait_command() cope with '%'
authorMarkus Armbruster <armbru@redhat.com>
Mon, 6 Aug 2018 06:53:38 +0000 (08:53 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 16 Aug 2018 06:42:06 +0000 (08:42 +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 <quintela@redhat.com>
Cc: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20180806065344.7103-18-armbru@redhat.com>

tests/migration-test.c

index 402c82bdc4f18c23867ba6753e4364e4d39f08cf..7bffcd2e4d48f2caac9668b048775857f64651a6 100644 (file)
@@ -159,9 +159,14 @@ 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)
+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);
 }