From nobody Sun Nov 2 03:14:20 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509004495003810.8149122612855; Thu, 26 Oct 2017 00:54:55 -0700 (PDT) Received: from localhost ([::1]:51476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7czt-0005jk-Rp for importer@patchew.org; Thu, 26 Oct 2017 03:54:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cxt-0004eY-6A for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7cxq-0007wh-6i for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34326) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7cxp-0007wD-UQ for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0BA937EE9 for ; Thu, 26 Oct 2017 07:52:28 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5619A5DD6D; Thu, 26 Oct 2017 07:52:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D0BA937EE9 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 09:52:13 +0200 Message-Id: <20171026075222.27798-2-quintela@redhat.com> In-Reply-To: <20171026075222.27798-1-quintela@redhat.com> References: <20171026075222.27798-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 26 Oct 2017 07:52:28 +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 v2 01/10] tests: rename postcopy-test to 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" Instead of repeating the code, we are going to bo more tests on this file Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- MAINTAINERS | 1 + tests/Makefile.include | 6 +++--- tests/{postcopy-test.c =3D> migration-test.c} | 8 +++----- 3 files changed, 7 insertions(+), 8 deletions(-) rename tests/{postcopy-test.c =3D> migration-test.c} (98%) diff --git a/MAINTAINERS b/MAINTAINERS index 12175425a7..8d0a3de734 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1562,6 +1562,7 @@ F: include/migration/ F: migration/ F: scripts/vmstate-static-checker.py F: tests/vmstate-static-checker-data/ +F: tests/migration-test.c F: docs/devel/migration.txt F: qapi/migration.json =20 diff --git a/tests/Makefile.include b/tests/Makefile.include index 70dc711bca..434a2ce868 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -287,7 +287,7 @@ endif check-qtest-i386-$(CONFIG_SLIRP) +=3D tests/test-netfilter$(EXESUF) check-qtest-i386-$(CONFIG_POSIX) +=3D tests/test-filter-mirror$(EXESUF) check-qtest-i386-$(CONFIG_POSIX) +=3D tests/test-filter-redirector$(EXESUF) -check-qtest-i386-y +=3D tests/postcopy-test$(EXESUF) +check-qtest-i386-y +=3D tests/migration-test$(EXESUF) check-qtest-i386-y +=3D tests/test-x86-cpuid-compat$(EXESUF) check-qtest-i386-y +=3D tests/numa-test$(EXESUF) check-qtest-x86_64-y +=3D $(check-qtest-i386-y) @@ -315,7 +315,7 @@ check-qtest-ppc64-y +=3D tests/boot-order-test$(EXESUF) check-qtest-ppc64-y +=3D tests/prom-env-test$(EXESUF) check-qtest-ppc64-y +=3D tests/pnv-xscom-test$(EXESUF) check-qtest-ppc64-y +=3D tests/drive_del-test$(EXESUF) -check-qtest-ppc64-y +=3D tests/postcopy-test$(EXESUF) +check-qtest-ppc64-y +=3D tests/migration-test$(EXESUF) check-qtest-ppc64-y +=3D tests/boot-serial-test$(EXESUF) check-qtest-ppc64-y +=3D tests/rtas-test$(EXESUF) check-qtest-ppc64-$(CONFIG_SLIRP) +=3D tests/pxe-test$(EXESUF) @@ -784,7 +784,7 @@ tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-te= st.o $(libqos-usb-obj-y) tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-o= bj-y) tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-o= bj-y) tests/pc-cpu-test$(EXESUF): tests/pc-cpu-test.o -tests/postcopy-test$(EXESUF): tests/postcopy-test.o +tests/migration-test$(EXESUF): tests/migration-test.o tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o $(test-util-obj-y)= \ $(qtest-obj-y) $(test-io-obj-y) $(libqos-virtio-obj-y) $(libqos-pc-obj-y)= \ $(chardev-obj-y) diff --git a/tests/postcopy-test.c b/tests/migration-test.c similarity index 98% rename from tests/postcopy-test.c rename to tests/migration-test.c index 8142f2ab90..55c4aed719 100644 --- a/tests/postcopy-test.c +++ b/tests/migration-test.c @@ -1,5 +1,5 @@ /* - * QTest testcase for postcopy + * QTest testcase for migration * * Copyright (c) 2016 Red Hat, Inc. and/or its affiliates * based on the vhost-user-test.c that is: @@ -243,8 +243,6 @@ static QDict *return_or_event(QDict *response) /* * It's tricky to use qemu's migration event capability with qtest, * events suddenly appearing confuse the qmp()/hmp() responses. - * so wait for a couple of passes to have happened before - * going postcopy. */ =20 static uint64_t get_migration_pass(void) @@ -504,7 +502,7 @@ static void test_migrate(void) =20 int main(int argc, char **argv) { - char template[] =3D "/tmp/postcopy-test-XXXXXX"; + char template[] =3D "/tmp/migration-test-XXXXXX"; int ret; =20 g_test_init(&argc, &argv, NULL); @@ -521,7 +519,7 @@ int main(int argc, char **argv) =20 module_call_init(MODULE_INIT_QOM); =20 - qtest_add_func("/postcopy", test_migrate); + qtest_add_func("/migration/postcopy/unix", test_migrate); =20 ret =3D g_test_run(); =20 --=20 2.13.6 From nobody Sun Nov 2 03:14:20 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509004636909474.2290166528951; Thu, 26 Oct 2017 00:57:16 -0700 (PDT) Received: from localhost ([::1]:51488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d2F-0007nj-Uw for importer@patchew.org; Thu, 26 Oct 2017 03:57:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cxt-0004ea-6N for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7cxr-0007xi-Nw for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34398) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7cxr-0007x4-G8 for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:31 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8202F2CE94B for ; Thu, 26 Oct 2017 07:52:30 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31E915DD6D; Thu, 26 Oct 2017 07:52:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8202F2CE94B Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 09:52:14 +0200 Message-Id: <20171026075222.27798-3-quintela@redhat.com> In-Reply-To: <20171026075222.27798-1-quintela@redhat.com> References: <20171026075222.27798-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 26 Oct 2017 07:52:30 +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 v2 02/10] tests: Refactor setting of parameters/capabilities 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" So we can use them in future tests Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- tests/migration-test.c | 101 +++++++++++++++++++++++++++++++--------------= ---- 1 file changed, 64 insertions(+), 37 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 55c4aed719..19a1445076 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -351,12 +351,69 @@ static void cleanup(const char *filename) g_free(path); } =20 +static void migrate_set_downtime(QTestState *who, const char *value) +{ + QDict *rsp; + gchar *cmd; + + cmd =3D g_strdup_printf("{ 'execute': 'migrate_set_downtime'," + "'arguments': { 'value': %s } }", value); + rsp =3D qtest_qmp(who, cmd); + g_free(cmd); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); +} + +static void migrate_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); +} + +static void migrate_set_capability(QTestState *who, const char *capability, + const char *value) +{ + QDict *rsp; + gchar *cmd; + + cmd =3D g_strdup_printf("{ 'execute': 'migrate-set-capabilities'," + "'arguments': { " + "'capabilities': [ { " + "'capability': '%s', 'state': %s } ] } }", + capability, value); + rsp =3D qtest_qmp(who, cmd); + g_free(cmd); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); +} + +static void migrate(QTestState *who, const char *uri) +{ + QDict *rsp; + gchar *cmd; + + cmd =3D g_strdup_printf("{ 'execute': 'migrate'," + "'arguments': { 'uri': '%s' } }", + uri); + rsp =3D qtest_qmp(who, cmd); + g_free(cmd); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); +} + static void test_migrate(void) { char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *global =3D global_qtest, *from, *to; unsigned char dest_byte_a, dest_byte_b, dest_byte_c, dest_byte_d; - gchar *cmd, *cmd_src, *cmd_dst; + gchar *cmd_src, *cmd_dst; QDict *rsp; =20 char *bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); @@ -405,52 +462,22 @@ static void test_migrate(void) to =3D qtest_init(cmd_dst); g_free(cmd_dst); =20 - global_qtest =3D from; - rsp =3D qmp("{ 'execute': 'migrate-set-capabilities'," - "'arguments': { " - "'capabilities': [ {" - "'capability': 'postcopy-ram'," - "'state': true } ] } }"); - g_assert(qdict_haskey(rsp, "return")); - QDECREF(rsp); - - global_qtest =3D to; - rsp =3D qmp("{ 'execute': 'migrate-set-capabilities'," - "'arguments': { " - "'capabilities': [ {" - "'capability': 'postcopy-ram'," - "'state': true } ] } }"); - g_assert(qdict_haskey(rsp, "return")); - QDECREF(rsp); + migrate_set_capability(from, "postcopy-ram", "true"); + migrate_set_capability(to, "postcopy-ram", "true"); =20 /* 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. */ - global_qtest =3D from; - rsp =3D qmp("{ 'execute': 'migrate_set_speed'," - "'arguments': { 'value': 100000000 } }"); - g_assert(qdict_haskey(rsp, "return")); - QDECREF(rsp); - - /* 1ms downtime - it should never finish precopy */ - rsp =3D qmp("{ 'execute': 'migrate_set_downtime'," - "'arguments': { 'value': 0.001 } }"); - g_assert(qdict_haskey(rsp, "return")); - QDECREF(rsp); - + migrate_set_speed(from, "100000000"); + migrate_set_downtime(from, "0.001"); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - cmd =3D g_strdup_printf("{ 'execute': 'migrate'," - "'arguments': { 'uri': '%s' } }", - uri); - rsp =3D qmp(cmd); - g_free(cmd); - g_assert(qdict_haskey(rsp, "return")); - QDECREF(rsp); + migrate(from, uri); =20 + global_qtest =3D from; wait_for_migration_pass(); =20 rsp =3D return_or_event(qmp("{ 'execute': 'migrate-start-postcopy' }")= ); --=20 2.13.6 From nobody Sun Nov 2 03:14:20 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509004821435766.4366571390557; Thu, 26 Oct 2017 01:00:21 -0700 (PDT) Received: from localhost ([::1]:51503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d58-0001lt-U7 for importer@patchew.org; Thu, 26 Oct 2017 04:00:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cxu-0004en-GG for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7cxt-0007yr-Ea for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27153) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7cxt-0007yC-6W for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:33 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 313F780B2A for ; Thu, 26 Oct 2017 07:52:32 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id D55847B533; Thu, 26 Oct 2017 07:52:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 313F780B2A Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 09:52:15 +0200 Message-Id: <20171026075222.27798-4-quintela@redhat.com> In-Reply-To: <20171026075222.27798-1-quintela@redhat.com> References: <20171026075222.27798-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 26 Oct 2017 07:52:32 +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 v2 03/10] tests: Factorize out migrate_test_start/end 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 fix global_test users left and right Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- tests/migration-test.c | 86 ++++++++++++++++++++++++++++------------------= ---- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 19a1445076..91fb0277d6 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -301,7 +301,7 @@ static void wait_for_migration_pass(void) } while (pass =3D=3D initial_pass && !got_stop); } =20 -static void check_guests_ram(void) +static void check_guests_ram(QTestState *who) { /* Our ASM test will have been incrementing one byte from each page fr= om * 1MB to <100MB in order. @@ -316,13 +316,13 @@ static void check_guests_ram(void) bool hit_edge =3D false; bool bad =3D false; =20 - qtest_memread(global_qtest, start_address, &first_byte, 1); + qtest_memread(who, start_address, &first_byte, 1); last_byte =3D first_byte; =20 for (address =3D start_address + 4096; address < end_address; address = +=3D 4096) { uint8_t b; - qtest_memread(global_qtest, address, &b, 1); + qtest_memread(who, address, &b, 1); if (b !=3D last_byte) { if (((b + 1) % 256) =3D=3D last_byte && !hit_edge) { /* This is OK, the guest stopped at the point of @@ -408,14 +408,10 @@ static void migrate(QTestState *who, const char *uri) QDECREF(rsp); } =20 -static void test_migrate(void) +static void test_migrate_start(QTestState **from, QTestState **to, + const char *uri) { - char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - QTestState *global =3D global_qtest, *from, *to; - unsigned char dest_byte_a, dest_byte_b, dest_byte_c, dest_byte_d; gchar *cmd_src, *cmd_dst; - QDict *rsp; - char *bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); const char *arch =3D qtest_get_arch(); =20 @@ -456,11 +452,51 @@ static void test_migrate(void) =20 g_free(bootpath); =20 - from =3D qtest_start(cmd_src); + *from =3D qtest_start(cmd_src); g_free(cmd_src); =20 - to =3D qtest_init(cmd_dst); + *to =3D qtest_init(cmd_dst); g_free(cmd_dst); +} + +static void test_migrate_end(QTestState *from, QTestState *to) +{ + unsigned char dest_byte_a, dest_byte_b, dest_byte_c, dest_byte_d; + + qtest_quit(from); + + qtest_memread(to, start_address, &dest_byte_a, 1); + + /* Destination still running, wait for a byte to change */ + do { + qtest_memread(to, start_address, &dest_byte_b, 1); + usleep(10 * 1000); + } while (dest_byte_a =3D=3D dest_byte_b); + + qtest_qmp_discard_response(to, "{ 'execute' : 'stop'}"); + /* With it stopped, check nothing changes */ + qtest_memread(to, start_address, &dest_byte_c, 1); + sleep(1); + qtest_memread(to, start_address, &dest_byte_d, 1); + g_assert_cmpint(dest_byte_c, =3D=3D, dest_byte_d); + + check_guests_ram(to); + + 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); + QTestState *global =3D global_qtest, *from, *to; + QDict *rsp; + + test_migrate_start(&from, &to, uri); =20 migrate_set_capability(from, "postcopy-ram", "true"); migrate_set_capability(to, "postcopy-ram", "true"); @@ -495,36 +531,10 @@ static void test_migrate(void) global_qtest =3D from; wait_for_migration_complete(); =20 - qtest_quit(from); - - global_qtest =3D to; - - qtest_memread(to, start_address, &dest_byte_a, 1); - - /* Destination still running, wait for a byte to change */ - do { - qtest_memread(to, start_address, &dest_byte_b, 1); - usleep(10 * 1000); - } while (dest_byte_a =3D=3D dest_byte_b); - - qmp_discard_response("{ 'execute' : 'stop'}"); - /* With it stopped, check nothing changes */ - qtest_memread(to, start_address, &dest_byte_c, 1); - sleep(1); - qtest_memread(to, start_address, &dest_byte_d, 1); - g_assert_cmpint(dest_byte_c, =3D=3D, dest_byte_d); - - check_guests_ram(); - - qtest_quit(to); g_free(uri); - global_qtest =3D global; =20 - cleanup("bootsect"); - cleanup("migsocket"); - cleanup("src_serial"); - cleanup("dest_serial"); + test_migrate_end(from, to); } =20 int main(int argc, char **argv) --=20 2.13.6 From nobody Sun Nov 2 03:14:20 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509004496671751.8652577705741; Thu, 26 Oct 2017 00:54:56 -0700 (PDT) Received: from localhost ([::1]:51478 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7czy-0005pG-CY for importer@patchew.org; Thu, 26 Oct 2017 03:54:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46923) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cxw-0004fX-61 for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7cxv-00080q-3y for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45456) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7cxu-0007zO-Rm for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:35 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E16EB7C82B for ; Thu, 26 Oct 2017 07:52:33 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 860035DD6D; Thu, 26 Oct 2017 07:52:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E16EB7C82B Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 09:52:16 +0200 Message-Id: <20171026075222.27798-5-quintela@redhat.com> In-Reply-To: <20171026075222.27798-1-quintela@redhat.com> References: <20171026075222.27798-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 26 Oct 2017 07:52:34 +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 v2 04/10] tests: Don't abuse global_qtest 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_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As we have two guests running, just pass always who we want to send a message to. Once there, refactor return_or_event() into wait_command. Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- tests/migration-test.c | 55 +++++++++++++++++++++++++---------------------= ---- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 91fb0277d6..c429a13403 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -223,20 +223,23 @@ static void wait_for_serial(const char *side) /* * Events can get in the way of responses we are actually waiting for. */ -static QDict *return_or_event(QDict *response) +static QDict *wait_command(QTestState *who, const char *command) { const char *event_string; - if (!qdict_haskey(response, "event")) { - return response; - } + QDict *response; + + response =3D qtest_qmp(who, command); =20 - /* OK, it was an event */ - event_string =3D qdict_get_str(response, "event"); - if (!strcmp(event_string, "STOP")) { - got_stop =3D true; + while (qdict_haskey(response, "event")) { + /* OK, it was an event */ + event_string =3D qdict_get_str(response, "event"); + if (!strcmp(event_string, "STOP")) { + got_stop =3D true; + } + QDECREF(response); + response =3D qtest_qmp_receive(who); } - QDECREF(response); - return return_or_event(qtest_qmp_receive(global_qtest)); + return response; } =20 =20 @@ -245,12 +248,12 @@ static QDict *return_or_event(QDict *response) * events suddenly appearing confuse the qmp()/hmp() responses. */ =20 -static uint64_t get_migration_pass(void) +static uint64_t get_migration_pass(QTestState *who) { QDict *rsp, *rsp_return, *rsp_ram; uint64_t result; =20 - rsp =3D return_or_event(qmp("{ 'execute': 'query-migrate' }")); + rsp =3D wait_command(who, "{ 'execute': 'query-migrate' }"); rsp_return =3D qdict_get_qdict(rsp, "return"); if (!qdict_haskey(rsp_return, "ram")) { /* Still in setup */ @@ -263,7 +266,7 @@ static uint64_t get_migration_pass(void) return result; } =20 -static void wait_for_migration_complete(void) +static void wait_for_migration_complete(QTestState *who) { QDict *rsp, *rsp_return; bool completed; @@ -271,7 +274,7 @@ static void wait_for_migration_complete(void) do { const char *status; =20 - rsp =3D return_or_event(qmp("{ 'execute': 'query-migrate' }")); + rsp =3D wait_command(who, "{ 'execute': 'query-migrate' }"); rsp_return =3D qdict_get_qdict(rsp, "return"); status =3D qdict_get_str(rsp_return, "status"); completed =3D strcmp(status, "completed") =3D=3D 0; @@ -281,14 +284,14 @@ static void wait_for_migration_complete(void) } while (!completed); } =20 -static void wait_for_migration_pass(void) +static void wait_for_migration_pass(QTestState *who) { - uint64_t initial_pass =3D get_migration_pass(); + uint64_t initial_pass =3D get_migration_pass(who); uint64_t pass; =20 /* Wait for the 1st sync */ do { - initial_pass =3D get_migration_pass(); + initial_pass =3D get_migration_pass(who); if (got_stop || initial_pass) { break; } @@ -297,7 +300,7 @@ static void wait_for_migration_pass(void) =20 do { usleep(1000 * 100); - pass =3D get_migration_pass(); + pass =3D get_migration_pass(who); } while (pass =3D=3D initial_pass && !got_stop); } =20 @@ -493,7 +496,7 @@ static void test_migrate_end(QTestState *from, QTestSta= te *to) static void test_migrate(void) { char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - QTestState *global =3D global_qtest, *from, *to; + QTestState *from, *to; QDict *rsp; =20 test_migrate_start(&from, &to, uri); @@ -513,26 +516,22 @@ static void test_migrate(void) =20 migrate(from, uri); =20 - global_qtest =3D from; - wait_for_migration_pass(); + wait_for_migration_pass(from); =20 - rsp =3D return_or_event(qmp("{ 'execute': 'migrate-start-postcopy' }")= ); + rsp =3D wait_command(from, "{ 'execute': 'migrate-start-postcopy' }"); g_assert(qdict_haskey(rsp, "return")); QDECREF(rsp); =20 if (!got_stop) { - qmp_eventwait("STOP"); + qtest_qmp_eventwait(from, "STOP"); } =20 - global_qtest =3D to; - qmp_eventwait("RESUME"); + qtest_qmp_eventwait(to, "RESUME"); =20 wait_for_serial("dest_serial"); - global_qtest =3D from; - wait_for_migration_complete(); + wait_for_migration_complete(from); =20 g_free(uri); - global_qtest =3D global; =20 test_migrate_end(from, to); } --=20 2.13.6 From nobody Sun Nov 2 03:14:20 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 150900465043765.68860825131344; Thu, 26 Oct 2017 00:57:30 -0700 (PDT) Received: from localhost ([::1]:51489 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d2G-0007oK-LH for importer@patchew.org; Thu, 26 Oct 2017 03:57:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cxx-0004gm-Fd for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7cxw-00081j-PN for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34794) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7cxw-00081I-Ja for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:36 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9EB0A2CE97B for ; Thu, 26 Oct 2017 07:52:35 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4291D7B533; Thu, 26 Oct 2017 07:52:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9EB0A2CE97B Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 09:52:17 +0200 Message-Id: <20171026075222.27798-6-quintela@redhat.com> In-Reply-To: <20171026075222.27798-1-quintela@redhat.com> References: <20171026075222.27798-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 26 Oct 2017 07:52:35 +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 v2 05/10] tests: check that migration parameters are really assigned 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" Signed-off-by: Juan Quintela Reviewed-by: Dr. David Alan Gilbert --- tests/migration-test.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index c429a13403..be598d3257 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -354,17 +354,37 @@ static void cleanup(const char *filename) g_free(path); } =20 -static void migrate_set_downtime(QTestState *who, const char *value) +static void migrate_check_parameter(QTestState *who, const char *parameter, + const char *value) +{ + QDict *rsp, *rsp_return; + const char *result; + + rsp =3D wait_command(who, "{ 'execute': 'query-migrate-parameters' }"); + rsp_return =3D qdict_get_qdict(rsp, "return"); + result =3D g_strdup_printf("%" PRId64, + qdict_get_try_int(rsp_return, parameter, -1)= ); + g_assert_cmpstr(result, =3D=3D, value); + QDECREF(rsp); +} + +static void migrate_set_downtime(QTestState *who, const double value) { QDict *rsp; gchar *cmd; + char *expected; + int64_t result_int; =20 cmd =3D g_strdup_printf("{ 'execute': 'migrate_set_downtime'," - "'arguments': { 'value': %s } }", value); + "'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); } =20 static void migrate_set_speed(QTestState *who, const char *value) @@ -378,6 +398,7 @@ static void migrate_set_speed(QTestState *who, const ch= ar *value) g_free(cmd); g_assert(qdict_haskey(rsp, "return")); QDECREF(rsp); + migrate_check_parameter(who, "max-bandwidth", value); } =20 static void migrate_set_capability(QTestState *who, const char *capability, @@ -509,7 +530,7 @@ static void test_migrate(void) * machine, so also set the downtime. */ migrate_set_speed(from, "100000000"); - migrate_set_downtime(from, "0.001"); + migrate_set_downtime(from, 0.001); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); --=20 2.13.6 From nobody Sun Nov 2 03:14:20 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 1509004754438867.6139111031594; Thu, 26 Oct 2017 00:59:14 -0700 (PDT) Received: from localhost ([::1]:51500 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d4L-00018L-Ns for importer@patchew.org; Thu, 26 Oct 2017 03:59:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cxz-0004iz-JO for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7cxy-00082k-LD for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53078) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7cxy-00082G-Bs for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:38 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 53299883B1 for ; Thu, 26 Oct 2017 07:52:37 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3F465DD8C; Thu, 26 Oct 2017 07:52:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 53299883B1 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 09:52:18 +0200 Message-Id: <20171026075222.27798-7-quintela@redhat.com> In-Reply-To: <20171026075222.27798-1-quintela@redhat.com> References: <20171026075222.27798-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 26 Oct 2017 07:52:37 +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 v2 06/10] tests: Add migration precopy 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" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/migration-test.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index be598d3257..a8718770c9 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -401,6 +401,22 @@ static void migrate_set_speed(QTestState *who, const c= har *value) migrate_check_parameter(who, "max-bandwidth", value); } =20 +static void migrate_set_parameter(QTestState *who, const char *parameter, + const char *value) +{ + QDict *rsp; + gchar *cmd; + + cmd =3D g_strdup_printf("{ 'execute': 'migrate-set-parameters'," + "'arguments': { '%s': %s } }", + parameter, value); + rsp =3D qtest_qmp(who, cmd); + g_free(cmd); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); + migrate_check_parameter(who, parameter, value); +} + static void migrate_set_capability(QTestState *who, const char *capability, const char *value) { @@ -514,7 +530,7 @@ static void test_migrate_end(QTestState *from, QTestSta= te *to) cleanup("dest_serial"); } =20 -static void test_migrate(void) +static void test_postcopy(void) { char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; @@ -557,6 +573,53 @@ static void test_migrate(void) test_migrate_end(from, to); } =20 + +static void test_precopy(const char *uri) +{ + QTestState *from, *to; + + test_migrate_start(&from, &to, uri); + + /* 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. + */ + /* 1 ms */ + migrate_set_parameter(from, "downtime-limit", "1"); + /* 1GB/s slow*/ + migrate_set_parameter(from, "max-bandwidth", "1000000000"); + + + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 1GB/s now it should converge */ + migrate_set_parameter(from, "downtime-limit", "300"); + + if (!got_stop) { + qtest_qmp_eventwait(from, "STOP"); + } + + qtest_qmp_eventwait(to, "RESUME"); + + wait_for_serial("dest_serial"); + wait_for_migration_complete(from); + + test_migrate_end(from, to); +} + +static void test_precopy_unix(void) +{ + char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_precopy(uri); + g_free(uri); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -576,7 +639,8 @@ int main(int argc, char **argv) =20 module_call_init(MODULE_INIT_QOM); =20 - qtest_add_func("/migration/postcopy/unix", test_migrate); + qtest_add_func("/migration/precopy/unix", test_precopy_unix); + qtest_add_func("/migration/postcopy/unix", test_postcopy); =20 ret =3D g_test_run(); =20 --=20 2.13.6 From nobody Sun Nov 2 03:14:20 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509004496614490.1071137332017; Thu, 26 Oct 2017 00:54:56 -0700 (PDT) Received: from localhost ([::1]:51479 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d05-0005v1-2w for importer@patchew.org; Thu, 26 Oct 2017 03:54:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cy4-0004lt-Jz for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7cy0-00083y-IC for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45844) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7cy0-00083R-DG for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:40 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65AF3C047B75 for ; Thu, 26 Oct 2017 07:52:39 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6F5D5DD6D; Thu, 26 Oct 2017 07:52:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 65AF3C047B75 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 09:52:19 +0200 Message-Id: <20171026075222.27798-8-quintela@redhat.com> In-Reply-To: <20171026075222.27798-1-quintela@redhat.com> References: <20171026075222.27798-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 26 Oct 2017 07:52:39 +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 v2 07/10] tests: Add basic migration precopy tcp 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_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/migration-test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index a8718770c9..338254bafe 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -620,6 +620,13 @@ static void test_precopy_unix(void) g_free(uri); } =20 +static void test_precopy_tcp(void) +{ + const char *uri =3D "tcp:0:44444"; + + test_precopy(uri); +} + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -640,6 +647,7 @@ int main(int argc, char **argv) module_call_init(MODULE_INIT_QOM); =20 qtest_add_func("/migration/precopy/unix", test_precopy_unix); + qtest_add_func("/migration/precopy/tcp", test_precopy_tcp); qtest_add_func("/migration/postcopy/unix", test_postcopy); =20 ret =3D g_test_run(); --=20 2.13.6 From nobody Sun Nov 2 03:14:20 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15090046363970.7646914379928376; Thu, 26 Oct 2017 00:57:16 -0700 (PDT) Received: from localhost ([::1]:51490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d2R-0007vp-KC for importer@patchew.org; Thu, 26 Oct 2017 03:57:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cy7-0004oL-JK for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7cy6-00086k-Mn for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53232) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7cy6-00086O-Gw for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:46 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8171A8210D for ; Thu, 26 Oct 2017 07:52:45 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB7175DD6D; Thu, 26 Oct 2017 07:52:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8171A8210D Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 09:52:20 +0200 Message-Id: <20171026075222.27798-9-quintela@redhat.com> In-Reply-To: <20171026075222.27798-1-quintela@redhat.com> References: <20171026075222.27798-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 26 Oct 2017 07:52:45 +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 v2 08/10] tests: Add precopy test using deprecated commands 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" Once there, make postcopy test to use the new commands now that we have other test for deprecated ones Signed-off-by: Juan Quintela --- tests/migration-test.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++= -- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 338254bafe..b72dff3917 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -545,8 +545,8 @@ static void test_postcopy(void) * quickly, but that it doesn't complete precopy even on a slow * machine, so also set the downtime. */ - migrate_set_speed(from, "100000000"); - migrate_set_downtime(from, 0.001); + migrate_set_parameter(from, "max-bandwidth", "1000000000"); + migrate_set_parameter(from, "downtime-limit", "1"); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); @@ -573,6 +573,49 @@ static void test_postcopy(void) test_migrate_end(from, to); } =20 +static void test_precopy_deprecated(const char *uri) +{ + QTestState *from, *to; + + test_migrate_start(&from, &to, uri); + + /* 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. + */ + /* 100 ms */ + migrate_set_downtime(from, 0.001); + /* 1MB/s slow*/ + migrate_set_speed(from, "1000000000"); + + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 300ms it should converge */ + migrate_set_downtime(from, 0.3); + + if (!got_stop) { + qtest_qmp_eventwait(from, "STOP"); + } + qtest_qmp_eventwait(to, "RESUME"); + + wait_for_serial("dest_serial"); + wait_for_migration_complete(from); + + test_migrate_end(from, to); +} + +static void test_deprecated_unix(void) +{ + char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_precopy_deprecated(uri); + g_free(uri); +} =20 static void test_precopy(const char *uri) { @@ -648,6 +691,7 @@ int main(int argc, char **argv) =20 qtest_add_func("/migration/precopy/unix", test_precopy_unix); qtest_add_func("/migration/precopy/tcp", test_precopy_tcp); + qtest_add_func("/migration/deprecated/unix", test_deprecated_unix); qtest_add_func("/migration/postcopy/unix", test_postcopy); =20 ret =3D g_test_run(); --=20 2.13.6 From nobody Sun Nov 2 03:14:20 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 1509004881837372.2695477927683; Thu, 26 Oct 2017 01:01:21 -0700 (PDT) Received: from localhost ([::1]:51519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d6M-0002re-Sg for importer@patchew.org; Thu, 26 Oct 2017 04:01:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cy9-0004qA-GH for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7cy8-00087x-GE for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45984) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7cy8-00087M-7K for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:48 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 31E50C047B97 for ; Thu, 26 Oct 2017 07:52:47 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5A485DD6D; Thu, 26 Oct 2017 07:52:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 31E50C047B97 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 09:52:21 +0200 Message-Id: <20171026075222.27798-10-quintela@redhat.com> In-Reply-To: <20171026075222.27798-1-quintela@redhat.com> References: <20171026075222.27798-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 26 Oct 2017 07:52:47 +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 v2 09/10] tests: Add migration xbzrle 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" Signed-off-by: Juan Quintela --- tests/migration-test.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 66 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index b72dff3917..db30b3864b 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -573,6 +573,19 @@ static void test_postcopy(void) test_migrate_end(from, to); } =20 +static void migrate_set_cache_size(QTestState *who, const char *value) +{ + QDict *rsp; + gchar *cmd; + + cmd =3D g_strdup_printf("{ 'execute': 'migrate-set-cache-size'," + "'arguments': { 'value': %s } }", value); + rsp =3D qtest_qmp(who, cmd); + g_free(cmd); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); +} + static void test_precopy_deprecated(const char *uri) { QTestState *from, *to; @@ -588,6 +601,9 @@ static void test_precopy_deprecated(const char *uri) /* 1MB/s slow*/ migrate_set_speed(from, "1000000000"); =20 + /* we don't use xbzrle here, but we test old commands */ + migrate_set_cache_size(from, "33554432"); + /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 @@ -670,6 +686,55 @@ static void test_precopy_tcp(void) test_precopy(uri); } =20 +static void test_xbzrle(const char *uri) +{ + QTestState *from, *to; + + test_migrate_start(&from, &to, uri); + + /* 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. + */ + /* 100 ms */ + migrate_set_parameter(from, "downtime-limit", "1"); + /* 1MB/s slow*/ + migrate_set_parameter(from, "max-bandwidth", "1000000000"); + + migrate_set_parameter(from, "xbzrle-cache-size", "33554432"); + + migrate_set_capability(from, "xbzrle", "true"); + migrate_set_capability(to, "xbzrle", "true"); + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 300ms it should converge */ + migrate_set_parameter(from, "downtime-limit", "300"); + + if (!got_stop) { + qtest_qmp_eventwait(from, "STOP"); + } + qtest_qmp_eventwait(to, "RESUME"); + + wait_for_serial("dest_serial"); + wait_for_migration_complete(from); + + test_migrate_end(from, to); +} + +static void test_xbzrle_unix(void) +{ + char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_xbzrle(uri); + g_free(uri); +} + + int main(int argc, char **argv) { char template[] =3D "/tmp/migration-test-XXXXXX"; @@ -693,6 +758,7 @@ int main(int argc, char **argv) qtest_add_func("/migration/precopy/tcp", test_precopy_tcp); qtest_add_func("/migration/deprecated/unix", test_deprecated_unix); qtest_add_func("/migration/postcopy/unix", test_postcopy); + qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix); =20 ret =3D g_test_run(); =20 --=20 2.13.6 From nobody Sun Nov 2 03:14:20 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509004982202921.3840893390562; Thu, 26 Oct 2017 01:03:02 -0700 (PDT) Received: from localhost ([::1]:51530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d7n-00040Z-2I for importer@patchew.org; Thu, 26 Oct 2017 04:02:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cyE-0004uC-Ug for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7cyA-00088s-2K for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43282) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e7cy9-00088M-SD for qemu-devel@nongnu.org; Thu, 26 Oct 2017 03:52:49 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA96ED9643 for ; Thu, 26 Oct 2017 07:52:48 +0000 (UTC) Received: from secure.mitica (ovpn-116-124.ams2.redhat.com [10.36.116.124]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87E5F5DD8C; Thu, 26 Oct 2017 07:52:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DA96ED9643 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=quintela@redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Date: Thu, 26 Oct 2017 09:52:22 +0200 Message-Id: <20171026075222.27798-11-quintela@redhat.com> In-Reply-To: <20171026075222.27798-1-quintela@redhat.com> References: <20171026075222.27798-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 26 Oct 2017 07:52:49 +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 v2 10/10] [RFH] tests: Add migration compress threads tests 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" Yeap, it is still not working. trying to learn how to debug threads for guests running from the testt hardness. For some reason, compression is not working at the moment, test is disabled until I found why. Signed-off-by: Juan Quintela --- tests/migration-test.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 51 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index db30b3864b..d4c4301cd4 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -734,6 +734,54 @@ static void test_xbzrle_unix(void) g_free(uri); } =20 +static void test_compress(const char *uri) +{ + QTestState *from, *to; + + test_migrate_start(&from, &to, uri); + + /* 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. + */ + /* 100 ms */ + migrate_set_parameter(from, "downtime-limit", "100"); + /* 1MB/s slow*/ + migrate_set_parameter(from, "max-bandwidth", "100000000"); + + migrate_set_parameter(from, "compress-threads", "4"); + migrate_set_parameter(from, "decompress-threads", "3"); + + migrate_set_capability(from, "compress", "true"); + migrate_set_capability(to, "compress", "true"); + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + migrate(from, uri); + + wait_for_migration_pass(from); + + /* 1GB/s now it should converge */ + migrate_set_parameter(from, "max-bandwidth", "1000000000"); + + if (!got_stop) { + qtest_qmp_eventwait(from, "STOP"); + } + qtest_qmp_eventwait(to, "RESUME"); + + wait_for_serial("dest_serial"); + wait_for_migration_complete(from); + + test_migrate_end(from, to); +} + +static void test_compress_unix(void) +{ + char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_compress(uri); + g_free(uri); +} =20 int main(int argc, char **argv) { @@ -759,6 +807,9 @@ int main(int argc, char **argv) qtest_add_func("/migration/deprecated/unix", test_deprecated_unix); qtest_add_func("/migration/postcopy/unix", test_postcopy); qtest_add_func("/migration/xbzrle/unix", test_xbzrle_unix); + if (0) { + qtest_add_func("/migration/compress/unix", test_compress_unix); + } =20 ret =3D g_test_run(); =20 --=20 2.13.6