From patchwork Thu Oct 26 07:52:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 830488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMzlZ12Gtz9t3J for ; Thu, 26 Oct 2017 18:53:26 +1100 (AEDT) Received: from localhost ([::1]:51471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cyg-0004eo-4N for incoming@patchwork.ozlabs.org; Thu, 26 Oct 2017 03:53:22 -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) 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 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 => migration-test.c} | 8 +++----- 3 files changed, 7 insertions(+), 8 deletions(-) rename tests/{postcopy-test.c => 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 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) += tests/test-netfilter$(EXESUF) check-qtest-i386-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF) check-qtest-i386-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF) -check-qtest-i386-y += tests/postcopy-test$(EXESUF) +check-qtest-i386-y += tests/migration-test$(EXESUF) check-qtest-i386-y += tests/test-x86-cpuid-compat$(EXESUF) check-qtest-i386-y += tests/numa-test$(EXESUF) check-qtest-x86_64-y += $(check-qtest-i386-y) @@ -315,7 +315,7 @@ check-qtest-ppc64-y += tests/boot-order-test$(EXESUF) check-qtest-ppc64-y += tests/prom-env-test$(EXESUF) check-qtest-ppc64-y += tests/pnv-xscom-test$(EXESUF) check-qtest-ppc64-y += tests/drive_del-test$(EXESUF) -check-qtest-ppc64-y += tests/postcopy-test$(EXESUF) +check-qtest-ppc64-y += tests/migration-test$(EXESUF) check-qtest-ppc64-y += tests/boot-serial-test$(EXESUF) check-qtest-ppc64-y += tests/rtas-test$(EXESUF) check-qtest-ppc64-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF) @@ -784,7 +784,7 @@ tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-obj-y) tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y) tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-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. */ static uint64_t get_migration_pass(void) @@ -504,7 +502,7 @@ static void test_migrate(void) int main(int argc, char **argv) { - char template[] = "/tmp/postcopy-test-XXXXXX"; + char template[] = "/tmp/migration-test-XXXXXX"; int ret; g_test_init(&argc, &argv, NULL); @@ -521,7 +519,7 @@ int main(int argc, char **argv) module_call_init(MODULE_INIT_QOM); - qtest_add_func("/postcopy", test_migrate); + qtest_add_func("/migration/postcopy/unix", test_migrate); ret = g_test_run(); From patchwork Thu Oct 26 07:52:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 830495 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMzpf6FrRz9t2r for ; Thu, 26 Oct 2017 18:56:10 +1100 (AEDT) Received: from localhost ([::1]:51485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d1M-0006tl-VF for incoming@patchwork.ozlabs.org; Thu, 26 Oct 2017 03:56:09 -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) 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 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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); } +static void migrate_set_downtime(QTestState *who, const char *value) +{ + QDict *rsp; + gchar *cmd; + + cmd = g_strdup_printf("{ 'execute': 'migrate_set_downtime'," + "'arguments': { 'value': %s } }", value); + rsp = 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 = g_strdup_printf("{ 'execute': 'migrate_set_speed'," + "'arguments': { 'value': %s } }", value); + rsp = 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 = g_strdup_printf("{ 'execute': 'migrate-set-capabilities'," + "'arguments': { " + "'capabilities': [ { " + "'capability': '%s', 'state': %s } ] } }", + capability, value); + rsp = 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 = g_strdup_printf("{ 'execute': 'migrate'," + "'arguments': { 'uri': '%s' } }", + uri); + rsp = qtest_qmp(who, cmd); + g_free(cmd); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); +} + static void test_migrate(void) { char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *global = 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; char *bootpath = g_strdup_printf("%s/bootsect", tmpfs); @@ -405,52 +462,22 @@ static void test_migrate(void) to = qtest_init(cmd_dst); g_free(cmd_dst); - global_qtest = from; - rsp = qmp("{ 'execute': 'migrate-set-capabilities'," - "'arguments': { " - "'capabilities': [ {" - "'capability': 'postcopy-ram'," - "'state': true } ] } }"); - g_assert(qdict_haskey(rsp, "return")); - QDECREF(rsp); - - global_qtest = to; - rsp = 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"); /* 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 = from; - rsp = qmp("{ 'execute': 'migrate_set_speed'," - "'arguments': { 'value': 100000000 } }"); - g_assert(qdict_haskey(rsp, "return")); - QDECREF(rsp); - - /* 1ms downtime - it should never finish precopy */ - rsp = 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"); /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); - cmd = g_strdup_printf("{ 'execute': 'migrate'," - "'arguments': { 'uri': '%s' } }", - uri); - rsp = qmp(cmd); - g_free(cmd); - g_assert(qdict_haskey(rsp, "return")); - QDECREF(rsp); + migrate(from, uri); + global_qtest = from; wait_for_migration_pass(); rsp = return_or_event(qmp("{ 'execute': 'migrate-start-postcopy' }")); From patchwork Thu Oct 26 07:52:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 830499 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMzt62h6Xz9t3J for ; Thu, 26 Oct 2017 18:59:10 +1100 (AEDT) Received: from localhost ([::1]:51498 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d4G-0000wf-Gs for incoming@patchwork.ozlabs.org; Thu, 26 Oct 2017 03:59:08 -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) 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 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 == initial_pass && !got_stop); } -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 from * 1MB to <100MB in order. @@ -316,13 +316,13 @@ static void check_guests_ram(void) bool hit_edge = false; bool bad = false; - qtest_memread(global_qtest, start_address, &first_byte, 1); + qtest_memread(who, start_address, &first_byte, 1); last_byte = first_byte; for (address = start_address + 4096; address < end_address; address += 4096) { uint8_t b; - qtest_memread(global_qtest, address, &b, 1); + qtest_memread(who, address, &b, 1); if (b != last_byte) { if (((b + 1) % 256) == 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); } -static void test_migrate(void) +static void test_migrate_start(QTestState **from, QTestState **to, + const char *uri) { - char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); - QTestState *global = 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 = g_strdup_printf("%s/bootsect", tmpfs); const char *arch = qtest_get_arch(); @@ -456,11 +452,51 @@ static void test_migrate(void) g_free(bootpath); - from = qtest_start(cmd_src); + *from = qtest_start(cmd_src); g_free(cmd_src); - to = qtest_init(cmd_dst); + *to = 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 == 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, ==, 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 = g_strdup_printf("unix:%s/migsocket", tmpfs); + QTestState *global = global_qtest, *from, *to; + QDict *rsp; + + test_migrate_start(&from, &to, uri); 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 = from; wait_for_migration_complete(); - qtest_quit(from); - - global_qtest = 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 == 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, ==, dest_byte_d); - - check_guests_ram(); - - qtest_quit(to); g_free(uri); - global_qtest = global; - cleanup("bootsect"); - cleanup("migsocket"); - cleanup("src_serial"); - cleanup("dest_serial"); + test_migrate_end(from, to); } int main(int argc, char **argv) From patchwork Thu Oct 26 07:52:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 830487 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMzlZ1x8Wz9t43 for ; Thu, 26 Oct 2017 18:53:30 +1100 (AEDT) Received: from localhost ([::1]:51474 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cyl-0004ho-V0 for incoming@patchwork.ozlabs.org; Thu, 26 Oct 2017 03:53:27 -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) 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 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 = qtest_qmp(who, command); - /* OK, it was an event */ - event_string = qdict_get_str(response, "event"); - if (!strcmp(event_string, "STOP")) { - got_stop = true; + 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; + } + QDECREF(response); + response = qtest_qmp_receive(who); } - QDECREF(response); - return return_or_event(qtest_qmp_receive(global_qtest)); + return response; } @@ -245,12 +248,12 @@ static QDict *return_or_event(QDict *response) * events suddenly appearing confuse the qmp()/hmp() responses. */ -static uint64_t get_migration_pass(void) +static uint64_t get_migration_pass(QTestState *who) { QDict *rsp, *rsp_return, *rsp_ram; uint64_t result; - rsp = return_or_event(qmp("{ 'execute': 'query-migrate' }")); + rsp = wait_command(who, "{ 'execute': 'query-migrate' }"); rsp_return = 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; } -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; - rsp = return_or_event(qmp("{ 'execute': 'query-migrate' }")); + rsp = wait_command(who, "{ 'execute': 'query-migrate' }"); rsp_return = qdict_get_qdict(rsp, "return"); status = qdict_get_str(rsp_return, "status"); completed = strcmp(status, "completed") == 0; @@ -281,14 +284,14 @@ static void wait_for_migration_complete(void) } while (!completed); } -static void wait_for_migration_pass(void) +static void wait_for_migration_pass(QTestState *who) { - uint64_t initial_pass = get_migration_pass(); + uint64_t initial_pass = get_migration_pass(who); uint64_t pass; /* Wait for the 1st sync */ do { - initial_pass = get_migration_pass(); + initial_pass = get_migration_pass(who); if (got_stop || initial_pass) { break; } @@ -297,7 +300,7 @@ static void wait_for_migration_pass(void) do { usleep(1000 * 100); - pass = get_migration_pass(); + pass = get_migration_pass(who); } while (pass == initial_pass && !got_stop); } @@ -493,7 +496,7 @@ static void test_migrate_end(QTestState *from, QTestState *to) static void test_migrate(void) { char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); - QTestState *global = global_qtest, *from, *to; + QTestState *from, *to; QDict *rsp; test_migrate_start(&from, &to, uri); @@ -513,26 +516,22 @@ static void test_migrate(void) migrate(from, uri); - global_qtest = from; - wait_for_migration_pass(); + wait_for_migration_pass(from); - rsp = return_or_event(qmp("{ 'execute': 'migrate-start-postcopy' }")); + rsp = wait_command(from, "{ 'execute': 'migrate-start-postcopy' }"); g_assert(qdict_haskey(rsp, "return")); QDECREF(rsp); if (!got_stop) { - qmp_eventwait("STOP"); + qtest_qmp_eventwait(from, "STOP"); } - global_qtest = to; - qmp_eventwait("RESUME"); + qtest_qmp_eventwait(to, "RESUME"); wait_for_serial("dest_serial"); - global_qtest = from; - wait_for_migration_complete(); + wait_for_migration_complete(from); g_free(uri); - global_qtest = global; test_migrate_end(from, to); } From patchwork Thu Oct 26 07:52:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 830496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMzph0sfFz9t2r for ; Thu, 26 Oct 2017 18:56:12 +1100 (AEDT) Received: from localhost ([::1]:51486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d1O-0006vC-5q for incoming@patchwork.ozlabs.org; Thu, 26 Oct 2017 03:56:10 -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) 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 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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); } -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 = wait_command(who, "{ 'execute': 'query-migrate-parameters' }"); + rsp_return = qdict_get_qdict(rsp, "return"); + result = g_strdup_printf("%" PRId64, + qdict_get_try_int(rsp_return, parameter, -1)); + g_assert_cmpstr(result, ==, value); + QDECREF(rsp); +} + +static void migrate_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': %s } }", value); + "'arguments': { 'value': %g } }", value); rsp = qtest_qmp(who, cmd); g_free(cmd); g_assert(qdict_haskey(rsp, "return")); QDECREF(rsp); + result_int = value * 1000L; + expected = g_strdup_printf("%" PRId64, result_int); + migrate_check_parameter(who, "downtime-limit", expected); + g_free(expected); } static void migrate_set_speed(QTestState *who, const char *value) @@ -378,6 +398,7 @@ static void migrate_set_speed(QTestState *who, const char *value) g_free(cmd); g_assert(qdict_haskey(rsp, "return")); QDECREF(rsp); + migrate_check_parameter(who, "max-bandwidth", value); } 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); /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); From patchwork Thu Oct 26 07:52:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 830498 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMzsB3Sn5z9t2r for ; Thu, 26 Oct 2017 18:58:22 +1100 (AEDT) Received: from localhost ([::1]:51494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d3U-0000Ca-Iy for incoming@patchwork.ozlabs.org; Thu, 26 Oct 2017 03:58:20 -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) 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 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 char *value) migrate_check_parameter(who, "max-bandwidth", value); } +static void migrate_set_parameter(QTestState *who, const char *parameter, + const char *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); + 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, QTestState *to) cleanup("dest_serial"); } -static void test_migrate(void) +static void test_postcopy(void) { char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; @@ -557,6 +573,53 @@ static void test_migrate(void) test_migrate_end(from, to); } + +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 = g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_precopy(uri); + g_free(uri); +} + int main(int argc, char **argv) { char template[] = "/tmp/migration-test-XXXXXX"; @@ -576,7 +639,8 @@ int main(int argc, char **argv) module_call_init(MODULE_INIT_QOM); - 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); ret = g_test_run(); From patchwork Thu Oct 26 07:52:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 830490 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMzlh6QCYz9t2r for ; Thu, 26 Oct 2017 18:53:36 +1100 (AEDT) Received: from localhost ([::1]:51475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7cys-0004n8-U2 for incoming@patchwork.ozlabs.org; Thu, 26 Oct 2017 03:53:34 -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) 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 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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); } +static void test_precopy_tcp(void) +{ + const char *uri = "tcp:0:44444"; + + test_precopy(uri); +} + int main(int argc, char **argv) { char template[] = "/tmp/migration-test-XXXXXX"; @@ -640,6 +647,7 @@ int main(int argc, char **argv) module_call_init(MODULE_INIT_QOM); 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); ret = g_test_run(); From patchwork Thu Oct 26 07:52:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 830497 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMzpq6Dgyz9t3J for ; Thu, 26 Oct 2017 18:56:19 +1100 (AEDT) Received: from localhost ([::1]:51487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d1W-00073B-0l for incoming@patchwork.ozlabs.org; Thu, 26 Oct 2017 03:56:18 -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) 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 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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"); /* 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); } +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 = g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_precopy_deprecated(uri); + g_free(uri); +} static void test_precopy(const char *uri) { @@ -648,6 +691,7 @@ int main(int argc, char **argv) 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); ret = g_test_run(); From patchwork Thu Oct 26 07:52:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 830501 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMzvf2BVGz9t2r for ; Thu, 26 Oct 2017 19:00:30 +1100 (AEDT) Received: from localhost ([::1]:51505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d5Y-0001wo-DJ for incoming@patchwork.ozlabs.org; Thu, 26 Oct 2017 04:00:28 -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) 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 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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); } +static void migrate_set_cache_size(QTestState *who, const char *value) +{ + QDict *rsp; + gchar *cmd; + + cmd = g_strdup_printf("{ 'execute': 'migrate-set-cache-size'," + "'arguments': { 'value': %s } }", value); + rsp = 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"); + /* 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"); @@ -670,6 +686,55 @@ static void test_precopy_tcp(void) test_precopy(uri); } +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 = g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_xbzrle(uri); + g_free(uri); +} + + int main(int argc, char **argv) { char template[] = "/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); ret = g_test_run(); From patchwork Thu Oct 26 07:52:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 830506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yMzxk4R9Pz9t2r for ; Thu, 26 Oct 2017 19:02:18 +1100 (AEDT) Received: from localhost ([::1]:51525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7d7I-0003W4-Qd for incoming@patchwork.ozlabs.org; Thu, 26 Oct 2017 04:02:16 -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) 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 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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); } +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 = g_strdup_printf("unix:%s/migsocket", tmpfs); + + test_compress(uri); + g_free(uri); +} 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); + } ret = g_test_run();