From 055a1efc7c5a30ca0993720da57ba70179d28c7b Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Aug 2018 08:53:25 +0200 Subject: libqtest: Remove qtest_qmp_discard_response() & friends qtest_qmp_discard_response(...) is shorthand for qobject_unref(qtest_qmp(...), except it's not actually shorter. Moreover, the presence of these functions encourage sloppy testing. Remove them from libqtest. Add them as macros to the tests that use them, with a TODO comment asking for cleanup. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-5-armbru@redhat.com> Reviewed-by: Thomas Huth --- tests/migration-test.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/migration-test.c') diff --git a/tests/migration-test.c b/tests/migration-test.c index e079e0bdb6..bbe9c9e95d 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -20,6 +20,9 @@ #include "chardev/char.h" #include "sysemu/sysemu.h" +/* TODO actually test the results and get rid of this */ +#define qtest_qmp_discard_response(...) qobject_unref(qtest_qmp(__VA_ARGS__)) + const unsigned start_address = 1024 * 1024; const unsigned end_address = 100 * 1024 * 1024; bool got_stop; -- cgit v1.2.3 From 015715f554f19a809cd80ff53a3881fddfda1336 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Aug 2018 08:53:33 +0200 Subject: tests: Clean up string interpolation into QMP input (simple cases) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When you build QMP input manually like this cmd = g_strdup_printf("{ 'execute': 'migrate'," "'arguments': { 'uri': '%s' } }", uri); rsp = qmp(cmd); g_free(cmd); you're responsible for escaping the interpolated values for JSON. Not done here, and therefore works only for sufficiently nice @uri. For instance, if @uri contained a single "'", qobject_from_vjsonf_nofail() would abort. A sufficiently nasty @uri could even inject unwanted members into the arguments object. Leaving interpolation into JSON to qmp() is more robust: rsp = qmp("{ 'execute': 'migrate', 'arguments': { 'uri': %s } }", uri); It's also more concise. Clean up the simple cases where we interpolate exactly a JSON value. Bonus: gets rid of non-literal format strings. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-13-armbru@redhat.com> --- tests/migration-test.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'tests/migration-test.c') diff --git a/tests/migration-test.c b/tests/migration-test.c index bbe9c9e95d..486059580c 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -532,14 +532,12 @@ static void test_migrate_end(QTestState *from, QTestState *to, bool test_dest) static void deprecated_set_downtime(QTestState *who, const double value) { QDict *rsp; - gchar *cmd; char *expected; int64_t result_int; - cmd = g_strdup_printf("{ 'execute': 'migrate_set_downtime'," - "'arguments': { 'value': %g } }", value); - rsp = qtest_qmp(who, cmd); - g_free(cmd); + rsp = qtest_qmp(who, + "{ 'execute': 'migrate_set_downtime'," + " 'arguments': { 'value': %f } }", value); g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); result_int = value * 1000L; -- cgit v1.2.3 From e14541652486080a7bb38057f024a18143d111ed Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Aug 2018 08:53:36 +0200 Subject: migration-test: Make wait_command() return the "return" member All callers of wait_command() are only interested in the success response's "return" member. Lift its extraction into wait_command(). Cc: Juan Quintela Cc: Dr. David Alan Gilbert Signed-off-by: Markus Armbruster Reviewed-by: Juan Quintela Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-16-armbru@redhat.com> --- tests/migration-test.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) (limited to 'tests/migration-test.c') diff --git a/tests/migration-test.c b/tests/migration-test.c index 486059580c..db652e30a0 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -155,7 +155,7 @@ static void wait_for_serial(const char *side) static QDict *wait_command(QTestState *who, const char *command) { const char *event_string; - QDict *response; + QDict *response, *ret; response = qtest_qmp(who, command); @@ -168,7 +168,12 @@ static QDict *wait_command(QTestState *who, const char *command) qobject_unref(response); response = qtest_qmp_receive(who); } - return response; + + ret = qdict_get_qdict(response, "return"); + g_assert(ret); + qobject_ref(ret); + qobject_unref(response); + return ret; } /* @@ -177,15 +182,7 @@ static QDict *wait_command(QTestState *who, const char *command) */ static QDict *migrate_query(QTestState *who) { - QDict *rsp, *rsp_return; - - rsp = wait_command(who, "{ 'execute': 'query-migrate' }"); - rsp_return = qdict_get_qdict(rsp, "return"); - g_assert(rsp_return); - qobject_ref(rsp_return); - qobject_unref(rsp); - - return rsp_return; + return wait_command(who, "{ 'execute': 'query-migrate' }"); } /* @@ -327,16 +324,16 @@ static void cleanup(const char *filename) static void migrate_check_parameter(QTestState *who, const char *parameter, const char *value) { - QDict *rsp, *rsp_return; + QDict *rsp_return; char *result; - rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }"); - rsp_return = qdict_get_qdict(rsp, "return"); + rsp_return = wait_command(who, + "{ 'execute': 'query-migrate-parameters' }"); result = g_strdup_printf("%" PRId64, qdict_get_try_int(rsp_return, parameter, -1)); g_assert_cmpstr(result, ==, value); g_free(result); - qobject_unref(rsp); + qobject_unref(rsp_return); } static void migrate_set_parameter(QTestState *who, const char *parameter, @@ -360,7 +357,6 @@ static void migrate_pause(QTestState *who) QDict *rsp; rsp = wait_command(who, "{ 'execute': 'migrate-pause' }"); - g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); } @@ -373,7 +369,6 @@ static void migrate_recover(QTestState *who, const char *uri) " 'arguments': { 'uri': '%s' } }", uri); rsp = wait_command(who, cmd); - g_assert(qdict_haskey(rsp, "return")); g_free(cmd); qobject_unref(rsp); } @@ -414,7 +409,6 @@ static void migrate_postcopy_start(QTestState *from, QTestState *to) QDict *rsp; rsp = wait_command(from, "{ 'execute': 'migrate-start-postcopy' }"); - g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); if (!got_stop) { @@ -692,7 +686,7 @@ static void test_postcopy_recovery(void) static void test_baddest(void) { QTestState *from, *to; - QDict *rsp, *rsp_return; + QDict *rsp_return; char *status; bool failed; @@ -708,12 +702,10 @@ static void test_baddest(void) } while (!failed); /* Is the machine currently running? */ - rsp = wait_command(from, "{ 'execute': 'query-status' }"); - g_assert(qdict_haskey(rsp, "return")); - rsp_return = qdict_get_qdict(rsp, "return"); + rsp_return = wait_command(from, "{ 'execute': 'query-status' }"); g_assert(qdict_haskey(rsp_return, "running")); g_assert(qdict_get_bool(rsp_return, "running")); - qobject_unref(rsp); + qobject_unref(rsp_return); test_migrate_end(from, to, false); } -- cgit v1.2.3 From 3cd46d42fe632b4732eca23b15b99d1b26ee6f2c Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Aug 2018 08:53:37 +0200 Subject: tests: New helper qtest_qmp_receive_success() Commit b21373d0713 copied wait_command() from tests/migration-test.c to tests/tpm-util.c. Replace both copies by new libqtest helper qtest_qmp_receive_success(). Also use it to simplify qtest_qmp_device_del(). Bonus: gets rid of a non-literal format string. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Cc: Thomas Huth Cc: Juan Quintela Cc: Dr. David Alan Gilbert Cc: Stefan Berger Signed-off-by: Markus Armbruster Reviewed-by: Juan Quintela Reviewed-by: Stefan Berger Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-17-armbru@redhat.com> --- tests/migration-test.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'tests/migration-test.c') diff --git a/tests/migration-test.c b/tests/migration-test.c index db652e30a0..402c82bdc4 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -149,31 +149,20 @@ static void wait_for_serial(const char *side) } while (true); } +static void stop_cb(void *opaque, const char *name, QDict *data) +{ + if (!strcmp(name, "STOP")) { + got_stop = true; + } +} + /* * Events can get in the way of responses we are actually waiting for. */ static QDict *wait_command(QTestState *who, const char *command) { - const char *event_string; - QDict *response, *ret; - - response = qtest_qmp(who, command); - - while (qdict_haskey(response, "event")) { - /* OK, it was an event */ - event_string = qdict_get_str(response, "event"); - if (!strcmp(event_string, "STOP")) { - got_stop = true; - } - qobject_unref(response); - response = qtest_qmp_receive(who); - } - - ret = qdict_get_qdict(response, "return"); - g_assert(ret); - qobject_ref(ret); - qobject_unref(response); - return ret; + qtest_qmp_send(who, command); + return qtest_qmp_receive_success(who, stop_cb, NULL); } /* -- cgit v1.2.3 From 4399596b152f6c933a173b0e97ba4e3b6a57458f Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Aug 2018 08:53:38 +0200 Subject: migration-test: Make wait_command() cope with '%' 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 Cc: Dr. David Alan Gilbert Signed-off-by: Markus Armbruster Reviewed-by: Juan Quintela Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-18-armbru@redhat.com> --- tests/migration-test.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests/migration-test.c') diff --git a/tests/migration-test.c b/tests/migration-test.c index 402c82bdc4..7bffcd2e4d 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -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); } -- cgit v1.2.3 From b7281c6989c09a98670ea11c588b17737c846154 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Aug 2018 08:53:39 +0200 Subject: migration-test: Clean up string interpolation into QMP, part 1 Leaving interpolation into JSON to qmp() is more robust than building QMP input manually, as explained in the recent commit "tests: Clean up string interpolation into QMP input (simple cases)". migrate_recover() builds QMP input manually because wait_command() can't interpolate. Well, it can since the previous commit. Simplify accordingly. Bonus: gets rid of a non-literal format string. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Cc: Juan Quintela Cc: Dr. David Alan Gilbert Signed-off-by: Markus Armbruster Reviewed-by: Juan Quintela Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-19-armbru@redhat.com> --- tests/migration-test.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/migration-test.c') diff --git a/tests/migration-test.c b/tests/migration-test.c index 7bffcd2e4d..4b8d4cc119 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -159,6 +159,7 @@ static void stop_cb(void *opaque, const char *name, QDict *data) /* * Events can get in the way of responses we are actually waiting for. */ +GCC_FMT_ATTR(2, 3) static QDict *wait_command(QTestState *who, const char *command, ...) { va_list ap; @@ -357,13 +358,12 @@ static void migrate_pause(QTestState *who) static void migrate_recover(QTestState *who, const char *uri) { QDict *rsp; - gchar *cmd = g_strdup_printf( - "{ 'execute': 'migrate-recover', " - " 'id': 'recover-cmd', " - " 'arguments': { 'uri': '%s' } }", uri); - rsp = wait_command(who, cmd); - g_free(cmd); + rsp = wait_command(who, + "{ 'execute': 'migrate-recover', " + " 'id': 'recover-cmd', " + " 'arguments': { 'uri': %s } }", + uri); qobject_unref(rsp); } -- cgit v1.2.3 From b5bbd3f315d686bd511f5be72e4aab3b2bd52de8 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Aug 2018 08:53:40 +0200 Subject: migration-test: Clean up string interpolation into QMP, part 2 Leaving interpolation into JSON to qmp() is more robust than building QMP input manually, as explained in the recent commit "tests: Clean up string interpolation into QMP input (simple cases)". migrate() interpolates members into a JSON object. Change it to take its extra QMP arguments as arguments for qdict_from_jsonf_nofail() instead of a string containing JSON members. Bonus: gets rid of a non-literal format string. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Cc: Juan Quintela Cc: Dr. David Alan Gilbert Signed-off-by: Markus Armbruster Reviewed-by: Juan Quintela Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-20-armbru@redhat.com> --- tests/migration-test.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'tests/migration-test.c') diff --git a/tests/migration-test.c b/tests/migration-test.c index 4b8d4cc119..c7f3267fa0 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -14,6 +14,7 @@ #include "libqtest.h" #include "qapi/qmp/qdict.h" +#include "qapi/qmp/qjson.h" #include "qemu/option.h" #include "qemu/range.h" #include "qemu/sockets.h" @@ -384,16 +385,25 @@ static void migrate_set_capability(QTestState *who, const char *capability, qobject_unref(rsp); } -static void migrate(QTestState *who, const char *uri, const char *extra) +/* + * Send QMP command "migrate". + * Arguments are built from @fmt... (formatted like + * qobject_from_jsonf_nofail()) with "uri": @uri spliced in. + */ +GCC_FMT_ATTR(3, 4) +static void migrate(QTestState *who, const char *uri, const char *fmt, ...) { - QDict *rsp; - gchar *cmd; + va_list ap; + QDict *args, *rsp; - cmd = g_strdup_printf("{ 'execute': 'migrate'," - " 'arguments': { 'uri': '%s' %s } }", - uri, extra ? extra : ""); - rsp = qtest_qmp(who, cmd); - g_free(cmd); + va_start(ap, fmt); + args = qdict_from_vjsonf_nofail(fmt, ap); + va_end(ap); + + g_assert(!qdict_haskey(args, "uri")); + qdict_put_str(args, "uri", uri); + + rsp = qmp("{ 'execute': 'migrate', 'arguments': %p}", args); g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); } @@ -585,7 +595,7 @@ static int migrate_postcopy_prepare(QTestState **from_ptr, /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - migrate(from, uri, NULL); + migrate(from, uri, "{}"); g_free(uri); wait_for_migration_pass(from); @@ -668,7 +678,7 @@ static void test_postcopy_recovery(void) * the newly created channel */ wait_for_migration_status(from, "postcopy-paused"); - migrate(from, uri, ", 'resume': true"); + migrate(from, uri, "{'resume': true}"); g_free(uri); /* Restore the postcopy bandwidth to unlimited */ @@ -687,7 +697,7 @@ static void test_baddest(void) if (test_migrate_start(&from, &to, "tcp:0:0", true)) { return; } - migrate(from, "tcp:0:0", NULL); + migrate(from, "tcp:0:0", "{}"); do { status = migrate_query_status(from); g_assert(!strcmp(status, "setup") || !(strcmp(status, "failed"))); @@ -725,7 +735,7 @@ static void test_precopy_unix(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - migrate(from, uri, NULL); + migrate(from, uri, "{}"); wait_for_migration_pass(from); -- cgit v1.2.3 From c44a56d8ba1c13fea5c9d045ac178638807079cc Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 6 Aug 2018 08:53:41 +0200 Subject: migration-test: Clean up string interpolation into QMP, part 3 Leaving interpolation into JSON to qmp() is more robust than building QMP input manually, as explained in the recent commit "tests: Clean up string interpolation into QMP input (simple cases)". migration-test.c interpolates strings into JSON in a few places: * migrate_set_parameter() interpolates string parameter @value as a JSON number. Change it to long long. This requires changing migrate_check_parameter() similarly. * migrate_set_capability() interpolates string parameter @value as a JSON boolean. Change it to bool. * deprecated_set_speed() interpolates string parameter @value as a JSON number. Change it to long long. Bonus: gets rid of non-literal format strings. A step towards compile-time format string checking without triggering -Wformat-nonliteral. Cc: Juan Quintela Cc: Dr. David Alan Gilbert Signed-off-by: Markus Armbruster Reviewed-by: Juan Quintela Reviewed-by: Eric Blake Message-Id: <20180806065344.7103-21-armbru@redhat.com> --- tests/migration-test.c | 76 ++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 46 deletions(-) (limited to 'tests/migration-test.c') diff --git a/tests/migration-test.c b/tests/migration-test.c index c7f3267fa0..eb58d0a48e 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -318,31 +318,25 @@ static void cleanup(const char *filename) } static void migrate_check_parameter(QTestState *who, const char *parameter, - const char *value) + long long value) { QDict *rsp_return; - char *result; rsp_return = wait_command(who, "{ 'execute': 'query-migrate-parameters' }"); - result = g_strdup_printf("%" PRId64, - qdict_get_try_int(rsp_return, parameter, -1)); - g_assert_cmpstr(result, ==, value); - g_free(result); + g_assert_cmpint(qdict_get_int(rsp_return, parameter), ==, value); qobject_unref(rsp_return); } static void migrate_set_parameter(QTestState *who, const char *parameter, - const char *value) + long long value) { QDict *rsp; - gchar *cmd; - cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters'," - "'arguments': { '%s': %s } }", - parameter, value); - rsp = qtest_qmp(who, cmd); - g_free(cmd); + rsp = qtest_qmp(who, + "{ 'execute': 'migrate-set-parameters'," + "'arguments': { %s: %lld } }", + parameter, value); g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); migrate_check_parameter(who, parameter, value); @@ -369,18 +363,16 @@ static void migrate_recover(QTestState *who, const char *uri) } static void migrate_set_capability(QTestState *who, const char *capability, - const char *value) + bool value) { QDict *rsp; - gchar *cmd; - - cmd = g_strdup_printf("{ 'execute': 'migrate-set-capabilities'," - "'arguments': { " - "'capabilities': [ { " - "'capability': '%s', 'state': %s } ] } }", - capability, value); - rsp = qtest_qmp(who, cmd); - g_free(cmd); + + rsp = qtest_qmp(who, + "{ 'execute': 'migrate-set-capabilities'," + "'arguments': { " + "'capabilities': [ { " + "'capability': %s, 'state': %i } ] } }", + capability, value); g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); } @@ -530,29 +522,21 @@ static void test_migrate_end(QTestState *from, QTestState *to, bool test_dest) static void deprecated_set_downtime(QTestState *who, const double value) { QDict *rsp; - char *expected; - int64_t result_int; rsp = qtest_qmp(who, "{ 'execute': 'migrate_set_downtime'," " 'arguments': { 'value': %f } }", value); g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); - result_int = value * 1000L; - expected = g_strdup_printf("%" PRId64, result_int); - migrate_check_parameter(who, "downtime-limit", expected); - g_free(expected); + migrate_check_parameter(who, "downtime-limit", value * 1000); } -static void deprecated_set_speed(QTestState *who, const char *value) +static void deprecated_set_speed(QTestState *who, long long value) { QDict *rsp; - gchar *cmd; - cmd = g_strdup_printf("{ 'execute': 'migrate_set_speed'," - "'arguments': { 'value': %s } }", value); - rsp = qtest_qmp(who, cmd); - g_free(cmd); + rsp = qtest_qmp(who, "{ 'execute': 'migrate_set_speed'," + "'arguments': { 'value': %lld } }", value); g_assert(qdict_haskey(rsp, "return")); qobject_unref(rsp); migrate_check_parameter(who, "max-bandwidth", value); @@ -565,7 +549,7 @@ static void test_deprecated(void) from = qtest_start(""); deprecated_set_downtime(from, 0.12345); - deprecated_set_speed(from, "12345"); + deprecated_set_speed(from, 12345); qtest_quit(from); } @@ -581,16 +565,16 @@ static int migrate_postcopy_prepare(QTestState **from_ptr, return -1; } - migrate_set_capability(from, "postcopy-ram", "true"); - migrate_set_capability(to, "postcopy-ram", "true"); - migrate_set_capability(to, "postcopy-blocktime", "true"); + migrate_set_capability(from, "postcopy-ram", true); + migrate_set_capability(to, "postcopy-ram", true); + migrate_set_capability(to, "postcopy-blocktime", true); /* We want to pick a speed slow enough that the test completes * quickly, but that it doesn't complete precopy even on a slow * machine, so also set the downtime. */ - migrate_set_parameter(from, "max-bandwidth", "100000000"); - migrate_set_parameter(from, "downtime-limit", "1"); + migrate_set_parameter(from, "max-bandwidth", 100000000); + migrate_set_parameter(from, "downtime-limit", 1); /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); @@ -641,7 +625,7 @@ static void test_postcopy_recovery(void) } /* Turn postcopy speed down, 4K/s is slow enough on any machines */ - migrate_set_parameter(from, "max-postcopy-bandwidth", "4096"); + migrate_set_parameter(from, "max-postcopy-bandwidth", 4096); /* Now we start the postcopy */ migrate_postcopy_start(from, to); @@ -682,7 +666,7 @@ static void test_postcopy_recovery(void) g_free(uri); /* Restore the postcopy bandwidth to unlimited */ - migrate_set_parameter(from, "max-postcopy-bandwidth", "0"); + migrate_set_parameter(from, "max-postcopy-bandwidth", 0); migrate_postcopy_complete(from, to); } @@ -728,9 +712,9 @@ static void test_precopy_unix(void) * machine, so also set the downtime. */ /* 1 ms should make it not converge*/ - migrate_set_parameter(from, "downtime-limit", "1"); + migrate_set_parameter(from, "downtime-limit", 1); /* 1GB/s */ - migrate_set_parameter(from, "max-bandwidth", "1000000000"); + migrate_set_parameter(from, "max-bandwidth", 1000000000); /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); @@ -740,7 +724,7 @@ static void test_precopy_unix(void) wait_for_migration_pass(from); /* 300 ms should converge */ - migrate_set_parameter(from, "downtime-limit", "300"); + migrate_set_parameter(from, "downtime-limit", 300); if (!got_stop) { qtest_qmp_eventwait(from, "STOP"); -- cgit v1.2.3