From nobody Tue Oct 28 12:14:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1515189480301375.54210674930346; Fri, 5 Jan 2018 13:58:00 -0800 (PST) Received: from localhost ([::1]:60459 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXZzz-0005vw-Er for importer@patchew.org; Fri, 05 Jan 2018 16:57:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eXZvE-0002P1-6x for qemu-devel@nongnu.org; Fri, 05 Jan 2018 16:53:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eXZvC-0003H9-Qj for qemu-devel@nongnu.org; Fri, 05 Jan 2018 16:53:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42804) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eXZvC-0003Fp-EQ for qemu-devel@nongnu.org; Fri, 05 Jan 2018 16:53:02 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E1CD4E906 for ; Fri, 5 Jan 2018 21:53:01 +0000 (UTC) Received: from secure.mitica (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29F5960473; Fri, 5 Jan 2018 21:52:59 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 5 Jan 2018 22:52:40 +0100 Message-Id: <20180105215246.908-6-quintela@redhat.com> In-Reply-To: <20180105215246.908-1-quintela@redhat.com> References: <20180105215246.908-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 05 Jan 2018 21:53:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 05/11] tests: Add deprecated commands migration test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, dgilbert@redhat.com, peterx@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We add deprecated commands on a new test, so we don't have to add it on normal tests. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/migration-test.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 59 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index f469235d0b..bcb0a82d42 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -513,6 +513,64 @@ static void test_migrate_end(QTestState *from, QTestSt= ate *to) cleanup("dest_serial"); } =20 +static void deprecated_set_downtime(QTestState *who, const double value) +{ + QDict *rsp; + gchar *cmd; + char *expected; + int64_t result_int; + + cmd =3D g_strdup_printf("{ 'execute': 'migrate_set_downtime'," + "'arguments': { 'value': %g } }", value); + rsp =3D qtest_qmp(who, cmd); + g_free(cmd); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); + result_int =3D value * 1000L; + expected =3D g_strdup_printf("%" PRId64, result_int); + migrate_check_parameter(who, "downtime-limit", expected); + g_free(expected); +} + +static void deprecated_set_speed(QTestState *who, const char *value) +{ + QDict *rsp; + gchar *cmd; + + cmd =3D g_strdup_printf("{ 'execute': 'migrate_set_speed'," + "'arguments': { 'value': %s } }", value); + rsp =3D qtest_qmp(who, cmd); + g_free(cmd); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); + migrate_check_parameter(who, "max-bandwidth", value); +} + +static void test_deprecated(void) +{ + char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + QTestState *from, *to; + + /* Create source and destination guests. This way we can reuse + * test_migrate_start */ + test_migrate_start(&from, &to, uri); + + deprecated_set_downtime(from, 0.12345); + deprecated_set_downtime(to, 0.12345); + deprecated_set_speed(from, "12345"); + deprecated_set_speed(to, "12345"); + + g_free(uri); + + qtest_quit(from); + qtest_quit(to); + + cleanup("bootsect"); + cleanup("migsocket"); + cleanup("src_serial"); + cleanup("dest_serial"); +} + static void test_migrate(void) { char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); @@ -580,6 +638,7 @@ int main(int argc, char **argv) module_call_init(MODULE_INIT_QOM); =20 qtest_add_func("/migration/postcopy/unix", test_migrate); + qtest_add_func("/migration/deprecated", test_deprecated); =20 ret =3D g_test_run(); =20 --=20 2.14.3