From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264713; cv=none; d=zohomail.com; s=zohoarc; b=LWjYyAIW6QN/NP7aIxIKSIYhDgmYQx5ybRgjnV1Upb/kpoHvRcqGsvYuKctZkqretY0N3FiwYetRozKgOhbCFMP1IRvaDtLlPTJpeSHvgHWEEL/4ybA0uFwXqBE22sN1UKyWOfLbHXRmdBXXZG4Jxv8jDGVQ/WuDq63FHsvjza4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264713; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dq81RXNpsqU9ROfSeDC2pruyLMFblvgLeeAHV3g/vVs=; b=VXpZrKkgGqqegVB1z8/hJewbjjo4bL4XCmDCOy8KQgb1knxs4WCo+H5lOxIhtuamPdllerWyte0i04jppM83lfPZH6vAm2s63RZXc7CJm9DTlkVrkQZ2oBQwR5jM5s9KocVzEV5k/ALTr0wPADG9dcK3aZmYoER5ZIk/8NTfGAg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168626471393655.7617869780355; Thu, 8 Jun 2023 15:51:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OS3-0003OZ-75; Thu, 08 Jun 2023 18:49:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OS1-0003OD-QK for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:49:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OS0-0004e9-7W for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:49:53 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-_WnHxS7SNPi1ECcArjZmCw-1; Thu, 08 Jun 2023 18:49:48 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BDE95101A531; Thu, 8 Jun 2023 22:49:47 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DC62492B00; Thu, 8 Jun 2023 22:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dq81RXNpsqU9ROfSeDC2pruyLMFblvgLeeAHV3g/vVs=; b=bAP7eYHWtyURgeJQv0sucBRWjRyr8y0L4UEA3sXUm+ycu/nBuXXYMgwEdJMvgytMinbvHf rmKMCd5cOlknbGjTgoTvFNuoOZ251zpN76Dk/LeXe1+7gcyhUpISfVUZPulRg7h/V9/4hN uQcKLP6WsRYWc7XQqcNCWk1tu7l5GlU= X-MC-Unique: _WnHxS7SNPi1ECcArjZmCw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 01/42] migration-test: Be consistent for ppc Date: Fri, 9 Jun 2023 00:49:02 +0200 Message-Id: <20230608224943.3877-2-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264716046100003 Content-Type: text/plain; charset="utf-8" It makes no sense that we don't have the same configuration on both sides. Signed-off-by: Juan Quintela Reviewed-by: Laurent Vivier --- tests/qtest/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b0c355bbd9..c5e0c69c6b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -646,7 +646,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " "until'", end_address, start_address= ); - arch_target =3D g_strdup(""); + arch_target =3D g_strdup("-nodefaults"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); machine_opts =3D "virt,gic-version=3Dmax"; --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264726; cv=none; d=zohomail.com; s=zohoarc; b=MBWiWTL+M+3W7/UAxEyyRgegjQeTqFMCTVSVjlEX28qZL7PKTP9GE1cTWZKAyHMpTibUHOfchDPodzaYI4fqPFMeHJd0XNnULNG1sgZshJpAxVaYlhROCh3y3/7LBDflZTQdRetqBmrPVSLW4cPae5aZCi5E7XRKS0IbWXS/XwA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264726; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dss+c/xQKMwCZkS1Ig75K0xJ/Ka/v/C8UE28PysQz4k=; b=QnXfeASlWcy7hBgbboO4njHLjoK1f/wYZpdPJgcB4M8f1oeBKocHeEPdQEKZA0/CxjfZv5o67zOmdmIEoS0my/MVjxocu4YJwOZewFniXVerY6nzoYOYn7LnqagE5ZFliLr4cCQ+dFOf4KcGAQpH9NB/7va0d9kJl3gOCUeNdhQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264726173281.8914197834554; Thu, 8 Jun 2023 15:52:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OS4-0003Pb-O0; Thu, 08 Jun 2023 18:49:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OS3-0003OV-2O for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:49:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OS0-0004ef-Kb for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:49:53 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-84-pP5iDa0yMPO0lZ22s0KuNA-1; Thu, 08 Jun 2023 18:49:49 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9173D85A5AA; Thu, 8 Jun 2023 22:49:49 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10228492B00; Thu, 8 Jun 2023 22:49:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dss+c/xQKMwCZkS1Ig75K0xJ/Ka/v/C8UE28PysQz4k=; b=PqZG/FFYSv0DJyj+tmXqPmi/9CUpz//hrM1sw4mp9aDYXyyzWsDLRzljFolD5KLSnzd6rj L/n9NA3wDkA/5WE+qCTFIlxgu0AUBelHik4RMFhmAf5QLcWxJXT1T8fbDs//QUBxKiLc7Z 3vf/5RCFrew6E6a/hNh02C2cJlchwyk= X-MC-Unique: pP5iDa0yMPO0lZ22s0KuNA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 02/42] migration-test: Make ignore_stderr regular with other options Date: Fri, 9 Jun 2023 00:49:03 +0200 Message-Id: <20230608224943.3877-3-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264728117100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index c5e0c69c6b..73b2f01427 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -602,7 +602,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree gchar *arch_target =3D NULL; g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; - const gchar *ignore_stderr; + const gchar *ignore_stderr =3D NULL; g_autofree char *bootpath =3D NULL; g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; @@ -672,10 +672,7 @@ static int test_migrate_start(QTestState **from, QTest= State **to, * IO redirection does not work, so don't bother adding IO redirec= tion * to the command line. */ - ignore_stderr =3D ""; #endif - } else { - ignore_stderr =3D ""; } =20 if (args->use_shmem) { @@ -701,7 +698,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, memory_size, tmpfs, arch_source, shmem_opts, args->opts_source ? args->opts_source : "= ", - ignore_stderr); + ignore_stderr ? ignore_stderr : ""); + if (!args->only_target) { *from =3D qtest_init(cmd_source); qtest_qmp_set_event_callback(*from, @@ -722,7 +720,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, memory_size, tmpfs, uri, arch_target, shmem_opts, args->opts_target ? args->opts_target : "= ", - ignore_stderr); + ignore_stderr ? ignore_stderr : ""); *to =3D qtest_init(cmd_target); qtest_qmp_set_event_callback(*to, migrate_watch_for_resume, --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686265030; cv=none; d=zohomail.com; s=zohoarc; b=ekicRKMcN5iJ2xjpHVWnqmLwdAx8lIOJMbUNMxh/QFs4fevj2EwzsvuyzhX0rsFXS7YavJI2zSVFjJuL6BLaN+iHJJujsoYsESfo3xZtIux3KJ64OnkS8LZvHD0AUOy6knNnkWTnMM23YuN0RviK76ajqF6+8dtw+I1iXs62Cos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265030; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BgcDRFYBNV9ju8W4Pw2TqJHOYtolb4i7/kdjOFJGEaY=; b=dNUStubtDT9lMduIBQf6QXRjiT5kx9mraAFSp2UERv9iPkseDoz2X2XJwkpV+e7DmLbjtse8q4ZAAwqkmXqpGiXEPxPHWWUSGsa+ZtYd8D3YnIuMvPAfKmYwg29w0NWdUUwoiliE+jQCMUUvFtjBogqP7WnjFDp8z3wU11l+Y+k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686265030158996.5911308161254; Thu, 8 Jun 2023 15:57:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OS6-0003Q7-BC; Thu, 08 Jun 2023 18:49:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OS4-0003PQ-9Z for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:49:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OS1-0004fS-Qb for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:49:56 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-315-_POrvDkVM4Cp9ghJYuznRQ-1; Thu, 08 Jun 2023 18:49:51 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63DDF3C0C889; Thu, 8 Jun 2023 22:49:51 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id D77BA492B00; Thu, 8 Jun 2023 22:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264593; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BgcDRFYBNV9ju8W4Pw2TqJHOYtolb4i7/kdjOFJGEaY=; b=Ec6BLRj4ueywQyg4t0SMsXstBBggaqCMlZsvBCua3uW5OJ55wjW10EnEev6cxDlItkHZR8 w430tFnNehb006ZZpNr9eU92pyDjN52AU8gW2KcEmiI5NDGeSJqTdWaalkMbotdNpqLoFk 7XazIqbijonMoNsAm7Qlo7o6OWM9tyI= X-MC-Unique: _POrvDkVM4Cp9ghJYuznRQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 03/42] migration-test: simplify shmem_opts handling Date: Fri, 9 Jun 2023 00:49:04 +0200 Message-Id: <20230608224943.3877-4-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265031216100026 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 73b2f01427..95ccc9bce7 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -681,9 +681,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "-object memory-backend-file,id=3Dmem0,size=3D%s" ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", memory_size, shmem_path); - } else { - shmem_path =3D NULL; - shmem_opts =3D g_strdup(""); } =20 cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg%s%s " @@ -696,7 +693,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, machine_opts ? " -machine " : "", machine_opts ? machine_opts : "", memory_size, tmpfs, - arch_source, shmem_opts, + arch_source, + shmem_opts ? shmem_opts : "", args->opts_source ? args->opts_source : "= ", ignore_stderr ? ignore_stderr : ""); =20 @@ -718,7 +716,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, machine_opts ? " -machine " : "", machine_opts ? machine_opts : "", memory_size, tmpfs, uri, - arch_target, shmem_opts, + arch_target, + shmem_opts ? shmem_opts : "", args->opts_target ? args->opts_target : "= ", ignore_stderr ? ignore_stderr : ""); *to =3D qtest_init(cmd_target); --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686265026; cv=none; d=zohomail.com; s=zohoarc; b=MAfaipuCA3aBQj/jw4UjFdWi+5ORHUg/v0PyXWbshG7CmgCuFGc28N+/aqNCqnhCxf+4kO5BkkNpAy+sBA8mdI2Jkj/pdKcqjhO4wzZxTK7WDHZKa2UEBM5FGtX7JXsX6KxqhQeC///qddl4ZCv3tLMxe5/nD4gi8ylQ8AS6Wa4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265026; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ESbhIoaRf5K2D8oU4vWQC6jQOzPGiH4LNeOksFn+2d8=; b=BC7nBe+6RysGHwSb/lq/5nCL8AH96DnCAX6PbPQPz0LyGtQWSTT7ZMvuqQW6wopDpupRQZ5o4EE//v64hLdSHFBfiEqx379pHqVRWuxnVtDV2z2avKjQovX5gCXWDNdX5087VwB6VaEDt4Y3c/6YUP725S3RGCJkmeQKUIsqhSI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686265026629676.6239426683335; Thu, 8 Jun 2023 15:57:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OS6-0003QD-PI; Thu, 08 Jun 2023 18:49:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OS5-0003Pe-15 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:49:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OS3-0004gF-G9 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:49:56 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-589-i3CcFpQ_MiKqz4amRnBNJg-1; Thu, 08 Jun 2023 18:49:53 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 356C2385556A; Thu, 8 Jun 2023 22:49:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA746515544; Thu, 8 Jun 2023 22:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ESbhIoaRf5K2D8oU4vWQC6jQOzPGiH4LNeOksFn+2d8=; b=EIpgPSExOR05pJIsSTZTeLEmAaVDFNn8Ckkeu5LGDzmMm0tutJ8DgSNsY95YxeWtGBbf4Z j2pogRN7dOVm5MM6ts+CBEsDRNqqSv1tlOW7eaCmZRD29FPbOCwGz2IbC+Jx+fUNpDBl8f A3ahdq1DHaMTiaiRQc7InaJf30dvTlE= X-MC-Unique: i3CcFpQ_MiKqz4amRnBNJg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 04/42] migration-test: Make machine_opts regular with other options Date: Fri, 9 Jun 2023 00:49:05 +0200 Message-Id: <20230608224943.3877-5-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265027169100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 95ccc9bce7..2490035569 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -637,7 +637,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { - machine_opts =3D "vsmt=3D8"; + machine_opts =3D "-machine vsmt=3D8"; memory_size =3D "256M"; start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; @@ -649,7 +649,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, arch_target =3D g_strdup("-nodefaults"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); - machine_opts =3D "virt,gic-version=3Dmax"; + machine_opts =3D "-machine virt,gic-version=3Dmax"; memory_size =3D "150M"; arch_source =3D g_strdup_printf("-cpu max " "-kernel %s", @@ -683,14 +683,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, memory_size, shmem_path); } =20 - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg%s%s " + cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg %s " "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? " -machine " : "", machine_opts ? machine_opts : "", memory_size, tmpfs, arch_source, @@ -705,7 +704,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, &got_src_stop); } =20 - cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg%s%s " + cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg %s " "-name target,debug-threads=3Don " "-m %s " "-serial file:%s/dest_serial " @@ -713,7 +712,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "%s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? " -machine " : "", machine_opts ? machine_opts : "", memory_size, tmpfs, uri, arch_target, --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264677; cv=none; d=zohomail.com; s=zohoarc; b=TlSFFbio99uEB1lDckg+2bMBt4dHQ6oT2Vnl/bLjdwzwWL2LIrmcOTP30Dyj9MDW6z8rOyTUq9eo7ak/1Rcj0PkjtQungQ8gbab19sJhLIMOMRDjUJakFW4zkA0c67S/HBVanzzxFYwi2kKcKyIUegwIECphi3RwzkoSvtB67fI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264677; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3U/nDZfkAHM2XMHlw7/4WKnQZLgo6e/wSxbUi39j2gw=; b=H56HP6tau5KKqp7d5KU1yT1DVIBChhxbwOMFZHmt5rNtP1IDo+rj8OyGVGDWyLx33U00hiI/8iUsb0niW9picVCVICeELjkKIDN4AfO3b0IVuM9zrMIXJpwft820OErcdWRRwqgk4xI8dLPWMuBypHj3A3pNOoJAEfzY0pAVFTU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264677116303.29591229475295; Thu, 8 Jun 2023 15:51:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSA-0003Qz-CQ; Thu, 08 Jun 2023 18:50:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OS8-0003QT-QO for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OS7-0004hu-7F for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:00 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-6XzbSaFXMviwsDDvQBBJOg-1; Thu, 08 Jun 2023 18:49:55 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 090C21C05122; Thu, 8 Jun 2023 22:49:55 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DB2A492B00; Thu, 8 Jun 2023 22:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264598; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3U/nDZfkAHM2XMHlw7/4WKnQZLgo6e/wSxbUi39j2gw=; b=MrZWUFWmNl/RWRcgmpeUWunfRhU5At2A9DjGdqjQGoAyWlvA6rTnIHUG4iLQGc7Dg3vIll WGgwLPjj8QVOVP/7r/pSCEOJfxiGVEnl0ISpbWrwu9DJnIJvBTE382JYsGuI6cvSZcUlom HVPWQJs0f5VaPrh+nXibdcF87+2SXKg= X-MC-Unique: 6XzbSaFXMviwsDDvQBBJOg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 05/42] migration-test: Create arch_opts Date: Fri, 9 Jun 2023 00:49:06 +0200 Message-Id: <20230608224943.3877-6-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264678903100007 Content-Type: text/plain; charset="utf-8" This will contain the options needed for both source and target. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 2490035569..6b4e3bf827 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -600,6 +600,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, { g_autofree gchar *arch_source =3D NULL; g_autofree gchar *arch_target =3D NULL; + /* options for source and target */ + g_autofree gchar *arch_opts =3D NULL; g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; const gchar *ignore_stderr =3D NULL; @@ -625,15 +627,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, assert(sizeof(x86_bootsect) =3D=3D 512); init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); memory_size =3D "150M"; - arch_source =3D g_strdup_printf("-drive file=3D%s,format=3Draw", b= ootpath); - arch_target =3D g_strdup(arch_source); + arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw", boo= tpath); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf)); memory_size =3D "128M"; - arch_source =3D g_strdup_printf("-bios %s", bootpath); - arch_target =3D g_strdup(arch_source); + arch_opts =3D g_strdup_printf("-bios %s", bootpath); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { @@ -641,20 +641,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, memory_size =3D "256M"; start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; - arch_source =3D g_strdup_printf("-nodefaults " - "-prom-env 'use-nvramrc?=3Dtrue' -pr= om-env " + arch_source =3D g_strdup_printf("-prom-env 'use-nvramrc?=3Dtrue' -= prom-env " "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " "until'", end_address, start_address= ); - arch_target =3D g_strdup("-nodefaults"); + arch_opts =3D g_strdup("-nodefaults"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); machine_opts =3D "-machine virt,gic-version=3Dmax"; memory_size =3D "150M"; - arch_source =3D g_strdup_printf("-cpu max " - "-kernel %s", - bootpath); - arch_target =3D g_strdup(arch_source); + arch_opts =3D g_strdup_printf("-cpu max -kernel %s", bootpath); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; =20 @@ -687,12 +683,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " - "%s %s %s %s", + "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", machine_opts ? machine_opts : "", memory_size, tmpfs, - arch_source, + arch_opts ? arch_opts : "", + arch_source ? arch_source : "", shmem_opts ? shmem_opts : "", args->opts_source ? args->opts_source : "= ", ignore_stderr ? ignore_stderr : ""); @@ -709,12 +706,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "-m %s " "-serial file:%s/dest_serial " "-incoming %s " - "%s %s %s %s", + "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", machine_opts ? machine_opts : "", memory_size, tmpfs, uri, - arch_target, + arch_opts ? arch_opts : "", + arch_target ? arch_target : "", shmem_opts ? shmem_opts : "", args->opts_target ? args->opts_target : "= ", ignore_stderr ? ignore_stderr : ""); --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264779; cv=none; d=zohomail.com; s=zohoarc; b=S8gtifaQPRUPcahfhm5beK5yFwC4NYS/OUIMgnnmmKLJpSmAlc7Vh6PHqUxuJ4l7f2URF4ZMQOHNquKxLNAGeOLqwAjn46uoB386ksWcppsis/nHjgjgi3+FVyqDg8SE0J21mViyxvli4Rm9NGZdZwbJxt1AR8eM2SA5JY5spLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264779; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/kE5U9/USKBqLziIKg2DVxXe1qC8HfCM4jJN8Og3wqE=; b=YBXF4L6fmw7ypTtdTESwr2VxnBDFftljRamWklZMsSGtPIDdbIbNuMYTYFpWjDuo2r7L7g2g0XR6Q94Pes8MUD03dyY4OR5aLpN0P3VbkxdP4aUeEa+ffx7XKRhBqGnz/OoYNLHUU/ZQGQHpzM4B9kvoB66rA2wKJ5L3pScRUio= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264779033182.17205045154208; Thu, 8 Jun 2023 15:52:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSE-0003S2-OJ; Thu, 08 Jun 2023 18:50:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSC-0003RB-TE for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSB-0004k3-Co for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:04 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-548-_hWI4WS6NV6kIv5M1xDcAQ-1; Thu, 08 Jun 2023 18:49:57 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 32B4B2A59548; Thu, 8 Jun 2023 22:49:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5175F492B00; Thu, 8 Jun 2023 22:49:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264602; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/kE5U9/USKBqLziIKg2DVxXe1qC8HfCM4jJN8Og3wqE=; b=Jvffk1BnHmpUcHCfQduJmb5xxqyeFaOxYxTVTtPwT/TaJzS0TJgkG1yg0gzf4vEE6+ntxP 1mnIkXP04q7WP3d7I3DlTsE9lUoCVFaPDrucAbae/GiuXJkYw1kZYfP/CJY5711WyZCIYK 8XswsPsO3IJxqrKm7S9bBHp7i3P6q+4= X-MC-Unique: _hWI4WS6NV6kIv5M1xDcAQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 06/42] migration-test: machine_opts is really arch specific Date: Fri, 9 Jun 2023 00:49:07 +0200 Message-Id: <20230608224943.3877-7-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264780411100003 Content-Type: text/plain; charset="utf-8" And it needs to be in both source and target, so put it on arch_opts. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 6b4e3bf827..cd49c249d3 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -609,7 +609,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; const char *arch =3D qtest_get_arch(); - const char *machine_opts =3D NULL; const char *memory_size; =20 if (args->use_shmem) { @@ -637,7 +636,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { - machine_opts =3D "-machine vsmt=3D8"; memory_size =3D "256M"; start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; @@ -645,12 +643,12 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " "until'", end_address, start_address= ); - arch_opts =3D g_strdup("-nodefaults"); + arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); - machine_opts =3D "-machine virt,gic-version=3Dmax"; memory_size =3D "150M"; - arch_opts =3D g_strdup_printf("-cpu max -kernel %s", bootpath); + arch_opts =3D g_strdup_printf("-machine virt,gic-version=3Dmax -cp= u max " + "-kernel %s", bootpath); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; =20 @@ -679,14 +677,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, memory_size, shmem_path); } =20 - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg %s " + cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? machine_opts : "", memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", @@ -701,7 +698,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, &got_src_stop); } =20 - cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg %s " + cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name target,debug-threads=3Don " "-m %s " "-serial file:%s/dest_serial " @@ -709,7 +706,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? machine_opts : "", memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264897; cv=none; d=zohomail.com; s=zohoarc; b=ABkK2SAOskxKb++Dd+FqI9vZyIPYKdQ3W1cos8j6hKOkTc7qaZZplSObcryTTq15bkFt3Bij3x/bxXaDz1fwbvKBupJBza50u0wlfWUMvX7sQLA81ZIG4Gvq1OiuTPil2fYr355GZJWWsMsgI/PS2A13tC/lOjZtn19Fz37Stj8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264897; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=34NEKbF+S+pCP/PERDCUohTgaWocoRzltvjKvK/fKvQ=; b=fgsOnMNzXV0rVUNqOFwfNLUB4wOCiExAMi9A8YbdxevQHM6Pvdcpdt7xOrhW/bda/6GQPabtJ/c4/cYKWwXbbi+0/QuHa+mUeyHeW/ycbuG+a2ygyEbWRyRI0i/LtfX+ecBzYlFtG1UEXl0iTJYn8dxnF/PdXNbFLI8lIsSEWDE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264897827647.4930606085153; Thu, 8 Jun 2023 15:54:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSG-0003SO-2R; Thu, 08 Jun 2023 18:50:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSE-0003RU-8n for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSC-0004rw-EU for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:06 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-605-pp-iJiaROAqz-xP1-_h8ZQ-1; Thu, 08 Jun 2023 18:50:00 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 070F73C0C88F; Thu, 8 Jun 2023 22:50:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A83C492B00; Thu, 8 Jun 2023 22:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=34NEKbF+S+pCP/PERDCUohTgaWocoRzltvjKvK/fKvQ=; b=Tp375eh2AckUrwbZr9sH7D9EEgpZApl1zLMHQeUq7SG1HnQu4skbOC+zN86XFqdzlB9i/I Fkr/sXg5WyV7jUfU82d2DShX8dQmXeXlXJfhXiOCYWriIu+Zuu9mAkmat4jtfRuSkmSMGg IQ1sQkpZI4z4d5Jq7eHcuQzUTc2iayY= X-MC-Unique: pp-iJiaROAqz-xP1-_h8ZQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 07/42] migration-test: Create kvm_opts Date: Fri, 9 Jun 2023 00:49:08 +0200 Message-Id: <20230608224943.3877-8-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264898958100003 Content-Type: text/plain; charset="utf-8" So arch_dirty_ring option becomes one option like the others. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index cd49c249d3..1fa815fa66 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -608,6 +608,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree char *bootpath =3D NULL; g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; + const char *kvm_opts =3D NULL; const char *arch =3D qtest_get_arch(); const char *memory_size; =20 @@ -677,13 +678,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, memory_size, shmem_path); } =20 + if (args->use_dirty_ring) { + kvm_opts =3D ",dirty-ring-size=3D4096"; + } + cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s %s", - args->use_dirty_ring ? - ",dirty-ring-size=3D4096" : "", + kvm_opts ? kvm_opts : "", memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", @@ -704,8 +708,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "-serial file:%s/dest_serial " "-incoming %s " "%s %s %s %s %s", - args->use_dirty_ring ? - ",dirty-ring-size=3D4096" : "", + kvm_opts ? kvm_opts : "", memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264917; cv=none; d=zohomail.com; s=zohoarc; b=iUeX1BgRMeBFsZ7UuKqIxO04O5rj0L9gyOGyzLHvkf5fcLJ6Oym7/VGL+/h+yTtcfVSy6XQY4Fvzadwcch2giY+0K+Yb4v+3JFPV1Or5giEzSz3Awp6SAFsqyKcyrinGyHP2yYn3c2uJsLq2cgq51KT2uQSm34nWFqNnog2HS/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264917; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KCS9s69yO7/0LYnEh+9ZeIPqPwKOA/vMvFcheMbhkYQ=; b=gfWEg7YdURXTeg+tHtr4Da5/eREWhtdtn4siSlBGWWVK3oWh0XvTjDraQ+wMgAMp/IAjhYrxPAukOJseSnYYEUeL64SlRhAU9ltf52KnHe2vvOIZhpByN6duoeQZBMYAa997JlU371qWa7u0gGGxUbzd6YJh86nyTVu1nQdKq98= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264916987749.2456253610177; Thu, 8 Jun 2023 15:55:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSG-0003Sb-Tz; Thu, 08 Jun 2023 18:50:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSE-0003RT-82 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSC-0004oz-6c for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:05 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-635-RK9VnpFVMA2G22qzm03B2Q-1; Thu, 08 Jun 2023 18:50:02 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F1DB1811E7F; Thu, 8 Jun 2023 22:50:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D508492B00; Thu, 8 Jun 2023 22:50:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264603; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KCS9s69yO7/0LYnEh+9ZeIPqPwKOA/vMvFcheMbhkYQ=; b=WtTvN+f6bvSXb6GAXMGP2zbvDCiizhjwlOSGera7azPsXMGDWwscazmWBFg5cRYdFjJouI q+9Lfba2wt9ucbRfVvrosQj8LFvwG+lMAICUpWGYc91BLrvj989GK4i0Z2QsLNijF+/Y7x poPYOGeAWVVrYIvEkkd7UBMMNalizG0= X-MC-Unique: RK9VnpFVMA2G22qzm03B2Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 08/42] migration-test: bootpath is the same for all tests and for all archs Date: Fri, 9 Jun 2023 00:49:09 +0200 Message-Id: <20230608224943.3877-9-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264918540100003 Content-Type: text/plain; charset="utf-8" So just make it a global variable. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 1fa815fa66..6453216e4e 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -102,6 +102,7 @@ static bool ufd_version_check(void) #endif =20 static char *tmpfs; +static char *bootpath; =20 /* The boot file modifies memory area in [start_address, end_address) * repeatedly. It outputs a 'B' at a fixed rate while it's still running. @@ -110,7 +111,7 @@ static char *tmpfs; #include "tests/migration/aarch64/a-b-kernel.h" #include "tests/migration/s390x/a-b-bios.h" =20 -static void init_bootfile(const char *bootpath, void *content, size_t len) +static void init_bootfile(void *content, size_t len) { FILE *bootfile =3D fopen(bootpath, "wb"); =20 @@ -605,7 +606,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; const gchar *ignore_stderr =3D NULL; - g_autofree char *bootpath =3D NULL; g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; const char *kvm_opts =3D NULL; @@ -621,17 +621,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, =20 got_src_stop =3D false; got_dst_resume =3D false; - bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { /* the assembled x86 boot sector should be exactly one sector larg= e */ assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); + init_bootfile(x86_bootsect, sizeof(x86_bootsect)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw", boo= tpath); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { - init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf)); + init_bootfile(s390x_elf, sizeof(s390x_elf)); memory_size =3D "128M"; arch_opts =3D g_strdup_printf("-bios %s", bootpath); start_address =3D S390_TEST_MEM_START; @@ -646,7 +645,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "until'", end_address, start_address= ); arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { - init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); + init_bootfile(aarch64_kernel, sizeof(aarch64_kernel)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-machine virt,gic-version=3Dmax -cp= u max " "-kernel %s", bootpath); @@ -759,7 +758,6 @@ static void test_migrate_end(QTestState *from, QTestSta= te *to, bool test_dest) =20 qtest_quit(to); =20 - cleanup("bootsect"); cleanup("migsocket"); cleanup("src_serial"); cleanup("dest_serial"); @@ -2488,12 +2486,10 @@ static QTestState *dirtylimit_start_vm(void) QTestState *vm =3D NULL; g_autofree gchar *cmd =3D NULL; const char *arch =3D qtest_get_arch(); - g_autofree char *bootpath =3D NULL; =20 assert((strcmp(arch, "x86_64") =3D=3D 0)); - bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); + init_bootfile(x86_bootsect, sizeof(x86_bootsect)); =20 cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " @@ -2509,7 +2505,6 @@ static QTestState *dirtylimit_start_vm(void) static void dirtylimit_stop_vm(QTestState *vm) { qtest_quit(vm); - cleanup("bootsect"); cleanup("vm_serial"); } =20 @@ -2671,6 +2666,7 @@ int main(int argc, char **argv) g_get_tmp_dir(), err->message); } g_assert(tmpfs); + bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); =20 module_call_init(MODULE_INIT_QOM); =20 @@ -2814,6 +2810,8 @@ int main(int argc, char **argv) =20 g_assert_cmpint(ret, =3D=3D, 0); =20 + cleanup("bootsect"); + g_free(bootpath); ret =3D rmdir(tmpfs); if (ret !=3D 0) { g_test_message("unable to rmdir: path (%s): %s", --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264952; cv=none; d=zohomail.com; s=zohoarc; b=EaKj7nYKPIYnOEn16cWVbDqz6EosrN27D2bu45+erVqoQc8yCqVhC+W4SZCJUcmxkr9EcagZV/eLy2zaE/AEFLW9f39BoWe0+7jfvziVZ9Cl5Db2q/Z9hTGsJKg8pzzzuHALmlIGADUAnEO9GstcZB+3sfIrQLcRdHTf+0l6YFc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264952; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fvzy9aXYrm8mI0bcAbv9u3G/soNQ41I+aa6PPSWUMIE=; b=m7xtzmYAcaXdMRAXFGO4Hnp8YnEP6CEi+dXU6oBZr+Ljdz6kr9pItSbsNc+/3VdgvPsBDzOAvRbfbPOdTaDbKbbfpsk+8/kNLEQFjRc4UQwWi8q+/FfPNCPn4kHg1AloJOEe/wAkbDEqSOXofxU/i1N5hDpebqxKJwTkvBqVhrU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264952678302.24742579932774; Thu, 8 Jun 2023 15:55:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSM-0003VL-0w; Thu, 08 Jun 2023 18:50:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSJ-0003UW-KL for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSG-0004w4-L0 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:11 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-338-cXEnEq4-Nq-w87aHZ3jc4w-1; Thu, 08 Jun 2023 18:50:04 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6D52101A531; Thu, 8 Jun 2023 22:50:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 453B5492B00; Thu, 8 Jun 2023 22:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fvzy9aXYrm8mI0bcAbv9u3G/soNQ41I+aa6PPSWUMIE=; b=Ih7zSj2WeRX2MW639DJ/0HKP+afXS0AHshcbCCCb/1sBv9owFQPKcpD0hpGxJRtuAqQ9K9 goPRtfNtQVQPDiEK36jQwSgV8E+NLf+ElCOB9HsGzzpXEpuYJ53AnzEu8hPhZT8YTPyyBX ve97LEAoleCHDs/sGlEsVQl1UqtTmwk= X-MC-Unique: cXEnEq4-Nq-w87aHZ3jc4w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 09/42] migration-test: Add bootfile_create/delete() functions Date: Fri, 9 Jun 2023 00:49:10 +0200 Message-Id: <20230608224943.3877-10-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264953234100007 Content-Type: text/plain; charset="utf-8" The bootsector code is read only from the guest (otherwise we are going to have problems with it being read from both source and destination). Create a single copy for all the tests. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 50 ++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 6453216e4e..613fda79bb 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -111,14 +111,47 @@ static char *bootpath; #include "tests/migration/aarch64/a-b-kernel.h" #include "tests/migration/s390x/a-b-bios.h" =20 -static void init_bootfile(void *content, size_t len) +static void bootfile_create(char *dir) { + const char *arch =3D qtest_get_arch(); + unsigned char *content; + size_t len; + + bootpath =3D g_strdup_printf("%s/bootsect", dir); + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + /* the assembled x86 boot sector should be exactly one sector larg= e */ + g_assert(sizeof(x86_bootsect) =3D=3D 512); + content =3D x86_bootsect; + len =3D sizeof(x86_bootsect); + } else if (g_str_equal(arch, "s390x")) { + content =3D s390x_elf; + len =3D sizeof(s390x_elf); + } else if (strcmp(arch, "ppc64") =3D=3D 0) { + /* + * sane architectures can be programmed at the boot prompt + */ + return; + } else if (strcmp(arch, "aarch64") =3D=3D 0) { + content =3D aarch64_kernel; + len =3D sizeof(aarch64_kernel); + g_assert(sizeof(aarch64_kernel) <=3D ARM_TEST_MAX_KERNEL_SIZE); + } else { + g_assert_not_reached(); + } + FILE *bootfile =3D fopen(bootpath, "wb"); =20 g_assert_cmpint(fwrite(content, len, 1, bootfile), =3D=3D, 1); fclose(bootfile); } =20 +static void bootfile_delete(void) +{ + unlink(bootpath); + g_free(bootpath); + bootpath =3D NULL; +} + /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -622,15 +655,11 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, got_src_stop =3D false; got_dst_resume =3D false; if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - /* the assembled x86 boot sector should be exactly one sector larg= e */ - assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(x86_bootsect, sizeof(x86_bootsect)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw", boo= tpath); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { - init_bootfile(s390x_elf, sizeof(s390x_elf)); memory_size =3D "128M"; arch_opts =3D g_strdup_printf("-bios %s", bootpath); start_address =3D S390_TEST_MEM_START; @@ -645,14 +674,11 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "until'", end_address, start_address= ); arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { - init_bootfile(aarch64_kernel, sizeof(aarch64_kernel)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-machine virt,gic-version=3Dmax -cp= u max " "-kernel %s", bootpath); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; - - g_assert(sizeof(aarch64_kernel) <=3D ARM_TEST_MAX_KERNEL_SIZE); } else { g_assert_not_reached(); } @@ -2488,9 +2514,6 @@ static QTestState *dirtylimit_start_vm(void) const char *arch =3D qtest_get_arch(); =20 assert((strcmp(arch, "x86_64") =3D=3D 0)); - assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(x86_bootsect, sizeof(x86_bootsect)); - cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " "-m 150M -smp 1 " @@ -2666,7 +2689,7 @@ int main(int argc, char **argv) g_get_tmp_dir(), err->message); } g_assert(tmpfs); - bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); + bootfile_create(tmpfs); =20 module_call_init(MODULE_INIT_QOM); =20 @@ -2810,8 +2833,7 @@ int main(int argc, char **argv) =20 g_assert_cmpint(ret, =3D=3D, 0); =20 - cleanup("bootsect"); - g_free(bootpath); + bootfile_delete(); ret =3D rmdir(tmpfs); if (ret !=3D 0) { g_test_message("unable to rmdir: path (%s): %s", --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264918; cv=none; d=zohomail.com; s=zohoarc; b=Mv9hAQxt+00SPzyz/tJ0tGyeJj1uTOaR9lUHb3LSo5iQ7EsWbmNs081ciG6k8qwrsYQYwgOpeAYlNwE3QB+3qbWliV4pCtze8WbJXlGNDCT5NpqmH1feMbPw6LRJylXY44cjsb0fpyO7Fa4ipBx1FPC0vuCKdK0I62TjKFxC/dg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264918; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1v54XRZfL3TGmjliUopBVGrknEDH2OltcK4yWTcbOkc=; b=OdiPw8UjdAdA7iawpCaIZucMB1ZlbKeR60E3M6/GSZVspD259ZwLX9T5aNGnQk4CKqgg/DYE3knCnTm6jdp0Nr0TK9eXVpPHxjcaJN1cJNEPwihalDogfcvDzA2TA7WOe63dGt7TK+MwBspcPh5NxoL7YfK9SeWW1/198cMIImQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264918372265.0765063283037; Thu, 8 Jun 2023 15:55:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSM-0003Vr-Up; Thu, 08 Jun 2023 18:50:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSK-0003UY-Bl for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSI-0004wy-Uz for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:12 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-225-q82cEQoPMdK7yIJqQ1Hl8g-1; Thu, 08 Jun 2023 18:50:06 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BAD78811E7C; Thu, 8 Jun 2023 22:50:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A97C492B00; Thu, 8 Jun 2023 22:50:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1v54XRZfL3TGmjliUopBVGrknEDH2OltcK4yWTcbOkc=; b=Ytm4O+rdQJNU1oXk2BuJ+Nex3Rg0PNQ8CB35vHFwKaXlK91oQfLbe3cuAyzNxsvVxeqzcI VGqv5TElFiNNR1UW+yywpBxFFEPSqHyXu/szUR7K+iGx/6qNQDmLjKl3AEvPZePceLA5kN 2ZXrUm/5SvsYUecY5Fv34JB3ACN0Tas= X-MC-Unique: q82cEQoPMdK7yIJqQ1Hl8g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 10/42] migration-test: dirtylimit checks for x86_64 arch before Date: Fri, 9 Jun 2023 00:49:11 +0200 Message-Id: <20230608224943.3877-11-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264920190100007 Content-Type: text/plain; charset="utf-8" So no need to assert we are in x86_64. Once there, refactor the function to remove useless variables. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 613fda79bb..743aa873e6 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2510,10 +2510,7 @@ static int64_t get_limit_rate(QTestState *who) static QTestState *dirtylimit_start_vm(void) { QTestState *vm =3D NULL; - g_autofree gchar *cmd =3D NULL; - const char *arch =3D qtest_get_arch(); - - assert((strcmp(arch, "x86_64") =3D=3D 0)); + g_autofree gchar * cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " "-m 150M -smp 1 " --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264804; cv=none; d=zohomail.com; s=zohoarc; b=R7DpxwS/Vv9cVqz+H/SJAmUIS4fu0nbtimrnpbTEXivhHW3lGK3OpX8nMx+P+QEeijfrRsVauHRnLjmuQcurWbvDAsbKFP0bn5XLrP9+fdtiahR+4cczRccoRetzsiXEiK+d39zq7yvy1du6uGLRArX6tRohp+h8SxdCSD3hAmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264804; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M1ae4vt5kMNTkdWttV/KRR6LDnpq9N03HaDMSbk6Sdo=; b=cnxqcIQZpJ2/saHtll4MQIwSh5zhvZNn621men4XxI06AAXEvT3BUugW+LORsbqWS+Mas9wYmNLjjQcSRCKQ5PIVLR/JN4aX256GmSm85lmyfE9t9DqLl+9PXtvK2IwBnUDGkQlIeiy+lDfVt71c7ADVxmIOvs4Ml9v0eDAhbL8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264804937390.30095201693814; Thu, 8 Jun 2023 15:53:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSN-0003W5-OL; Thu, 08 Jun 2023 18:50:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSM-0003VZ-8X for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSH-0004wv-QJ for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:13 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-540-2zC4w6hHO_C-1HHEGzp0kA-1; Thu, 08 Jun 2023 18:50:07 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8CB6A185A78E; Thu, 8 Jun 2023 22:50:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C5F1482060; Thu, 8 Jun 2023 22:50:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264609; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M1ae4vt5kMNTkdWttV/KRR6LDnpq9N03HaDMSbk6Sdo=; b=RNBl47qD3EwpFx0u4ENV5YOS6PqvgWaO5uxJlqyEJzlGw8gk4gK78Syi2JmPj0JklZNt2K bj9ktC8QsvOjXBulCM2gyaqblGjfBMrPa/LuywXNDMK3g45MCBpbUGQW3lIVYLxvr+kdTa GuMCvdL8rwa0Lho9x5E3U027lZYYFV4= X-MC-Unique: 2zC4w6hHO_C-1HHEGzp0kA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 11/42] migration-test: Update test_ignore_shared to use args Date: Fri, 9 Jun 2023 00:49:12 +0200 Message-Id: <20230608224943.3877-12-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264806319100005 Content-Type: text/plain; charset="utf-8" It missed this treatment: commit 11f1a4ce14803f15d59cff42a4cfb7ac50d36bd0 Author: Juan Quintela Date: Mon Nov 29 18:57:51 2021 +0100 migration-test: Check for shared memory like for everything else Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 743aa873e6..7178c8e679 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1597,8 +1597,11 @@ static void test_ignore_shared(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; + MigrateStart args =3D { + .use_shmem =3D true + }; =20 - if (test_migrate_start(&from, &to, uri, false, true, NULL, NULL)) { + if (test_migrate_start(&from, &to, uri, &args)) { return; } =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264955; cv=none; d=zohomail.com; s=zohoarc; b=P893YSdFCGMR8dyp86AqGT/4NLJkASbIXxtHTdTJ/25fkFr5MtP21Bem656mSDaxAtaDIBhF7QUfD2Exj+meiwCOk7SUyGpgznzWukPc+AJaMuWlEdjgB45Tb967qK0b2URofsgyB5s8HgWgpjNy8T52LTnusIv3v3MIkJrEDTM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264955; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2cQul/wdTClbcqqygmqyy+M7+jaVLZZhVTPXh2rS7GI=; b=SYfYnx/Rds4V51YbBkDpLgWb2sPMdlXZq9Z2sFfSqEVDANMp8LOxUizLgpsFYYBWYBUMcgSxIuNaGR29jAS1HAXLLc3qIltAlf4FIlToXKAbNLnBNdziQtu6vbBZzoHB9V5N4keepBdkFkN6EchlId/Y/BPpQbk4ZTT7sKOa1Ls= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264955424848.5705811441571; Thu, 8 Jun 2023 15:55:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSM-0003Vo-SS; Thu, 08 Jun 2023 18:50:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSL-0003V6-KW for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSJ-0004xb-Vo for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:13 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-407-eCPixlfqMAiEXcMta5W9sg-1; Thu, 08 Jun 2023 18:50:09 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E14685A5B5; Thu, 8 Jun 2023 22:50:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2C5F515544; Thu, 8 Jun 2023 22:50:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2cQul/wdTClbcqqygmqyy+M7+jaVLZZhVTPXh2rS7GI=; b=dPjS67eQXTxZoXkqkm5a3TDZbXyahh6UiOMj8pFlMAxKbXz5yMO8VZjuQNtefq3i2N9QM4 gSj5GhWu7hgHZ5y3AjrckVE46mWvEWV5kozH5qNu4FSbIMu54Ce48oUc75fnVYqt4MIihU cZqtYPYJ9sS2TXNrhnlg8KND06guO3Y= X-MC-Unique: eCPixlfqMAiEXcMta5W9sg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 12/42] migration-test: Enable back ignore-shared test Date: Fri, 9 Jun 2023 00:49:13 +0200 Message-Id: <20230608224943.3877-13-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264956746100015 Content-Type: text/plain; charset="utf-8" It failed on aarch64 tcg, lets see if that is still the case. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 7178c8e679..daaf5cd71a 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1591,8 +1591,6 @@ static void test_precopy_unix_tls_x509_override_host(= void) #endif /* CONFIG_TASN1 */ #endif /* CONFIG_GNUTLS */ =20 -#if 0 -/* Currently upset on aarch64 TCG */ static void test_ignore_shared(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); @@ -1629,7 +1627,6 @@ static void test_ignore_shared(void) =20 test_migrate_end(from, to, true); } -#endif =20 static void * test_migrate_xbzrle_start(QTestState *from, @@ -2771,7 +2768,7 @@ int main(int argc, char **argv) #endif /* CONFIG_TASN1 */ #endif /* CONFIG_GNUTLS */ =20 - /* qtest_add_func("/migration/ignore_shared", test_ignore_shared); */ + qtest_add_func("/migration/ignore_shared", test_ignore_shared); #ifndef _WIN32 qtest_add_func("/migration/fd_proto", test_migrate_fd_proto); #endif --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264905; cv=none; d=zohomail.com; s=zohoarc; b=QZfVXDbc2JL7AvADiJgMmR7nB24J6KFkiZxBLWJ8TIIOeS4KWJHRWJkpxcq1HxNP58SDGqmdwynywCTzNH4nfmK9GEW/qabcB5oeRmMGlROQlF41tPNTA+bxueHi8350qe4YqW+7M1Cq6HqBexTYbG07liCIElmiq6b/E4UL5ro= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264905; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mpEvVBq2rfOxvqUgNbmLvLl3T1SYn/PCj6M245deZac=; b=L0i3fYWFtlrbwnMF+Q2LG2dKMoGN+w9sv7sPEdXUgTP2uldKmDa+Mwejbr5U+GZSHHOfiC2bb13dzAm/RSp+JUNi52Pu4okcjvMI4Jfm4gVrYaepCuuUxARl9pNiyiqZgw+MARY5/HX23U7LssTo+ra3Gj1kGif3e5jDMFJRoDs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264905285287.34952388552097; Thu, 8 Jun 2023 15:55:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSQ-0003Wt-Kr; Thu, 08 Jun 2023 18:50:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSP-0003Wd-59 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSN-0004zT-Ef for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:16 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-29-3jA7wHeMP0G3Ij7hccGPEg-1; Thu, 08 Jun 2023 18:50:11 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2DE742A59549; Thu, 8 Jun 2023 22:50:11 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3B5E515541; Thu, 8 Jun 2023 22:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264614; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mpEvVBq2rfOxvqUgNbmLvLl3T1SYn/PCj6M245deZac=; b=FnATdLRqePciy42Y0kEFQDw0DFkD9ZKMR7Rwyw2CnCEn1uG6KJkISf9caL2jG4pLZOPXCa VAE2R5ulrSeI8b6y3NuQzHH3sTKcQa7qxxGU7tApihMRA30KMZdAyXU6iXNY8I6klvrqKV BAUe+tMZy/ASAvXk6MagvRkSCnfS/5E= X-MC-Unique: 3jA7wHeMP0G3Ij7hccGPEg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 13/42] migration-test: Check for shared memory like for everything else Date: Fri, 9 Jun 2023 00:49:14 +0200 Message-Id: <20230608224943.3877-14-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264906133100001 Content-Type: text/plain; charset="utf-8" Makes things easier and cleaner. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index daaf5cd71a..5837060138 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -645,13 +645,6 @@ static int test_migrate_start(QTestState **from, QTest= State **to, const char *arch =3D qtest_get_arch(); const char *memory_size; =20 - if (args->use_shmem) { - if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { - g_test_skip("/dev/shm is not supported"); - return -1; - } - } - got_src_stop =3D false; got_dst_resume =3D false; if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { @@ -2639,6 +2632,15 @@ static bool kvm_dirty_ring_supported(void) #endif } =20 +static bool shm_supported(void) +{ + if (g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { + return true; + } + g_test_message("Skipping test: shared memory not available"); + return false; +} + int main(int argc, char **argv) { bool has_kvm, has_tcg; @@ -2768,7 +2770,9 @@ int main(int argc, char **argv) #endif /* CONFIG_TASN1 */ #endif /* CONFIG_GNUTLS */ =20 - qtest_add_func("/migration/ignore_shared", test_ignore_shared); + if (shm_supported()) { + qtest_add_func("/migration/ignore_shared", test_ignore_shared); + } #ifndef _WIN32 qtest_add_func("/migration/fd_proto", test_migrate_fd_proto); #endif --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264826; cv=none; d=zohomail.com; s=zohoarc; b=NMdrr2oY/PKdjDMDo8r5qstg7JrsruC7kAgwkLK25373s7qGlVaA6Bb9RKfkIPpqL4GCXNCuqkklNYtQAG7iXjsUfvAdh7bGQkN9542uygRnmel9NjruQDEVF1jhMt+BmLE4qhQoyih7Lg5P5pZBJ8B3Tme+cDFWKao1gN2QvRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264826; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ooZDVu2u6stJR54x4HIx0421sLGbHoWHpwjasvtyWl4=; b=Ytd7MLWwvuJgXH5Qk2lQH0oY1WI7X3CH1gxNWyQPZrparHk1YFkrZECUKEcohQxc2pI6ByCezCKGFk6n4L5Mk45sSg6O4a1leEP8juyiDmpRDPl1hqqJHWkK9nXy1oe7sA7iLy0y+5cSg72nVVKYoa+y1MR1ZXoXOYkwsvGPyAA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264826681811.0542253965396; Thu, 8 Jun 2023 15:53:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSV-0003Y5-I2; Thu, 08 Jun 2023 18:50:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSR-0003X2-W2 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSQ-000523-EP for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:19 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-562-uGC5y3flMq-GYodPuuYhMQ-1; Thu, 08 Jun 2023 18:50:13 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F3E8C811E85; Thu, 8 Jun 2023 22:50:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 739A0515541; Thu, 8 Jun 2023 22:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264617; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ooZDVu2u6stJR54x4HIx0421sLGbHoWHpwjasvtyWl4=; b=Q+ZVZSzTK8SmCY2b7T97ykpXNBvzK7s8HtQoF64I1MJ/T1LEa08mU6NxcBdX5VygPhmmcX 3l8erKV00fpc8oCGMdQ+YJQTQ9ebtV2Xkv7FoeMU/rqq+uuZdz743QdpyJCkr3tZVsyfnX ySoozyRjhW68UFYT3eEGm5CbrTLI7qo= X-MC-Unique: uGC5y3flMq-GYodPuuYhMQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 14/42] migration-test: test_migrate_start() always return 0 Date: Fri, 9 Jun 2023 00:49:15 +0200 Message-Id: <20230608224943.3877-15-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264827597100001 Content-Type: text/plain; charset="utf-8" So make it return void instead and adjust all callers. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 38 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 5837060138..b57811da75 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -629,8 +629,8 @@ typedef struct { bool postcopy_preempt; } MigrateCommon; =20 -static int test_migrate_start(QTestState **from, QTestState **to, - const char *uri, MigrateStart *args) +static void test_migrate_start(QTestState **from, QTestState **to, + const char *uri, MigrateStart *args) { g_autofree gchar *arch_source =3D NULL; g_autofree gchar *arch_target =3D NULL; @@ -745,8 +745,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, if (args->use_shmem) { unlink(shmem_path); } - - return 0; } =20 static void test_migrate_end(QTestState *from, QTestState *to, bool test_d= est) @@ -1155,9 +1153,7 @@ static int migrate_postcopy_prepare(QTestState **from= _ptr, g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, &args->start)) { - return -1; - } + test_migrate_start(&from, &to, uri, &args->start); =20 if (args->start_hook) { args->postcopy_data =3D args->start_hook(from, to); @@ -1387,9 +1383,7 @@ static void test_baddest(void) }; QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, "tcp:127.0.0.1:0", &args)) { - return; - } + test_migrate_start(&from, &to, "tcp:127.0.0.1:0", &args); migrate_qmp(from, "tcp:127.0.0.1:0", "{}"); wait_for_migration_fail(from, false); test_migrate_end(from, to, false); @@ -1400,9 +1394,7 @@ static void test_precopy_common(MigrateCommon *args) QTestState *from, *to; void *data_hook =3D NULL; =20 - if (test_migrate_start(&from, &to, args->listen_uri, &args->start)) { - return; - } + test_migrate_start(&from, &to, args->listen_uri, &args->start); =20 if (args->start_hook) { data_hook =3D args->start_hook(from, to); @@ -1592,9 +1584,7 @@ static void test_ignore_shared(void) .use_shmem =3D true }; =20 - if (test_migrate_start(&from, &to, uri, &args)) { - return; - } + test_migrate_start(&from, &to, uri, &args); =20 migrate_set_capability(from, "x-ignore-shared", true); migrate_set_capability(to, "x-ignore-shared", true); @@ -1893,9 +1883,7 @@ static void do_test_validate_uuid(MigrateStart *args,= bool should_fail) g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, args)) { - return; - } + test_migrate_start(&from, &to, uri, args); =20 /* * UUID validation is at the begin of migration. So, the main process = of @@ -1990,9 +1978,7 @@ static void test_migrate_auto_converge(void) */ const int64_t init_pct =3D 5, inc_pct =3D 25, max_pct =3D 95; =20 - if (test_migrate_start(&from, &to, uri, &args)) { - return; - } + test_migrate_start(&from, &to, uri, &args); =20 migrate_set_capability(from, "auto-converge", true); migrate_set_parameter_int(from, "cpu-throttle-initial", init_pct); @@ -2302,9 +2288,7 @@ static void test_multifd_tcp_cancel(void) QTestState *from, *to, *to2; g_autofree char *uri =3D NULL; =20 - if (test_migrate_start(&from, &to, "defer", &args)) { - return; - } + test_migrate_start(&from, &to, "defer", &args); =20 migrate_ensure_non_converge(from); =20 @@ -2337,9 +2321,7 @@ static void test_multifd_tcp_cancel(void) .only_target =3D true, }; =20 - if (test_migrate_start(&from, &to2, "defer", &args)) { - return; - } + test_migrate_start(&from, &to2, "defer", &args); =20 migrate_set_parameter_int(to2, "multifd-channels", 16); =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264819; cv=none; d=zohomail.com; s=zohoarc; b=WDNptaMgapkc9YKgUccNvk1O1CqK+G6czMv/31Ju+UGGA8gaAuoJ5sLhTJ2iN2bM/Ur7a+OyK6yP6GOaBcw7sigu/ufkO1jK+RsrkoLtE9wLYjuR7/0p2KuJbamgyWUoGJCrfmt3nd/t76aWsBQjSCrDa2DthzflO3X3iQHMwI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264819; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YF5zaFACHYRMZKZN/az3fcgRTJqGCYVOIz68XsYtrmY=; b=VGAcrXhlfAWfY905Il3IM+1BsUGnYD41F3WhXv/D1kJaDaA0HDTpyJzc1jrLgan+hdcg1Oj2BQGXMtqbeuLAWVHh2dLhjAbZU7NrxI+wXiYz4Wwa6DmiYnGY9wifMxEMpHxp1w0gIvLrjp+9h7Zh7K4nEC6tP17CNMOVJJFDad4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264819823606.8746924807987; Thu, 8 Jun 2023 15:53:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OST-0003XZ-Oz; Thu, 08 Jun 2023 18:50:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSS-0003XL-GI for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSR-00052L-1L for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:20 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-76-CJTNoqLFPO-P_Rr7hMjGUw-1; Thu, 08 Jun 2023 18:50:15 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C5A5D85A5A8; Thu, 8 Jun 2023 22:50:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47C23515541; Thu, 8 Jun 2023 22:50:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264618; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YF5zaFACHYRMZKZN/az3fcgRTJqGCYVOIz68XsYtrmY=; b=AY36YcNeIaxsdBcJWoGvf5SVHbAOMKYgxSS3qlNqcCsdnvucuTOfQJOPkybV3nHBkgMsSV 8HL7DPq4IQEKoOmM5ZZzXnK3+neN0KZyzK1WdgWou/vp9wcqoW3OMk+PSKnaXc+TnLDnwd 4RmKC5HGOP8wd/ZUkDOSr1BjDrEj/J0= X-MC-Unique: CJTNoqLFPO-P_Rr7hMjGUw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 15/42] migration-test: migrate_postcopy_prepare() always return 0 Date: Fri, 9 Jun 2023 00:49:16 +0200 Message-Id: <20230608224943.3877-16-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264821555100003 Content-Type: text/plain; charset="utf-8" So make it return void. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- tests/qtest/migration-test.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b57811da75..e623c43957 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1146,9 +1146,9 @@ test_migrate_compress_nowait_start(QTestState *from, return NULL; } =20 -static int migrate_postcopy_prepare(QTestState **from_ptr, - QTestState **to_ptr, - MigrateCommon *args) +static void migrate_postcopy_prepare(QTestState **from_ptr, + QTestState **to_ptr, + MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; @@ -1179,8 +1179,6 @@ static int migrate_postcopy_prepare(QTestState **from= _ptr, =20 *from_ptr =3D from; *to_ptr =3D to; - - return 0; } =20 static void migrate_postcopy_complete(QTestState *from, QTestState *to, @@ -1207,9 +1205,7 @@ static void test_postcopy_common(MigrateCommon *args) { QTestState *from, *to; =20 - if (migrate_postcopy_prepare(&from, &to, args)) { - return; - } + migrate_postcopy_prepare(&from, &to, args); migrate_postcopy_start(from, to); migrate_postcopy_complete(from, to, args); } @@ -1270,9 +1266,7 @@ static void test_postcopy_recovery_common(MigrateComm= on *args) /* Always hide errors for postcopy recover tests since they're expecte= d */ args->start.hide_stderr =3D true; =20 - if (migrate_postcopy_prepare(&from, &to, args)) { - return; - } + migrate_postcopy_prepare(&from, &to, args); =20 /* Turn postcopy speed down, 4K/s is slow enough on any machines */ migrate_set_parameter_int(from, "max-postcopy-bandwidth", 4096); --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264790; cv=none; d=zohomail.com; s=zohoarc; b=GwwIItrH8+wzWbHvEZvxyFXvo3grJvb2S3VQ4WsYJSryPew2ahB8qssPq1q/GMq11b1Ms1xMGRpgEC59/GvOKhJ4EYqyeS0ZpCKWB6oEzegOs/mQnyx3ihh//4XqAZuB0ZXFfh0vHTkU+9nC1HNXGSZyAQvawKPeIkfkxTSdQ+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264790; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ViNfUOJYaf06RUnHLCjBsa8zlI/W/H9KzPj32wnV7a4=; b=MGhBzaxPwGEuwcy3ijwEUDUp5O1SrVELVLfLhI5WjyizYUpiXhrMiDfPy93rc5AGr5/s4YvnjMAukiHSOXgDGChpq83nHLeY3j6A8AYWq1ZZKdJ5fYd1fJ3Wysb/hT+ft5Brtyhj4WF586IRe5S6Sb3wP43RiNmZLYtYWtmaHrg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264790931243.97321716455508; Thu, 8 Jun 2023 15:53:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSV-0003Y8-Rc; Thu, 08 Jun 2023 18:50:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSU-0003Xq-GI for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSS-00053J-Uc for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:22 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-XIxtUB1ANDiaSO4DLEGi_A-1; Thu, 08 Jun 2023 18:50:17 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B14A280BC58; Thu, 8 Jun 2023 22:50:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17842515541; Thu, 8 Jun 2023 22:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ViNfUOJYaf06RUnHLCjBsa8zlI/W/H9KzPj32wnV7a4=; b=ixLx/5WHgE51byBVB8iilfq1Pz5VVGQVuJq6UNx+wsDttPDGHd3tq8U4wwVUmbeii2f9AY jwQRoC/zCj6OdYclNNr5mp9ffayFYmJKbnjS4Q05qPF0zr0mpy29YXuaiRA2fCdDOM+RXH 8oVoNsVjYDq34lDADkaUhLO/uOG/b2U= X-MC-Unique: XIxtUB1ANDiaSO4DLEGi_A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 16/42] migration-test: Create do_migrate() Date: Fri, 9 Jun 2023 00:49:17 +0200 Message-Id: <20230608224943.3877-17-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264792262100002 Content-Type: text/plain; charset="utf-8" We called migrate_qmp() in lot of places. And there are tricks like changing tcp address with the right port. Only two callers remaining: - postcopy resume: It needs to play with the qmp. - baddest: We want to do a unvalid URI. For that we need to do it by hand. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 41 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e623c43957..96b495f255 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -528,6 +528,17 @@ static void migrate_postcopy_start(QTestState *from, Q= TestState *to) qtest_qmp_eventwait(to, "RESUME"); } =20 +static void do_migrate(QTestState *from, QTestState *to, const gchar *uri) +{ + if (!uri) { + g_autofree char *tcp_uri =3D + migrate_get_socket_address(to, "socket-address"); + migrate_qmp(from, tcp_uri, "{}"); + } else { + migrate_qmp(from, uri, "{}"); + } +} + typedef struct { /* * QTEST_LOG=3D1 may override this. When QTEST_LOG=3D1, we always dum= p errors @@ -1173,7 +1184,7 @@ static void migrate_postcopy_prepare(QTestState **fro= m_ptr, /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, uri, "{}"); + do_migrate(from, to, uri); =20 wait_for_migration_pass(from); =20 @@ -1378,6 +1389,9 @@ static void test_baddest(void) QTestState *from, *to; =20 test_migrate_start(&from, &to, "tcp:127.0.0.1:0", &args); + /* + * Don't change to do_migrate(). We are using a wrong uri on purpose. + */ migrate_qmp(from, "tcp:127.0.0.1:0", "{}"); wait_for_migration_fail(from, false); test_migrate_end(from, to, false); @@ -1424,14 +1438,7 @@ static void test_precopy_common(MigrateCommon *args) } } =20 - if (!args->connect_uri) { - g_autofree char *local_connect_uri =3D - migrate_get_socket_address(to, "socket-address"); - migrate_qmp(from, local_connect_uri, "{}"); - } else { - migrate_qmp(from, args->connect_uri, "{}"); - } - + do_migrate(from, to, args->connect_uri); =20 if (args->result !=3D MIG_TEST_SUCCEED) { bool allow_active =3D args->result =3D=3D MIG_TEST_FAIL; @@ -1586,7 +1593,7 @@ static void test_ignore_shared(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, uri, "{}"); + do_migrate(from, to, uri); =20 wait_for_migration_pass(from); =20 @@ -1890,7 +1897,7 @@ static void do_test_validate_uuid(MigrateStart *args,= bool should_fail) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, uri, "{}"); + do_migrate(from, to, uri); =20 if (should_fail) { qtest_set_expected_status(to, EXIT_FAILURE); @@ -1991,7 +1998,7 @@ static void test_migrate_auto_converge(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - migrate_qmp(from, uri, "{}"); + do_migrate(from, to, uri); =20 /* Wait for throttling begins */ percentage =3D 0; @@ -2280,7 +2287,6 @@ static void test_multifd_tcp_cancel(void) .hide_stderr =3D true, }; QTestState *from, *to, *to2; - g_autofree char *uri =3D NULL; =20 test_migrate_start(&from, &to, "defer", &args); =20 @@ -2299,9 +2305,7 @@ static void test_multifd_tcp_cancel(void) /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 - uri =3D migrate_get_socket_address(to, "socket-address"); - - migrate_qmp(from, uri, "{}"); + do_migrate(from, to, "127.0.0.1:0"); =20 wait_for_migration_pass(from); =20 @@ -2325,14 +2329,11 @@ static void test_multifd_tcp_cancel(void) qtest_qmp_assert_success(to2, "{ 'execute': 'migrate-incoming'," " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); =20 - g_free(uri); - uri =3D migrate_get_socket_address(to2, "socket-address"); - wait_for_migration_status(from, "cancelled", NULL); =20 migrate_ensure_converge(from); =20 - migrate_qmp(from, uri, "{}"); + do_migrate(from, to2, "127.0.0.1:0"); =20 wait_for_migration_pass(from); =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264805; cv=none; d=zohomail.com; s=zohoarc; b=XTNvVH4XPD9NzgIyr8X3yC7/H4c8tdv3kuY2GibjQKIS03faHVxdXx3LnaO5mxAKgLoP1F0Mkzk1t9AraCZWfMU45wLxuESaabQZMTuJeu2aPXpPzSHUUwT3s24YTxO5ntX1XqcgjetZqCxFHd9nR+8fXQCc1dFQik6i1l28bWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264805; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i1AvEczG1dOhxyRZouPKZ9jIzFLrdPQJMtBooWfY/Lo=; b=nmWApfKKBsrHwCcip03v/PE2Nx9O0iLOrT8x694JPgl5OdCmlq9KqBBqHDy+oMhy2S9UziqBKWWHvIPym6lJRK8lDtHWyFG4KB/hgpnNBt2l5Xjj2S1Fw26hroyNg2QG3QydUeKG8G/KWEoGXaUrbqpyQl+W0He0ky7poo9ksv0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264805003694.6971325680742; Thu, 8 Jun 2023 15:53:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSX-0003Z6-85; Thu, 08 Jun 2023 18:50:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSV-0003Y7-O4 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSS-00053M-TM for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:23 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-38-G51T5_RjNPqYZdMuKq8ccQ-1; Thu, 08 Jun 2023 18:50:19 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 96C7F385556B; Thu, 8 Jun 2023 22:50:18 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id E2290515541; Thu, 8 Jun 2023 22:50:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i1AvEczG1dOhxyRZouPKZ9jIzFLrdPQJMtBooWfY/Lo=; b=Ir05AsurIcEfk6gA+gjQmAriXmp2c7rBPTKT6D5c4IMplltKGe3CJupmmrhaPJ5BGIwtF8 kdkyzzTbFtJbXVFAM+sysMoFnID78Qm/m0E2BvJ68uoutVAxFOyrRi+XtqdfIdDsM/YtYJ QQmZ+eE4kuvKqiKEFoVnKZQXoHMNp4Y= X-MC-Unique: G51T5_RjNPqYZdMuKq8ccQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 17/42] migration-test: Introduce GuestState Date: Fri, 9 Jun 2023 00:49:18 +0200 Message-Id: <20230608224943.3877-18-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264806592100011 Content-Type: text/plain; charset="utf-8" It will contain all the information that we need for a guest. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 330 +++++++++++++++++++---------------- 1 file changed, 180 insertions(+), 150 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 96b495f255..5cfc7a6ebc 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -152,6 +152,26 @@ static void bootfile_delete(void) bootpath =3D NULL; } =20 +typedef struct { + QTestState *qs; + const gchar *name; +} GuestState; + +static GuestState *guest_create(const char *name) +{ + GuestState *vm =3D g_new0(GuestState, 1); + + vm->name =3D name; + + return vm; +} + +static void guest_destroy(GuestState *vm) +{ + qtest_quit(vm->qs); + g_free(vm); +} + /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -272,7 +292,7 @@ static void wait_for_migration_pass(QTestState *who) } while (pass =3D=3D initial_pass && !got_src_stop); } =20 -static void check_guests_ram(QTestState *who) +static void check_guests_ram(GuestState *who) { /* Our ASM test will have been incrementing one byte from each page fr= om * start_address to < end_address in order. This gives us a constraint @@ -287,14 +307,14 @@ static void check_guests_ram(QTestState *who) bool hit_edge =3D false; int bad =3D 0; =20 - qtest_memread(who, start_address, &first_byte, 1); + qtest_memread(who->qs, start_address, &first_byte, 1); last_byte =3D first_byte; =20 for (address =3D start_address + TEST_MEM_PAGE_SIZE; address < end_add= ress; address +=3D TEST_MEM_PAGE_SIZE) { uint8_t b; - qtest_memread(who, address, &b, 1); + qtest_memread(who->qs, 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 @@ -528,14 +548,14 @@ static void migrate_postcopy_start(QTestState *from, = QTestState *to) qtest_qmp_eventwait(to, "RESUME"); } =20 -static void do_migrate(QTestState *from, QTestState *to, const gchar *uri) +static void do_migrate(GuestState *from, GuestState *to, const gchar *uri) { if (!uri) { g_autofree char *tcp_uri =3D - migrate_get_socket_address(to, "socket-address"); - migrate_qmp(from, tcp_uri, "{}"); + migrate_get_socket_address(to->qs, "socket-address"); + migrate_qmp(from->qs, tcp_uri, "{}"); } else { - migrate_qmp(from, uri, "{}"); + migrate_qmp(from->qs, uri, "{}"); } } =20 @@ -640,7 +660,7 @@ typedef struct { bool postcopy_preempt; } MigrateCommon; =20 -static void test_migrate_start(QTestState **from, QTestState **to, +static void test_migrate_start(GuestState *from, GuestState *to, const char *uri, MigrateStart *args) { g_autofree gchar *arch_source =3D NULL; @@ -712,11 +732,12 @@ static void test_migrate_start(QTestState **from, QTe= stState **to, } =20 cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " - "-name source,debug-threads=3Don " + "-name %s,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s %s", kvm_opts ? kvm_opts : "", + from->name, memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", @@ -725,27 +746,28 @@ static void test_migrate_start(QTestState **from, QTe= stState **to, ignore_stderr ? ignore_stderr : ""); =20 if (!args->only_target) { - *from =3D qtest_init(cmd_source); - qtest_qmp_set_event_callback(*from, + from->qs =3D qtest_init(cmd_source); + qtest_qmp_set_event_callback(from->qs, migrate_watch_for_stop, &got_src_stop); } =20 cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " - "-name target,debug-threads=3Don " + "-name %s,debug-threads=3Don " "-m %s " "-serial file:%s/dest_serial " "-incoming %s " "%s %s %s %s %s", kvm_opts ? kvm_opts : "", + to->name, memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", shmem_opts ? shmem_opts : "", args->opts_target ? args->opts_target : "= ", ignore_stderr ? ignore_stderr : ""); - *to =3D qtest_init(cmd_target); - qtest_qmp_set_event_callback(*to, + to->qs =3D qtest_init(cmd_target); + qtest_qmp_set_event_callback(to->qs, migrate_watch_for_resume, &got_dst_resume); =20 @@ -758,33 +780,33 @@ static void test_migrate_start(QTestState **from, QTe= stState **to, } } =20 -static void test_migrate_end(QTestState *from, QTestState *to, bool test_d= est) +static void test_migrate_end(GuestState *from, GuestState *to, bool test_d= est) { unsigned char dest_byte_a, dest_byte_b, dest_byte_c, dest_byte_d; =20 - qtest_quit(from); + guest_destroy(from); =20 if (test_dest) { - qtest_memread(to, start_address, &dest_byte_a, 1); + qtest_memread(to->qs, start_address, &dest_byte_a, 1); =20 /* Destination still running, wait for a byte to change */ do { - qtest_memread(to, start_address, &dest_byte_b, 1); + qtest_memread(to->qs, start_address, &dest_byte_b, 1); usleep(1000 * 10); } while (dest_byte_a =3D=3D dest_byte_b); =20 - qtest_qmp_assert_success(to, "{ 'execute' : 'stop'}"); + qtest_qmp_assert_success(to->qs, "{ 'execute' : 'stop'}"); =20 /* With it stopped, check nothing changes */ - qtest_memread(to, start_address, &dest_byte_c, 1); + qtest_memread(to->qs, start_address, &dest_byte_c, 1); usleep(1000 * 200); - qtest_memread(to, start_address, &dest_byte_d, 1); + qtest_memread(to->qs, start_address, &dest_byte_d, 1); g_assert_cmpint(dest_byte_c, =3D=3D, dest_byte_d); =20 check_guests_ram(to); } =20 - qtest_quit(to); + guest_destroy(to); =20 cleanup("migsocket"); cleanup("src_serial"); @@ -1157,55 +1179,51 @@ test_migrate_compress_nowait_start(QTestState *from, return NULL; } =20 -static void migrate_postcopy_prepare(QTestState **from_ptr, - QTestState **to_ptr, +static void migrate_postcopy_prepare(GuestState *from, + GuestState *to, MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - QTestState *from, *to; =20 - test_migrate_start(&from, &to, uri, &args->start); + test_migrate_start(from, to, uri, &args->start); =20 if (args->start_hook) { - args->postcopy_data =3D args->start_hook(from, to); + args->postcopy_data =3D args->start_hook(from->qs, to->qs); } =20 - migrate_set_capability(from, "postcopy-ram", true); - migrate_set_capability(to, "postcopy-ram", true); - migrate_set_capability(to, "postcopy-blocktime", true); + migrate_set_capability(from->qs, "postcopy-ram", true); + migrate_set_capability(to->qs, "postcopy-ram", true); + migrate_set_capability(to->qs, "postcopy-blocktime", true); =20 if (args->postcopy_preempt) { - migrate_set_capability(from, "postcopy-preempt", true); - migrate_set_capability(to, "postcopy-preempt", true); + migrate_set_capability(from->qs, "postcopy-preempt", true); + migrate_set_capability(to->qs, "postcopy-preempt", true); } =20 - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from->qs); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 do_migrate(from, to, uri); =20 - wait_for_migration_pass(from); - - *from_ptr =3D from; - *to_ptr =3D to; + wait_for_migration_pass(from->qs); } =20 -static void migrate_postcopy_complete(QTestState *from, QTestState *to, +static void migrate_postcopy_complete(GuestState *from, GuestState *to, MigrateCommon *args) { - wait_for_migration_complete(from); + wait_for_migration_complete(from->qs); =20 /* Make sure we get at least one "B" on destination */ wait_for_serial("dest_serial"); =20 if (uffd_feature_thread_id) { - read_blocktime(to); + read_blocktime(to->qs); } =20 if (args->finish_hook) { - args->finish_hook(from, to, args->postcopy_data); + args->finish_hook(from->qs, to->qs, args->postcopy_data); args->postcopy_data =3D NULL; } =20 @@ -1214,10 +1232,11 @@ static void migrate_postcopy_complete(QTestState *f= rom, QTestState *to, =20 static void test_postcopy_common(MigrateCommon *args) { - QTestState *from, *to; + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); =20 - migrate_postcopy_prepare(&from, &to, args); - migrate_postcopy_start(from, to); + migrate_postcopy_prepare(from, to, args); + migrate_postcopy_start(from->qs, to->qs); migrate_postcopy_complete(from, to, args); } =20 @@ -1271,38 +1290,40 @@ static void test_postcopy_preempt_tls_psk(void) =20 static void test_postcopy_recovery_common(MigrateCommon *args) { - QTestState *from, *to; + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); + g_autofree char *uri =3D NULL; =20 /* Always hide errors for postcopy recover tests since they're expecte= d */ args->start.hide_stderr =3D true; =20 - migrate_postcopy_prepare(&from, &to, args); + migrate_postcopy_prepare(from, to, args); =20 /* Turn postcopy speed down, 4K/s is slow enough on any machines */ - migrate_set_parameter_int(from, "max-postcopy-bandwidth", 4096); + migrate_set_parameter_int(from->qs, "max-postcopy-bandwidth", 4096); =20 /* Now we start the postcopy */ - migrate_postcopy_start(from, to); + migrate_postcopy_start(from->qs, to->qs); =20 /* * Wait until postcopy is really started; we can only run the * migrate-pause command during a postcopy */ - wait_for_migration_status(from, "postcopy-active", NULL); + wait_for_migration_status(from->qs, "postcopy-active", NULL); =20 /* * Manually stop the postcopy migration. This emulates a network * failure with the migration socket */ - migrate_pause(from); + migrate_pause(from->qs); =20 /* * Wait for destination side to reach postcopy-paused state. The * migrate-recover command can only succeed if destination machine * is in the paused state */ - wait_for_migration_status(to, "postcopy-paused", + wait_for_migration_status(to->qs, "postcopy-paused", (const char * []) { "failed", "active", "completed", NULL }); =20 @@ -1312,19 +1333,19 @@ static void test_postcopy_recovery_common(MigrateCo= mmon *args) * listen to the new port */ uri =3D g_strdup_printf("unix:%s/migsocket-recover", tmpfs); - migrate_recover(to, uri); + migrate_recover(to->qs, uri); =20 /* * Try to rebuild the migration channel using the resume flag and * the newly created channel */ - wait_for_migration_status(from, "postcopy-paused", + wait_for_migration_status(from->qs, "postcopy-paused", (const char * []) { "failed", "active", "completed", NULL }); - migrate_qmp(from, uri, "{'resume': true}"); + migrate_qmp(from->qs, uri, "{'resume': true}"); =20 /* Restore the postcopy bandwidth to unlimited */ - migrate_set_parameter_int(from, "max-postcopy-bandwidth", 0); + migrate_set_parameter_int(from->qs, "max-postcopy-bandwidth", 0); =20 migrate_postcopy_complete(from, to, args); } @@ -1386,26 +1407,29 @@ static void test_baddest(void) MigrateStart args =3D { .hide_stderr =3D true }; - QTestState *from, *to; + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); =20 - test_migrate_start(&from, &to, "tcp:127.0.0.1:0", &args); + test_migrate_start(from, to, "tcp:127.0.0.1:0", &args); /* * Don't change to do_migrate(). We are using a wrong uri on purpose. */ - migrate_qmp(from, "tcp:127.0.0.1:0", "{}"); - wait_for_migration_fail(from, false); + migrate_qmp(from->qs, "tcp:127.0.0.1:0", "{}"); + wait_for_migration_fail(from->qs, false); test_migrate_end(from, to, false); } =20 static void test_precopy_common(MigrateCommon *args) { - QTestState *from, *to; + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); + void *data_hook =3D NULL; =20 - test_migrate_start(&from, &to, args->listen_uri, &args->start); + test_migrate_start(from, to, args->listen_uri, &args->start); =20 if (args->start_hook) { - data_hook =3D args->start_hook(from, to); + data_hook =3D args->start_hook(from->qs, to->qs); } =20 /* Wait for the first serial output from the source */ @@ -1421,7 +1445,7 @@ static void test_precopy_common(MigrateCommon *args) * this with a ridiculosly low bandwidth that guarantees * non-convergance. */ - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from->qs); } else { /* * Testing non-live migration, we allow it to run at @@ -1430,11 +1454,11 @@ static void test_precopy_common(MigrateCommon *args) * change anything. */ if (args->result =3D=3D MIG_TEST_SUCCEED) { - qtest_qmp_assert_success(from, "{ 'execute' : 'stop'}"); + qtest_qmp_assert_success(from->qs, "{ 'execute' : 'stop'}"); if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); + qtest_qmp_eventwait(from->qs, "STOP"); } - migrate_ensure_converge(from); + migrate_ensure_converge(from->qs); } } =20 @@ -1442,53 +1466,53 @@ static void test_precopy_common(MigrateCommon *args) =20 if (args->result !=3D MIG_TEST_SUCCEED) { bool allow_active =3D args->result =3D=3D MIG_TEST_FAIL; - wait_for_migration_fail(from, allow_active); + wait_for_migration_fail(from->qs, allow_active); =20 if (args->result =3D=3D MIG_TEST_FAIL_DEST_QUIT_ERR) { - qtest_set_expected_status(to, EXIT_FAILURE); + qtest_set_expected_status(to->qs, EXIT_FAILURE); } } else { if (args->live) { if (args->iterations) { while (args->iterations--) { - wait_for_migration_pass(from); + wait_for_migration_pass(from->qs); } } else { - wait_for_migration_pass(from); + wait_for_migration_pass(from->qs); } =20 - migrate_ensure_converge(from); + migrate_ensure_converge(from->qs); =20 /* * We do this first, as it has a timeout to stop us * hanging forever if migration didn't converge */ - wait_for_migration_complete(from); + wait_for_migration_complete(from->qs); =20 if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); + qtest_qmp_eventwait(from->qs, "STOP"); } } else { - wait_for_migration_complete(from); + wait_for_migration_complete(from->qs); /* * Must wait for dst to finish reading all incoming * data on the socket before issuing 'cont' otherwise * it'll be ignored */ - wait_for_migration_complete(to); + wait_for_migration_complete(to->qs); =20 - qtest_qmp_assert_success(to, "{ 'execute' : 'cont'}"); + qtest_qmp_assert_success(to->qs, "{ 'execute' : 'cont'}"); } =20 if (!got_dst_resume) { - qtest_qmp_eventwait(to, "RESUME"); + qtest_qmp_eventwait(to->qs, "RESUME"); } =20 wait_for_serial("dest_serial"); } =20 if (args->finish_hook) { - args->finish_hook(from, to, data_hook); + args->finish_hook(from->qs, to->qs, data_hook); } =20 test_migrate_end(from, to, args->result =3D=3D MIG_TEST_SUCCEED); @@ -1580,34 +1604,36 @@ static void test_precopy_unix_tls_x509_override_hos= t(void) static void test_ignore_shared(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - QTestState *from, *to; + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateStart args =3D { .use_shmem =3D true }; =20 - test_migrate_start(&from, &to, uri, &args); + test_migrate_start(from, to, uri, &args); =20 - migrate_set_capability(from, "x-ignore-shared", true); - migrate_set_capability(to, "x-ignore-shared", true); + migrate_set_capability(from->qs, "x-ignore-shared", true); + migrate_set_capability(to->qs, "x-ignore-shared", true); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 do_migrate(from, to, uri); =20 - wait_for_migration_pass(from); + wait_for_migration_pass(from->qs); =20 if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); + qtest_qmp_eventwait(from->qs, "STOP"); } =20 - qtest_qmp_eventwait(to, "RESUME"); + qtest_qmp_eventwait(to->qs, "RESUME"); =20 wait_for_serial("dest_serial"); - wait_for_migration_complete(from); + wait_for_migration_complete(from->qs); =20 /* Check whether shared RAM has been really skipped */ - g_assert_cmpint(read_ram_property_int(from, "transferred"), <, 1024 * = 1024); + g_assert_cmpint( + read_ram_property_int(from->qs, "transferred"), <, 1024 * 1024); =20 test_migrate_end(from, to, true); } @@ -1882,17 +1908,18 @@ static void test_migrate_fd_proto(void) static void do_test_validate_uuid(MigrateStart *args, bool should_fail) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - QTestState *from, *to; + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); =20 - test_migrate_start(&from, &to, uri, args); + test_migrate_start(from, to, uri, args); =20 /* * UUID validation is at the begin of migration. So, the main process = of * migration is not interesting for us here. Thus, set huge downtime f= or * very fast migration. */ - migrate_set_parameter_int(from, "downtime-limit", 1000000); - migrate_set_capability(from, "validate-uuid", true); + migrate_set_parameter_int(from->qs, "downtime-limit", 1000000); + migrate_set_capability(from->qs, "validate-uuid", true); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); @@ -1900,10 +1927,10 @@ static void do_test_validate_uuid(MigrateStart *arg= s, bool should_fail) do_migrate(from, to, uri); =20 if (should_fail) { - qtest_set_expected_status(to, EXIT_FAILURE); - wait_for_migration_fail(from, true); + qtest_set_expected_status(to->qs, EXIT_FAILURE); + wait_for_migration_fail(from->qs, true); } else { - wait_for_migration_complete(from); + wait_for_migration_complete(from->qs); } =20 test_migrate_end(from, to, false); @@ -1969,7 +1996,8 @@ static void test_migrate_auto_converge(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); MigrateStart args =3D {}; - QTestState *from, *to; + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); int64_t percentage; =20 /* @@ -1979,21 +2007,21 @@ static void test_migrate_auto_converge(void) */ const int64_t init_pct =3D 5, inc_pct =3D 25, max_pct =3D 95; =20 - test_migrate_start(&from, &to, uri, &args); + test_migrate_start(from, to, uri, &args); =20 - migrate_set_capability(from, "auto-converge", true); - migrate_set_parameter_int(from, "cpu-throttle-initial", init_pct); - migrate_set_parameter_int(from, "cpu-throttle-increment", inc_pct); - migrate_set_parameter_int(from, "max-cpu-throttle", max_pct); + migrate_set_capability(from->qs, "auto-converge", true); + migrate_set_parameter_int(from->qs, "cpu-throttle-initial", init_pct); + migrate_set_parameter_int(from->qs, "cpu-throttle-increment", inc_pct); + migrate_set_parameter_int(from->qs, "max-cpu-throttle", max_pct); =20 /* * Set the initial parameters so that the migration could not converge * without throttling. */ - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from->qs); =20 /* To check remaining size after precopy */ - migrate_set_capability(from, "pause-before-switchover", true); + migrate_set_capability(from->qs, "pause-before-switchover", true); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); @@ -2003,7 +2031,8 @@ static void test_migrate_auto_converge(void) /* Wait for throttling begins */ percentage =3D 0; do { - percentage =3D read_migrate_property_int(from, "cpu-throttle-perce= ntage"); + percentage =3D read_migrate_property_int(from->qs, + "cpu-throttle-percentage"); if (percentage !=3D 0) { break; } @@ -2013,23 +2042,23 @@ static void test_migrate_auto_converge(void) /* The first percentage of throttling should be at least init_pct */ g_assert_cmpint(percentage, >=3D, init_pct); /* Now, when we tested that throttling works, let it converge */ - migrate_ensure_converge(from); + migrate_ensure_converge(from->qs); =20 /* * Wait for pre-switchover status to check last throttle percentage * and remaining. These values will be zeroed later */ - wait_for_migration_status(from, "pre-switchover", NULL); + wait_for_migration_status(from->qs, "pre-switchover", NULL); =20 /* The final percentage of throttling shouldn't be greater than max_pc= t */ - percentage =3D read_migrate_property_int(from, "cpu-throttle-percentag= e"); + percentage =3D read_migrate_property_int(from->qs, "cpu-throttle-perce= ntage"); g_assert_cmpint(percentage, <=3D, max_pct); - migrate_continue(from, "pre-switchover"); + migrate_continue(from->qs, "pre-switchover"); =20 - qtest_qmp_eventwait(to, "RESUME"); + qtest_qmp_eventwait(to->qs, "RESUME"); =20 wait_for_serial("dest_serial"); - wait_for_migration_complete(from); + wait_for_migration_complete(from->qs); =20 test_migrate_end(from, to, true); } @@ -2286,20 +2315,22 @@ static void test_multifd_tcp_cancel(void) MigrateStart args =3D { .hide_stderr =3D true, }; - QTestState *from, *to, *to2; + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); + GuestState *to2 =3D guest_create("target2"); =20 - test_migrate_start(&from, &to, "defer", &args); + test_migrate_start(from, to, "defer", &args); =20 - migrate_ensure_non_converge(from); + migrate_ensure_non_converge(from->qs); =20 - migrate_set_parameter_int(from, "multifd-channels", 16); - migrate_set_parameter_int(to, "multifd-channels", 16); + migrate_set_parameter_int(from->qs, "multifd-channels", 16); + migrate_set_parameter_int(to->qs, "multifd-channels", 16); =20 - migrate_set_capability(from, "multifd", true); - migrate_set_capability(to, "multifd", true); + migrate_set_capability(from->qs, "multifd", true); + migrate_set_capability(to->qs, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," + qtest_qmp_assert_success(to->qs, "{ 'execute': 'migrate-incoming'," " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); =20 /* Wait for the first serial output from the source */ @@ -2307,43 +2338,43 @@ static void test_multifd_tcp_cancel(void) =20 do_migrate(from, to, "127.0.0.1:0"); =20 - wait_for_migration_pass(from); + wait_for_migration_pass(from->qs); =20 - migrate_cancel(from); + migrate_cancel(from->qs); =20 /* Make sure QEMU process "to" exited */ - qtest_set_expected_status(to, EXIT_FAILURE); - qtest_wait_qemu(to); + qtest_set_expected_status(to->qs, EXIT_FAILURE); + qtest_wait_qemu(to->qs); =20 args =3D (MigrateStart){ .only_target =3D true, }; =20 - test_migrate_start(&from, &to2, "defer", &args); + test_migrate_start(from, to2, "defer", &args); =20 - migrate_set_parameter_int(to2, "multifd-channels", 16); + migrate_set_parameter_int(to2->qs, "multifd-channels", 16); =20 - migrate_set_capability(to2, "multifd", true); + migrate_set_capability(to2->qs, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - qtest_qmp_assert_success(to2, "{ 'execute': 'migrate-incoming'," + qtest_qmp_assert_success(to2->qs, "{ 'execute': 'migrate-incoming'," " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); =20 - wait_for_migration_status(from, "cancelled", NULL); + wait_for_migration_status(from->qs, "cancelled", NULL); =20 - migrate_ensure_converge(from); + migrate_ensure_converge(from->qs); =20 do_migrate(from, to2, "127.0.0.1:0"); =20 - wait_for_migration_pass(from); + wait_for_migration_pass(from->qs); =20 if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); + qtest_qmp_eventwait(from->qs, "STOP"); } - qtest_qmp_eventwait(to2, "RESUME"); + qtest_qmp_eventwait(to2->qs, "RESUME"); =20 wait_for_serial("dest_serial"); - wait_for_migration_complete(from); + wait_for_migration_complete(from->qs); test_migrate_end(from, to2, true); } =20 @@ -2477,9 +2508,9 @@ static int64_t get_limit_rate(QTestState *who) return dirtyrate; } =20 -static QTestState *dirtylimit_start_vm(void) +static GuestState *dirtylimit_start_vm(void) { - QTestState *vm =3D NULL; + GuestState *vm =3D guest_create("dirtylimit-test"); g_autofree gchar * cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " @@ -2488,19 +2519,18 @@ static QTestState *dirtylimit_start_vm(void) "-drive file=3D%s,format=3Draw ", tmpfs, bootpath); =20 - vm =3D qtest_init(cmd); + vm->qs =3D qtest_init(cmd); return vm; } =20 -static void dirtylimit_stop_vm(QTestState *vm) +static void dirtylimit_stop_vm(GuestState *vm) { - qtest_quit(vm); + guest_destroy(vm); cleanup("vm_serial"); } =20 static void test_vcpu_dirty_limit(void) { - QTestState *vm; int64_t origin_rate; int64_t quota_rate; int64_t rate ; @@ -2508,19 +2538,19 @@ static void test_vcpu_dirty_limit(void) int hit =3D 0; =20 /* Start vm for vcpu dirtylimit test */ - vm =3D dirtylimit_start_vm(); + GuestState *vm =3D dirtylimit_start_vm(); =20 /* Wait for the first serial output from the vm*/ wait_for_serial("vm_serial"); =20 /* Do dirtyrate measurement with calc time equals 1s */ - calc_dirty_rate(vm, 1); + calc_dirty_rate(vm->qs, 1); =20 /* Sleep calc time and wait for calc dirtyrate complete */ - wait_for_calc_dirtyrate_complete(vm, 1); + wait_for_calc_dirtyrate_complete(vm->qs, 1); =20 /* Query original dirty page rate */ - origin_rate =3D get_dirty_rate(vm); + origin_rate =3D get_dirty_rate(vm->qs); =20 /* VM booted from bootsect should dirty memory steadily */ assert(origin_rate !=3D 0); @@ -2529,13 +2559,13 @@ static void test_vcpu_dirty_limit(void) quota_rate =3D origin_rate / 2; =20 /* Set dirtylimit */ - dirtylimit_set_all(vm, quota_rate); + dirtylimit_set_all(vm->qs, quota_rate); =20 /* * Check if set-vcpu-dirty-limit and query-vcpu-dirty-limit * works literally */ - g_assert_cmpint(quota_rate, =3D=3D, get_limit_rate(vm)); + g_assert_cmpint(quota_rate, =3D=3D, get_limit_rate(vm->qs)); =20 /* Sleep a bit to check if it take effect */ usleep(2000000); @@ -2546,9 +2576,9 @@ static void test_vcpu_dirty_limit(void) * doesn't take effect, fail test. */ while (--max_try_count) { - calc_dirty_rate(vm, 1); - wait_for_calc_dirtyrate_complete(vm, 1); - rate =3D get_dirty_rate(vm); + calc_dirty_rate(vm->qs, 1); + wait_for_calc_dirtyrate_complete(vm->qs, 1); + rate =3D get_dirty_rate(vm->qs); =20 /* * Assume hitting if current rate is less @@ -2566,11 +2596,11 @@ static void test_vcpu_dirty_limit(void) max_try_count =3D 20; =20 /* Check if dirtylimit cancellation take effect */ - cancel_vcpu_dirty_limit(vm); + cancel_vcpu_dirty_limit(vm->qs); while (--max_try_count) { - calc_dirty_rate(vm, 1); - wait_for_calc_dirtyrate_complete(vm, 1); - rate =3D get_dirty_rate(vm); + calc_dirty_rate(vm->qs, 1); + wait_for_calc_dirtyrate_complete(vm->qs, 1); + rate =3D get_dirty_rate(vm->qs); =20 /* * Assume dirtylimit be canceled if current rate is --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264677; cv=none; d=zohomail.com; s=zohoarc; b=X8RTn5NqxAN7dZX5RqC5pKrbYtKC4YL+JEH7yT1vTsfldD+fQ/lVdvJJ3El1Z1k7+mm4l43nkWYdy/wDEWBY1VXea+R7003YiYCjt7fHlqz9D8pq3HLwYop9Xtg7ha68eNDuzx6k1PvuqlzEiTnx2V6QJSGAuMBGfMMZSZ3nbfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264677; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=O1pI/BP2IizABLIeg9YZBR3oLfPlDsau/eE+8LuSHew=; b=kVE0bL9xvN//apuB7c+xu2qdg+XbcmWLFnakxLUT3gN7V1zqJnmYkt2VSjT6/coOx2szdw/4zzrcS9tXm2HfeVMzju/eyQb1ivNDIQzMbyNatvAwYaQ6ucHmrMg2OrvqfjztA/I1Na0RGNlOi/4RJhIm3ZnxjpyhOldVfmrGuAk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264677101221.27773085631736; Thu, 8 Jun 2023 15:51:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSY-0003Zt-Gz; Thu, 08 Jun 2023 18:50:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSW-0003Yd-La for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSV-00054e-3k for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:24 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-638-IeoyYnGnNIa8lZV88COeDQ-1; Thu, 08 Jun 2023 18:50:20 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B9F4185A78F; Thu, 8 Jun 2023 22:50:20 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF12F515541; Thu, 8 Jun 2023 22:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=O1pI/BP2IizABLIeg9YZBR3oLfPlDsau/eE+8LuSHew=; b=YKV72j46ED7UZ+LqNXHdPiazdyiEmxU8GjV8cmiy7SkIL3UqNZJuwulHvjG12iB2yrYHBe LxGn5BaM8u0unxsHCERucIIH/MQXhPLksUyfjQaTrcNASVFjfPrM/Q6EEPNAg2gDHxo0Vu J7cy9euByy4VbJSEHI8t/UNs10SpKOE= X-MC-Unique: IeoyYnGnNIa8lZV88COeDQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 18/42] migration-test: Create guest before calling do_test_validate_uuid() Date: Fri, 9 Jun 2023 00:49:19 +0200 Message-Id: <20230608224943.3877-19-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264678091100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 5cfc7a6ebc..14f4fd579b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1905,11 +1905,10 @@ static void test_migrate_fd_proto(void) } #endif /* _WIN32 */ =20 -static void do_test_validate_uuid(MigrateStart *args, bool should_fail) +static void do_test_validate_uuid(GuestState *from, GuestState *to, + MigrateStart *args, bool should_fail) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - GuestState *from =3D guest_create("source"); - GuestState *to =3D guest_create("target"); =20 test_migrate_start(from, to, uri, args); =20 @@ -1938,43 +1937,51 @@ static void do_test_validate_uuid(MigrateStart *arg= s, bool should_fail) =20 static void test_validate_uuid(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateStart args =3D { .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", .opts_target =3D "-uuid 11111111-1111-1111-1111-111111111111", }; =20 - do_test_validate_uuid(&args, false); + do_test_validate_uuid(from, to, &args, false); } =20 static void test_validate_uuid_error(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateStart args =3D { .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", .opts_target =3D "-uuid 22222222-2222-2222-2222-222222222222", .hide_stderr =3D true, }; =20 - do_test_validate_uuid(&args, true); + do_test_validate_uuid(from, to, &args, true); } =20 static void test_validate_uuid_src_not_set(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateStart args =3D { .opts_target =3D "-uuid 22222222-2222-2222-2222-222222222222", .hide_stderr =3D true, }; =20 - do_test_validate_uuid(&args, false); + do_test_validate_uuid(from, to, &args, false); } =20 static void test_validate_uuid_dst_not_set(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateStart args =3D { .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", .hide_stderr =3D true, }; =20 - do_test_validate_uuid(&args, false); + do_test_validate_uuid(from, to, &args, false); } =20 /* --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686265026; cv=none; d=zohomail.com; s=zohoarc; b=lsaNNtYUaKvScBEUXt/OkURn2S9aKnA2umP0U3h4UPByfkDv1H0Wi78F1iNQBoMdQYh20B9tCMmFSfZDUqA09CaX24O7vnZWE74WWGcbMv15Zt4hepNw5xquwAvKlkek1rGc3+bcYQFkb/uM529zD7kFbZEk4N/9ahsn5wwHIHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265026; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aWqjeoEZdLsjerSt0GiQQXRXO+jnwFsGlvl9xehGb8I=; b=NLROcEMnX4Y04WSN1MvopFHehjOQFbNKzjaKrIZk1NVIxIiP6H+odZ2SMGfDvhhh1vMmKKO0e82iSPZs1TDeXbvSfx9tNSmdvBjH9TvIeLvmIV1lQoSh2aDGy/QgRd57zMxmH7iBEs6W+CUC7N653OX+F6pf/oZ45vmwXalZWOw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686265026755408.83011419907257; Thu, 8 Jun 2023 15:57:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSc-0003cS-7G; Thu, 08 Jun 2023 18:50:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSa-0003bA-LD for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSY-00056Q-Ez for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:28 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-97-VnbJwEJ-MeWXpX4TYbiylA-1; Thu, 08 Jun 2023 18:50:22 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 66DF9811E85; Thu, 8 Jun 2023 22:50:22 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5145515541; Thu, 8 Jun 2023 22:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264625; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aWqjeoEZdLsjerSt0GiQQXRXO+jnwFsGlvl9xehGb8I=; b=QMmMXL/TOTmDOj9bRCdvVuB+Q4LBGiVBxp88OfporPn4hb0cSU3fdHFyZwz5kqma53CfTw S81jDY38EcxGyvlI3E9r9mYGK4xje6RUZ7BYoT24GKElnRVNLJ4EpuPIsE///A44G+oNar dvP5n1uXYwHsDqvWnh1hITozTy7Yg5w= X-MC-Unique: VnbJwEJ-MeWXpX4TYbiylA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 19/42] migration-test: Create guest before calling test_precopy_common() Date: Fri, 9 Jun 2023 00:49:20 +0200 Message-Id: <20230608224943.3877-20-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265028750100011 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 122 +++++++++++++++++++++++++---------- 1 file changed, 89 insertions(+), 33 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 14f4fd579b..528dc571ef 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1419,11 +1419,9 @@ static void test_baddest(void) test_migrate_end(from, to, false); } =20 -static void test_precopy_common(MigrateCommon *args) +static void test_precopy_common(GuestState *from, GuestState *to, + MigrateCommon *args) { - GuestState *from =3D guest_create("source"); - GuestState *to =3D guest_create("target"); - void *data_hook =3D NULL; =20 test_migrate_start(from, to, args->listen_uri, &args->start); @@ -1521,6 +1519,8 @@ static void test_precopy_common(MigrateCommon *args) static void test_precopy_unix_plain(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D uri, .connect_uri =3D uri, @@ -1531,13 +1531,15 @@ static void test_precopy_unix_plain(void) .live =3D true, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 =20 static void test_precopy_unix_dirty_ring(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start =3D { .use_dirty_ring =3D true, @@ -1551,13 +1553,15 @@ static void test_precopy_unix_dirty_ring(void) .live =3D true, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 #ifdef CONFIG_GNUTLS static void test_precopy_unix_tls_psk(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D uri, @@ -1565,13 +1569,15 @@ static void test_precopy_unix_tls_psk(void) .finish_hook =3D test_migrate_tls_psk_finish, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 #ifdef CONFIG_TASN1 static void test_precopy_unix_tls_x509_default_host(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, @@ -1583,12 +1589,14 @@ static void test_precopy_unix_tls_x509_default_host= (void) .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_unix_tls_x509_override_host(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D uri, @@ -1596,7 +1604,7 @@ static void test_precopy_unix_tls_x509_override_host(= void) .finish_hook =3D test_migrate_tls_x509_finish, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } #endif /* CONFIG_TASN1 */ #endif /* CONFIG_GNUTLS */ @@ -1653,6 +1661,8 @@ test_migrate_xbzrle_start(QTestState *from, static void test_precopy_unix_xbzrle(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D uri, @@ -1665,12 +1675,14 @@ static void test_precopy_unix_xbzrle(void) .live =3D true, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_unix_compress(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D uri, @@ -1688,12 +1700,14 @@ static void test_precopy_unix_compress(void) .live =3D true, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_unix_compress_nowait(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .connect_uri =3D uri, .listen_uri =3D uri, @@ -1707,32 +1721,38 @@ static void test_precopy_unix_compress_nowait(void) .live =3D true, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_tcp_plain(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "tcp:127.0.0.1:0", }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 #ifdef CONFIG_GNUTLS static void test_precopy_tcp_tls_psk_match(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_psk_start_match, .finish_hook =3D test_migrate_tls_psk_finish, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_tcp_tls_psk_mismatch(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, @@ -1743,34 +1763,40 @@ static void test_precopy_tcp_tls_psk_mismatch(void) .result =3D MIG_TEST_FAIL, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 #ifdef CONFIG_TASN1 static void test_precopy_tcp_tls_x509_default_host(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_default_host, .finish_hook =3D test_migrate_tls_x509_finish, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_tcp_tls_x509_override_host(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_override_host, .finish_hook =3D test_migrate_tls_x509_finish, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_tcp_tls_x509_mismatch_host(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, @@ -1781,22 +1807,26 @@ static void test_precopy_tcp_tls_x509_mismatch_host= (void) .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_tcp_tls_x509_friendly_client(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_friendly_client, .finish_hook =3D test_migrate_tls_x509_finish, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_tcp_tls_x509_hostile_client(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, @@ -1807,22 +1837,26 @@ static void test_precopy_tcp_tls_x509_hostile_clien= t(void) .result =3D MIG_TEST_FAIL, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_tcp_tls_x509_allow_anon_client(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_allow_anon_client, .finish_hook =3D test_migrate_tls_x509_finish, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_precopy_tcp_tls_x509_reject_anon_client(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, @@ -1833,7 +1867,7 @@ static void test_precopy_tcp_tls_x509_reject_anon_cli= ent(void) .result =3D MIG_TEST_FAIL, }; =20 - test_precopy_common(&args); + test_precopy_common(from, to, &args); } #endif /* CONFIG_TASN1 */ #endif /* CONFIG_GNUTLS */ @@ -1895,13 +1929,15 @@ static void test_migrate_fd_finish_hook(QTestState = *from, =20 static void test_migrate_fd_proto(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "defer", .connect_uri =3D "fd:fd-mig", .start_hook =3D test_migrate_fd_start_hook, .finish_hook =3D test_migrate_fd_finish_hook }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } #endif /* _WIN32 */ =20 @@ -2116,6 +2152,8 @@ test_migrate_precopy_tcp_multifd_zstd_start(QTestStat= e *from, =20 static void test_multifd_tcp_none(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "defer", .start_hook =3D test_migrate_precopy_tcp_multifd_start, @@ -2126,26 +2164,30 @@ static void test_multifd_tcp_none(void) */ .live =3D true, }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_multifd_tcp_zlib(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "defer", .start_hook =3D test_migrate_precopy_tcp_multifd_zlib_start, }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 #ifdef CONFIG_ZSTD static void test_multifd_tcp_zstd(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "defer", .start_hook =3D test_migrate_precopy_tcp_multifd_zstd_start, }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } #endif =20 @@ -2210,16 +2252,20 @@ test_migrate_multifd_tls_x509_start_reject_anon_cli= ent(QTestState *from, =20 static void test_multifd_tcp_tls_psk_match(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tcp_tls_psk_start_match, .finish_hook =3D test_migrate_tls_psk_finish, }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_multifd_tcp_tls_psk_mismatch(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, @@ -2229,28 +2275,32 @@ static void test_multifd_tcp_tls_psk_mismatch(void) .finish_hook =3D test_migrate_tls_psk_finish, .result =3D MIG_TEST_FAIL, }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 #ifdef CONFIG_TASN1 static void test_multifd_tcp_tls_x509_default_host(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tls_x509_start_default_host, .finish_hook =3D test_migrate_tls_x509_finish, }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_multifd_tcp_tls_x509_override_host(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tls_x509_start_override_host, .finish_hook =3D test_migrate_tls_x509_finish, }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_multifd_tcp_tls_x509_mismatch_host(void) @@ -2268,6 +2318,8 @@ static void test_multifd_tcp_tls_x509_mismatch_host(v= oid) * to load migration state, and thus just aborts the migration * without exiting. */ + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, @@ -2277,21 +2329,25 @@ static void test_multifd_tcp_tls_x509_mismatch_host= (void) .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL, }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_multifd_tcp_tls_x509_allow_anon_client(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tls_x509_start_allow_anon_cli= ent, .finish_hook =3D test_migrate_tls_x509_finish, }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } =20 static void test_multifd_tcp_tls_x509_reject_anon_client(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, @@ -2301,7 +2357,7 @@ static void test_multifd_tcp_tls_x509_reject_anon_cli= ent(void) .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL, }; - test_precopy_common(&args); + test_precopy_common(from, to, &args); } #endif /* CONFIG_TASN1 */ #endif /* CONFIG_GNUTLS */ --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264957; cv=none; d=zohomail.com; s=zohoarc; b=CLGsF/tkTYeiVXUsEyi6uGnnG0pI+bgPWz0QGkz5U2urNbttVl2TxLXV9upBtjhGSotqbEPX0zrB3MNf2NSdkUfHN7xpY1oZytq058HoX6Vo5h1dcegchnTBQ1LCLjFX8MN+niyruFVpsrDTRlSu+F9A50mfdDsbCTPUrdMxn2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264957; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xtnabW/FzzwqFPUIYX3N3p9+Q6zIYLzIkpHYsX40f6o=; b=kGze3179nAWmmLbyH4CdTOK009jixCSMvhQVUtcmFG+wAu5ExNCEiynSVjCkRln781h2zuNAVATGv0Hd9Y/QmHJfKcqWQY/+yTrJORf4cWnsLy/hozZbcFgOfcmt0p71gPqkk9kR04vBJPq9YBpgofxVeUg0Bde8GKIijJrGr2g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264957209658.0423441972723; Thu, 8 Jun 2023 15:55:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSc-0003d1-Qs; Thu, 08 Jun 2023 18:50:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSb-0003cH-Vq for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSa-00057C-DY for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:29 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-330-dYQf7ezsO_-h_2NhU8sCcw-1; Thu, 08 Jun 2023 18:50:25 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3FF8F801182; Thu, 8 Jun 2023 22:50:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB68B515541; Thu, 8 Jun 2023 22:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264627; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xtnabW/FzzwqFPUIYX3N3p9+Q6zIYLzIkpHYsX40f6o=; b=MNtoyLOHTjE0xj8MC/lRRwZTOOawrZ77nATAzdmc8ZBJ8IVVwaZEXXnWGc0DLUjiWNIgxw bdQyT9IctPafGfBJe8XLmO46hIuJgDx+g9SsAbS6mkBJS6zxyQeAJEDj2iHvc3YKccJa8+ iNwPtkv0JXN3/7XuoU3E8m1I+cdRqaI= X-MC-Unique: dYQf7ezsO_-h_2NhU8sCcw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 20/42] migration-test: Create guest before calling test_postcopy_common() Date: Fri, 9 Jun 2023 00:49:21 +0200 Message-Id: <20230608224943.3877-21-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264959004100021 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 528dc571ef..a18b3ce1e2 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1230,11 +1230,9 @@ static void migrate_postcopy_complete(GuestState *fr= om, GuestState *to, test_migrate_end(from, to, true); } =20 -static void test_postcopy_common(MigrateCommon *args) +static void test_postcopy_common(GuestState *from, GuestState *to, + MigrateCommon *args) { - GuestState *from =3D guest_create("source"); - GuestState *to =3D guest_create("target"); - migrate_postcopy_prepare(from, to, args); migrate_postcopy_start(from->qs, to->qs); migrate_postcopy_complete(from, to, args); @@ -1242,49 +1240,59 @@ static void test_postcopy_common(MigrateCommon *arg= s) =20 static void test_postcopy(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { }; =20 - test_postcopy_common(&args); + test_postcopy_common(from, to, &args); } =20 static void test_postcopy_compress(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start_hook =3D test_migrate_compress_start }; =20 - test_postcopy_common(&args); + test_postcopy_common(from, to, &args); } =20 static void test_postcopy_preempt(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .postcopy_preempt =3D true, }; =20 - test_postcopy_common(&args); + test_postcopy_common(from, to, &args); } =20 #ifdef CONFIG_GNUTLS static void test_postcopy_tls_psk(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .start_hook =3D test_migrate_tls_psk_start_match, .finish_hook =3D test_migrate_tls_psk_finish, }; =20 - test_postcopy_common(&args); + test_postcopy_common(from, to, &args); } =20 static void test_postcopy_preempt_tls_psk(void) { + GuestState *from =3D guest_create("source"); + GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .postcopy_preempt =3D true, .start_hook =3D test_migrate_tls_psk_start_match, .finish_hook =3D test_migrate_tls_psk_finish, }; =20 - test_postcopy_common(&args); + test_postcopy_common(from, to, &args); } #endif =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264881; cv=none; d=zohomail.com; s=zohoarc; b=jcwNjQOvLyNBCRQ0FT2w5+FdRKgDPiyrsCx1KqwULkJQp8Z+ULug2NNrC5teO5DTXwTdDJxMWnKoExRR4r1M9aLWg7nsbnVl2mtvwwtIVYO2XxiNkuvNtZ2rnIflIZwyaaapbMnDAtK8vqJ8T5E2byYWEgR0ijIcpi0smkykIhs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264881; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=s/EOC/BzsmoJBdHcGAPixhJ+VEqlkAvngm2nxmR52Kg=; b=J9zcg6BAEQyIHLAYeLGwnS9NNbkv8xTB/40NXunY1styg9RtLo9B/Xao69TY+PZmID7YUXVyg6ex4muj1E8+tkuqmzUpUD3QGpTABpaaglOwLMGBpf5XipsKwodmlL+eby6GaxSFEW+GDixFw6jtXdrZaWpBHk0D0ORocByEhwM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264881511396.71532778719734; Thu, 8 Jun 2023 15:54:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSf-0003lG-Uo; Thu, 08 Jun 2023 18:50:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSe-0003dd-5v for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSc-00057k-9w for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:31 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-137-a6f1a3EoPH2OyWtB0RW4yA-1; Thu, 08 Jun 2023 18:50:27 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 35E602A59548; Thu, 8 Jun 2023 22:50:27 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88370515544; Thu, 8 Jun 2023 22:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=s/EOC/BzsmoJBdHcGAPixhJ+VEqlkAvngm2nxmR52Kg=; b=jROHfmmSNCxImNUs9+aSPBal2bmGmKo5IadyCrQ0iu1+wTrYNHbKDg2tRwV86AA66reRb6 QlfKEcyY25wSGHTq7C0lK0e67oQOPNESQWOn2ePcs37GyZBK5PkdHATyvQ+WILzBevRqps 9QBoxpu8F/53kpqkVXWn60DAfoozC04= X-MC-Unique: a6f1a3EoPH2OyWtB0RW4yA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 21/42] migration-test: Move common guest code to guest_create() Date: Fri, 9 Jun 2023 00:49:22 +0200 Message-Id: <20230608224943.3877-22-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264882089100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 104 ++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 49 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index a18b3ce1e2..9671c4c6e5 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -40,8 +40,6 @@ #include "linux/kvm.h" #endif =20 -unsigned start_address; -unsigned end_address; static bool uffd_feature_thread_id; static bool got_src_stop; static bool got_dst_resume; @@ -154,12 +152,50 @@ static void bootfile_delete(void) =20 typedef struct { QTestState *qs; + /* options for source and target */ + gchar *arch_opts; + gchar *arch_source; + gchar *arch_target; + const gchar *memory_size; const gchar *name; + unsigned start_address; + unsigned end_address; } GuestState; =20 static GuestState *guest_create(const char *name) { GuestState *vm =3D g_new0(GuestState, 1); + const char *arch =3D qtest_get_arch(); + + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + vm->memory_size =3D "150M"; + vm->arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw",= bootpath); + vm->start_address =3D X86_TEST_MEM_START; + vm->end_address =3D X86_TEST_MEM_END; + } else if (g_str_equal(arch, "s390x")) { + vm->memory_size =3D "128M"; + vm->arch_opts =3D g_strdup_printf("-bios %s", bootpath); + vm->start_address =3D S390_TEST_MEM_START; + vm->end_address =3D S390_TEST_MEM_END; + } else if (strcmp(arch, "ppc64") =3D=3D 0) { + vm->memory_size =3D "256M"; + vm->start_address =3D PPC_TEST_MEM_START; + vm->end_address =3D PPC_TEST_MEM_END; + vm->arch_source =3D g_strdup_printf( + "-prom-env 'use-nvramrc?=3Dtrue' -prom-env " + "'nvramrc=3Dhex .\" _\" begin %x %x " + "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " + "until'", vm->end_address, vm->start_address); + vm->arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); + } else if (strcmp(arch, "aarch64") =3D=3D 0) { + vm->memory_size =3D "150M"; + vm->arch_opts =3D g_strdup_printf( + "-machine virt,gic-version=3Dmax -cpu max -kernel %s", bootpat= h); + vm->start_address =3D ARM_TEST_MEM_START; + vm->end_address =3D ARM_TEST_MEM_END; + } else { + g_assert_not_reached(); + } =20 vm->name =3D name; =20 @@ -169,6 +205,9 @@ static GuestState *guest_create(const char *name) static void guest_destroy(GuestState *vm) { qtest_quit(vm->qs); + g_free(vm->arch_opts); + g_free(vm->arch_source); + g_free(vm->arch_target); g_free(vm); } =20 @@ -307,10 +346,11 @@ static void check_guests_ram(GuestState *who) bool hit_edge =3D false; int bad =3D 0; =20 - qtest_memread(who->qs, start_address, &first_byte, 1); + qtest_memread(who->qs, who->start_address, &first_byte, 1); last_byte =3D first_byte; =20 - for (address =3D start_address + TEST_MEM_PAGE_SIZE; address < end_add= ress; + for (address =3D who->start_address + TEST_MEM_PAGE_SIZE; + address < who->end_address; address +=3D TEST_MEM_PAGE_SIZE) { uint8_t b; @@ -663,49 +703,15 @@ typedef struct { static void test_migrate_start(GuestState *from, GuestState *to, const char *uri, MigrateStart *args) { - g_autofree gchar *arch_source =3D NULL; - g_autofree gchar *arch_target =3D NULL; - /* options for source and target */ - g_autofree gchar *arch_opts =3D NULL; g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; const gchar *ignore_stderr =3D NULL; g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; const char *kvm_opts =3D NULL; - const char *arch =3D qtest_get_arch(); - const char *memory_size; =20 got_src_stop =3D false; got_dst_resume =3D false; - if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - memory_size =3D "150M"; - arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw", boo= tpath); - start_address =3D X86_TEST_MEM_START; - end_address =3D X86_TEST_MEM_END; - } else if (g_str_equal(arch, "s390x")) { - memory_size =3D "128M"; - arch_opts =3D g_strdup_printf("-bios %s", bootpath); - start_address =3D S390_TEST_MEM_START; - end_address =3D S390_TEST_MEM_END; - } else if (strcmp(arch, "ppc64") =3D=3D 0) { - memory_size =3D "256M"; - start_address =3D PPC_TEST_MEM_START; - end_address =3D PPC_TEST_MEM_END; - arch_source =3D g_strdup_printf("-prom-env 'use-nvramrc?=3Dtrue' -= prom-env " - "'nvramrc=3Dhex .\" _\" begin %x %x " - "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " - "until'", end_address, start_address= ); - arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); - } else if (strcmp(arch, "aarch64") =3D=3D 0) { - memory_size =3D "150M"; - arch_opts =3D g_strdup_printf("-machine virt,gic-version=3Dmax -cp= u max " - "-kernel %s", bootpath); - start_address =3D ARM_TEST_MEM_START; - end_address =3D ARM_TEST_MEM_END; - } else { - g_assert_not_reached(); - } =20 if (!getenv("QTEST_LOG") && args->hide_stderr) { #ifndef _WIN32 @@ -724,7 +730,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, shmem_opts =3D g_strdup_printf( "-object memory-backend-file,id=3Dmem0,size=3D%s" ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", - memory_size, shmem_path); + from->memory_size, shmem_path); } =20 if (args->use_dirty_ring) { @@ -738,9 +744,9 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, "%s %s %s %s %s", kvm_opts ? kvm_opts : "", from->name, - memory_size, tmpfs, - arch_opts ? arch_opts : "", - arch_source ? arch_source : "", + from->memory_size, tmpfs, + from->arch_opts ? from->arch_opts : "", + from->arch_source ? from->arch_source : "= ", shmem_opts ? shmem_opts : "", args->opts_source ? args->opts_source : "= ", ignore_stderr ? ignore_stderr : ""); @@ -760,9 +766,9 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, "%s %s %s %s %s", kvm_opts ? kvm_opts : "", to->name, - memory_size, tmpfs, uri, - arch_opts ? arch_opts : "", - arch_target ? arch_target : "", + to->memory_size, tmpfs, uri, + to->arch_opts ? to->arch_opts : "", + to->arch_target ? to->arch_target : "", shmem_opts ? shmem_opts : "", args->opts_target ? args->opts_target : "= ", ignore_stderr ? ignore_stderr : ""); @@ -787,20 +793,20 @@ static void test_migrate_end(GuestState *from, GuestS= tate *to, bool test_dest) guest_destroy(from); =20 if (test_dest) { - qtest_memread(to->qs, start_address, &dest_byte_a, 1); + qtest_memread(to->qs, to->start_address, &dest_byte_a, 1); =20 /* Destination still running, wait for a byte to change */ do { - qtest_memread(to->qs, start_address, &dest_byte_b, 1); + qtest_memread(to->qs, to->start_address, &dest_byte_b, 1); usleep(1000 * 10); } while (dest_byte_a =3D=3D dest_byte_b); =20 qtest_qmp_assert_success(to->qs, "{ 'execute' : 'stop'}"); =20 /* With it stopped, check nothing changes */ - qtest_memread(to->qs, start_address, &dest_byte_c, 1); + qtest_memread(to->qs, to->start_address, &dest_byte_c, 1); usleep(1000 * 200); - qtest_memread(to->qs, start_address, &dest_byte_d, 1); + qtest_memread(to->qs, to->start_address, &dest_byte_d, 1); g_assert_cmpint(dest_byte_c, =3D=3D, dest_byte_d); =20 check_guests_ram(to); --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264952; cv=none; d=zohomail.com; s=zohoarc; b=IhU2eDywPtVachYJoF0B6ctTQYhAa2cq3mBksIZ+auQcV9ckkEnRnUKnREGMyOhm9Ax8LsdO3vuXeqn2uLvc86WxPcgHk5W8fNO1xgoIfsJ9FF2KfNkOH7iIFCo4hLLBCImTXTfgQ5n9OqdtUGs4d4RdNQAQX3iUUu+VeyZ230E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264952; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1rhPYNYE42HQeY1eRKeAgK6BPwEJ/BcC1H/q4dfGUy8=; b=k0uYFiHS/9pyM+vjkRSADzQT91cJG2nciHHGgBL1VofUeSf1WxSdGUifpEbKMMvYK3bhGeoMg1oG/ZUZ1ysT0ZBEaekOyQfw2Nt9h1vJFRH+kdedVTI94bcs8S8ptPoMjwFAfUqX0ux8NGd/C2N55AwygchUrixAyvzuv52FbJs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168626495242647.466825396696095; Thu, 8 Jun 2023 15:55:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSg-0003mi-5a; Thu, 08 Jun 2023 18:50:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSe-0003h3-Tp for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSd-00058Y-AA for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:32 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-670-4pzmH_VXMpCMzeJWbGKKvQ-1; Thu, 08 Jun 2023 18:50:29 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 09A07385556A; Thu, 8 Jun 2023 22:50:29 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DC23492B00; Thu, 8 Jun 2023 22:50:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1rhPYNYE42HQeY1eRKeAgK6BPwEJ/BcC1H/q4dfGUy8=; b=Qkm9u8/SbLjedr09aAVwjeqXRufF9IcktwzYsUN7B4U1JY5835MY8TMua5QS/WPAHCKOpW HF+GK1kDvPmZgzB6L/hhW5jSsY7VoyW0HdC7GFxBYPp5rMIn/Sq3SFGGqSoi69LZqGz7Ba 2s+pLv12DxTbojX4y45eW7AAeCx+Yfo= X-MC-Unique: 4pzmH_VXMpCMzeJWbGKKvQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 22/42] migration-test: Create guest_use_dirty_log() Date: Fri, 9 Jun 2023 00:49:23 +0200 Message-Id: <20230608224943.3877-23-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264952757100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 9671c4c6e5..69a3728e4b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -156,6 +156,7 @@ typedef struct { gchar *arch_opts; gchar *arch_source; gchar *arch_target; + gchar *kvm_opts; const gchar *memory_size; const gchar *name; unsigned start_address; @@ -208,9 +209,16 @@ static void guest_destroy(GuestState *vm) g_free(vm->arch_opts); g_free(vm->arch_source); g_free(vm->arch_target); + g_free(vm->kvm_opts); g_free(vm); } =20 +static void guest_use_dirty_ring(GuestState *vm) +{ + g_assert(vm->kvm_opts =3D=3D NULL); + vm->kvm_opts =3D g_strdup(",dirty-ring-size=3D4096"); +} + /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -608,8 +616,6 @@ typedef struct { bool use_shmem; /* only launch the target process */ bool only_target; - /* Use dirty ring if true; dirty logging otherwise */ - bool use_dirty_ring; const char *opts_source; const char *opts_target; } MigrateStart; @@ -708,7 +714,6 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, const gchar *ignore_stderr =3D NULL; g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; - const char *kvm_opts =3D NULL; =20 got_src_stop =3D false; got_dst_resume =3D false; @@ -733,16 +738,12 @@ static void test_migrate_start(GuestState *from, Gues= tState *to, from->memory_size, shmem_path); } =20 - if (args->use_dirty_ring) { - kvm_opts =3D ",dirty-ring-size=3D4096"; - } - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name %s,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s %s", - kvm_opts ? kvm_opts : "", + from->kvm_opts ? from->kvm_opts : "", from->name, from->memory_size, tmpfs, from->arch_opts ? from->arch_opts : "", @@ -764,7 +765,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, "-serial file:%s/dest_serial " "-incoming %s " "%s %s %s %s %s", - kvm_opts ? kvm_opts : "", + to->kvm_opts ? to->kvm_opts : "", to->name, to->memory_size, tmpfs, uri, to->arch_opts ? to->arch_opts : "", @@ -1555,9 +1556,6 @@ static void test_precopy_unix_dirty_ring(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .start =3D { - .use_dirty_ring =3D true, - }, .listen_uri =3D uri, .connect_uri =3D uri, /* @@ -1567,6 +1565,8 @@ static void test_precopy_unix_dirty_ring(void) .live =3D true, }; =20 + guest_use_dirty_ring(from); + guest_use_dirty_ring(to); test_precopy_common(from, to, &args); } =20 @@ -2588,6 +2588,9 @@ static int64_t get_limit_rate(QTestState *who) static GuestState *dirtylimit_start_vm(void) { GuestState *vm =3D guest_create("dirtylimit-test"); + + guest_use_dirty_ring(vm); + g_autofree gchar * cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264745; cv=none; d=zohomail.com; s=zohoarc; b=a+ze4zsRJeIivZ90a1/qgZ5Dmn3cQ6MDOxXl7inI+zq6DiWzG1GVeb9F4bFJFyUOLcgpxwc2XEI58y0+m2nZxzKZiZUotrQ4mnCavYB72+dTLgPju/qdbpkXi2mGPpJ9KSgnwphdOe/Hh2EHDouGLz3aM1rqnvG9E3oGVJKJeKc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264745; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mjhpxl6wU6+QIbMXQEEmeHvaTr4KpukWzCOVNU/C9RU=; b=I+1xsDfFYIU4iXgQM7YvqTbIfkrm//IdCFfD5voYH1QElBQj3MpYYZIkhEuP3zyzvCCYs/wZbuwf9hKnfFVk+5HxO+aZWE3ErWGv9BevcdrGG5IbqGuPnh35cYnjY7g0KDtFJfYGrH355RVR3s//WqxYY2vuqYDu2qlEINCfpr4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264745335168.75407934229463; Thu, 8 Jun 2023 15:52:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSo-0004Iq-Ea; Thu, 08 Jun 2023 18:50:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSj-00044Z-FD for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSh-0005Ab-De for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:37 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-315-BcO4TGF_O9W43GdBwfw3PQ-1; Thu, 08 Jun 2023 18:50:31 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0122C85A5AA; Thu, 8 Jun 2023 22:50:31 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51DC2492B00; Thu, 8 Jun 2023 22:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mjhpxl6wU6+QIbMXQEEmeHvaTr4KpukWzCOVNU/C9RU=; b=dHL+g0pwugGK8y25GESUEYjPT/Sqafw6qrmBgIm5+2wZW0lZ3h2sBWnp6TMDTAoloZ3Y/N fVsVA9GEFKZbSMiR6L+i6v8NrmdJ01zIl1k1JDwGldjo30T1RCAhBdTwjOmL+FaDL2BOjO VQd7SdrmZAfLVio4U+yoKCxj996v6Xo= X-MC-Unique: BcO4TGF_O9W43GdBwfw3PQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 23/42] migration-test: Move serial to GuestState Date: Fri, 9 Jun 2023 00:49:24 +0200 Message-Id: <20230608224943.3877-24-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264747270100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 65 ++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 69a3728e4b..01ab51a391 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -158,7 +158,12 @@ typedef struct { gchar *arch_target; gchar *kvm_opts; const gchar *memory_size; + /* + * name must *not* contain "target" if it is the target of a + * migration. + */ const gchar *name; + gchar *serial_path; unsigned start_address; unsigned end_address; } GuestState; @@ -199,7 +204,7 @@ static GuestState *guest_create(const char *name) } =20 vm->name =3D name; - + vm->serial_path =3D g_strdup_printf("%s/%s", tmpfs, vm->name); return vm; } =20 @@ -210,6 +215,8 @@ static void guest_destroy(GuestState *vm) g_free(vm->arch_source); g_free(vm->arch_target); g_free(vm->kvm_opts); + unlink(vm->serial_path); + g_free(vm->serial_path); g_free(vm); } =20 @@ -224,12 +231,12 @@ static void guest_use_dirty_ring(GuestState *vm) * we get an 'A' followed by an endless string of 'B's * but on the destination we won't have the A. */ -static void wait_for_serial(const char *side) +static void wait_for_serial(GuestState *vm) { - g_autofree char *serialpath =3D g_strdup_printf("%s/%s", tmpfs, side); - FILE *serialfile =3D fopen(serialpath, "r"); + FILE *serialfile =3D fopen(vm->serial_path, "r"); const char *arch =3D qtest_get_arch(); - int started =3D (strcmp(side, "src_serial") =3D=3D 0 && + /* see serial_path comment on GuestState definition */ + int started =3D (strstr(vm->serial_path, "target") =3D=3D NULL && strcmp(arch, "ppc64") =3D=3D 0) ? 0 : 1; =20 do { @@ -262,14 +269,15 @@ static void wait_for_serial(const char *side) return; =20 case EOF: - started =3D (strcmp(side, "src_serial") =3D=3D 0 && + started =3D (strstr(vm->serial_path, "target") =3D=3D NULL && strcmp(arch, "ppc64") =3D=3D 0) ? 0 : 1; fseek(serialfile, 0, SEEK_SET); usleep(1000); break; =20 default: - fprintf(stderr, "Unexpected %d on %s serial\n", readvalue, sid= e); + fprintf(stderr, "Unexpected %d on %s serial\n", readvalue, + vm->serial_path); g_assert_not_reached(); } } while (true); @@ -741,11 +749,12 @@ static void test_migrate_start(GuestState *from, Gues= tState *to, cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name %s,debug-threads=3Don " "-m %s " - "-serial file:%s/src_serial " + "-serial file:%s " "%s %s %s %s %s", from->kvm_opts ? from->kvm_opts : "", from->name, - from->memory_size, tmpfs, + from->memory_size, + from->serial_path, from->arch_opts ? from->arch_opts : "", from->arch_source ? from->arch_source : "= ", shmem_opts ? shmem_opts : "", @@ -762,12 +771,14 @@ static void test_migrate_start(GuestState *from, Gues= tState *to, cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name %s,debug-threads=3Don " "-m %s " - "-serial file:%s/dest_serial " + "-serial file:%s " "-incoming %s " "%s %s %s %s %s", to->kvm_opts ? to->kvm_opts : "", to->name, - to->memory_size, tmpfs, uri, + to->memory_size, + to->serial_path, + uri, to->arch_opts ? to->arch_opts : "", to->arch_target ? to->arch_target : "", shmem_opts ? shmem_opts : "", @@ -816,8 +827,6 @@ static void test_migrate_end(GuestState *from, GuestSta= te *to, bool test_dest) guest_destroy(to); =20 cleanup("migsocket"); - cleanup("src_serial"); - cleanup("dest_serial"); } =20 #ifdef CONFIG_GNUTLS @@ -1210,7 +1219,7 @@ static void migrate_postcopy_prepare(GuestState *from, migrate_ensure_non_converge(from->qs); =20 /* Wait for the first serial output from the source */ - wait_for_serial("src_serial"); + wait_for_serial(from); =20 do_migrate(from, to, uri); =20 @@ -1223,7 +1232,7 @@ static void migrate_postcopy_complete(GuestState *fro= m, GuestState *to, wait_for_migration_complete(from->qs); =20 /* Make sure we get at least one "B" on destination */ - wait_for_serial("dest_serial"); + wait_for_serial(to); =20 if (uffd_feature_thread_id) { read_blocktime(to->qs); @@ -1447,7 +1456,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, =20 /* Wait for the first serial output from the source */ if (args->result =3D=3D MIG_TEST_SUCCEED) { - wait_for_serial("src_serial"); + wait_for_serial(from); } =20 if (args->live) { @@ -1521,7 +1530,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, qtest_qmp_eventwait(to->qs, "RESUME"); } =20 - wait_for_serial("dest_serial"); + wait_for_serial(to); } =20 if (args->finish_hook) { @@ -1638,7 +1647,7 @@ static void test_ignore_shared(void) migrate_set_capability(to->qs, "x-ignore-shared", true); =20 /* Wait for the first serial output from the source */ - wait_for_serial("src_serial"); + wait_for_serial(from); =20 do_migrate(from, to, uri); =20 @@ -1650,7 +1659,7 @@ static void test_ignore_shared(void) =20 qtest_qmp_eventwait(to->qs, "RESUME"); =20 - wait_for_serial("dest_serial"); + wait_for_serial(to); wait_for_migration_complete(from->qs); =20 /* Check whether shared RAM has been really skipped */ @@ -1971,7 +1980,7 @@ static void do_test_validate_uuid(GuestState *from, G= uestState *to, migrate_set_capability(from->qs, "validate-uuid", true); =20 /* Wait for the first serial output from the source */ - wait_for_serial("src_serial"); + wait_for_serial(from); =20 do_migrate(from, to, uri); =20 @@ -2081,7 +2090,7 @@ static void test_migrate_auto_converge(void) migrate_set_capability(from->qs, "pause-before-switchover", true); =20 /* Wait for the first serial output from the source */ - wait_for_serial("src_serial"); + wait_for_serial(from); =20 do_migrate(from, to, uri); =20 @@ -2114,7 +2123,7 @@ static void test_migrate_auto_converge(void) =20 qtest_qmp_eventwait(to->qs, "RESUME"); =20 - wait_for_serial("dest_serial"); + wait_for_serial(to); wait_for_migration_complete(from->qs); =20 test_migrate_end(from, to, true); @@ -2411,7 +2420,7 @@ static void test_multifd_tcp_cancel(void) " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); =20 /* Wait for the first serial output from the source */ - wait_for_serial("src_serial"); + wait_for_serial(from); =20 do_migrate(from, to, "127.0.0.1:0"); =20 @@ -2450,7 +2459,7 @@ static void test_multifd_tcp_cancel(void) } qtest_qmp_eventwait(to2->qs, "RESUME"); =20 - wait_for_serial("dest_serial"); + wait_for_serial(to2); wait_for_migration_complete(from->qs); test_migrate_end(from, to2, true); } @@ -2595,9 +2604,10 @@ static GuestState *dirtylimit_start_vm(void) cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " "-m 150M -smp 1 " - "-serial file:%s/vm_serial " + "-serial file:%s " "-drive file=3D%s,format=3Draw ", - tmpfs, bootpath); + vm->serial_path, + bootpath); =20 vm->qs =3D qtest_init(cmd); return vm; @@ -2606,7 +2616,6 @@ static GuestState *dirtylimit_start_vm(void) static void dirtylimit_stop_vm(GuestState *vm) { guest_destroy(vm); - cleanup("vm_serial"); } =20 static void test_vcpu_dirty_limit(void) @@ -2621,7 +2630,7 @@ static void test_vcpu_dirty_limit(void) GuestState *vm =3D dirtylimit_start_vm(); =20 /* Wait for the first serial output from the vm*/ - wait_for_serial("vm_serial"); + wait_for_serial(vm); =20 /* Do dirtyrate measurement with calc time equals 1s */ calc_dirty_rate(vm->qs, 1); --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264871; cv=none; d=zohomail.com; s=zohoarc; b=YJ1S5t3lIizULCeKqtnAkQ1yKy0XrfgwmnndJNV2S4JwdpLQb4kGLlEfCyiBXvnfl3OZR23Y9fH4z3E6UOG1GdxvYua2dj3V4N75G3h12RIVFUcp0v0qvzXdyms1E5UN1/GggZvHf4KrZ563ON/BMl54/abqVER+Gy34pAsUcKo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264871; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=5NnC2eyi3Mg46yBkV7SLty0rJCTkfvS3oUX796cjykY=; b=gmkQtsDZcAi4vun6XhCZfxinqQ2htMfUE0cBRoJDpVLjJnb01LC2vKF4qVRbnwgu4R/WnsNU/YUI8U8aO/0JViYtuxBunj3MJZ8qbVKqsEWcsg+ERtOTISU74wgN1iCqk00dTtRS8UMOQ19SFvIKBMbPFojftRdm8fTx8lT8S30= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264871658544.0680436526808; Thu, 8 Jun 2023 15:54:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSq-0004TN-Sc; Thu, 08 Jun 2023 18:50:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSj-00044c-Q3 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSi-0005BJ-9B for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:37 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-120-h-coOTfnMEqIpuJUwMllUA-1; Thu, 08 Jun 2023 18:50:33 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C8FC21C04323; Thu, 8 Jun 2023 22:50:32 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48FFB492B00; Thu, 8 Jun 2023 22:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264635; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5NnC2eyi3Mg46yBkV7SLty0rJCTkfvS3oUX796cjykY=; b=K3hWzPWo82NsWhceZbGpkIKekqx5uZAN5CQ/YjdBRIuwSoTyPfdtiEiHcO6n2AjA/8H/p0 5YlDSQEJ7j4Jal9hwkQMCmvR+sShPxixYf76etTGUt3htO180zP7FPh0r9d1dJy4PldUIB idEt+oWk65xUjrjj73CCIM9bBELJP+s= X-MC-Unique: h-coOTfnMEqIpuJUwMllUA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 24/42] migration-test: Re-enable multifd_cancel test Date: Fri, 9 Jun 2023 00:49:25 +0200 Message-Id: <20230608224943.3877-25-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264872751100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 01ab51a391..9f86d9bc80 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2886,14 +2886,8 @@ int main(int argc, char **argv) } qtest_add_func("/migration/multifd/tcp/plain/none", test_multifd_tcp_none); - /* - * This test is flaky and sometimes fails in CI and otherwise: - * don't run unless user opts in via environment variable. - */ - if (getenv("QEMU_TEST_FLAKY_TESTS")) { - qtest_add_func("/migration/multifd/tcp/plain/cancel", - test_multifd_tcp_cancel); - } + qtest_add_func("/migration/multifd/tcp/plain/cancel", + test_multifd_tcp_cancel); qtest_add_func("/migration/multifd/tcp/plain/zlib", test_multifd_tcp_zlib); #ifdef CONFIG_ZSTD --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264816; cv=none; d=zohomail.com; s=zohoarc; b=WHwhb+m8jnBKc9xUNcLgDDJIRKCCoXtTX5Z32w9Wcp8iUrhrDdqHX+pLswDKMsgiHo7qTwkeron4ej6JJ5++w0gszQBJkSywNWmWJCP9/NuMgm6pIk/yQbPnziaWg7YJRzbBE6KpeNH85IKAEKCGj7BS+timZJEd6eiIuNQ7tco= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264816; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nfBhppkhD4fH6+/oI8mPvb6no4o/B+3XboDgF/qI+zg=; b=n2oNq3VboiUIUxyXcZM87qUJcys6ZEjpGiKOgEFFTslxjb2vqH3e7X3v3sWMsXlLjF98DCCRIMspYXVBGvLo1v0H94ghXAvYXfbvI3SYtmzIJcyGU0jhumd+Eyq537Bsmqq9uXMtnT1oG8BrMgYj1nGLRHYxnHp16Z+56p+NPMI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264816229260.23816767309086; Thu, 8 Jun 2023 15:53:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSs-0004Y4-K7; Thu, 08 Jun 2023 18:50:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSk-00049P-RN for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSi-0005Bv-VS for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:38 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-378-v3xpIurUOlOWj1hOYsxGSQ-1; Thu, 08 Jun 2023 18:50:34 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9CA751C0513A; Thu, 8 Jun 2023 22:50:34 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B122492B00; Thu, 8 Jun 2023 22:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nfBhppkhD4fH6+/oI8mPvb6no4o/B+3XboDgF/qI+zg=; b=ANgMfaKEENSOn/kNp8A+inzNiRFbk9tofTwr43bafj0GSHVDgtr4tw7o2weNNtGwuB5GN+ HsDMa8VBg+fC9tWizi9mJ2cqNJglnQtLtQmd8SRx6gQHgoTPFh2+laSmsnwFLoPHEu367Z ZWe5UGBvlxbyS5N4wtkmQ6ELBJDSdm8= X-MC-Unique: v3xpIurUOlOWj1hOYsxGSQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 25/42] migration-test: We were not waiting for "target" to finish Date: Fri, 9 Jun 2023 00:49:26 +0200 Message-Id: <20230608224943.3877-26-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264817536100001 Content-Type: text/plain; charset="utf-8" This could create the problem that we start the "second" target before the first one has removed the serial socket. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 9f86d9bc80..933000ad81 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2432,6 +2432,8 @@ static void test_multifd_tcp_cancel(void) qtest_set_expected_status(to->qs, EXIT_FAILURE); qtest_wait_qemu(to->qs); =20 + guest_destroy(to); + args =3D (MigrateStart){ .only_target =3D true, }; --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686265102; cv=none; d=zohomail.com; s=zohoarc; b=GsGGk8v229nRBJqex+r8mDIkv11vt2l9ElRjFgZBXwP7iKuHrS6mbLboc7ADWReSk7Pyf1KrHXtbHxrgRt9rD+H/6awIgJjpka4bZHm0HcMoNbn+KD2gQGfLd2dKiKJ/JD0FmoaHUeIGHq1o3jhm+0rDeQId6eTMic/lDeJQ5BE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265102; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=IpPspcELb1hx/8sTehXX9SuQS6bZnSSsN5qQL51kSA4=; b=F91qhZSm7AGnfkT+FyrqXtTvvkGBw3C7H3IAYZjhCbBJ6Vz7Yy+mAj1JxEOg3687CmX/ddHev9UBkznvbQ5RhD2No0nlPnWjsxOHBRom26AY+ct2gFO97LQUNrDWSesXeSDQ7//u5BurSINd0psFcrOeVKFdwiGPQAJwxvrpx0s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168626510283676.63887146516811; Thu, 8 Jun 2023 15:58:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSt-0004aj-1O; Thu, 08 Jun 2023 18:50:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSq-0004RD-FZ for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSm-0005Dg-A3 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:43 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-smAMUlBUMMOx8vpcP59Sdg-1; Thu, 08 Jun 2023 18:50:37 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9258B280BC58; Thu, 8 Jun 2023 22:50:36 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3134492B00; Thu, 8 Jun 2023 22:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IpPspcELb1hx/8sTehXX9SuQS6bZnSSsN5qQL51kSA4=; b=EENOMXoKvG5q46Kt/FCz0CCDk/qWQjmBaVBwov7L8aoFujWmYve7y/4xQO0qeI8HFgeptn xNoIOf5gKSiG+whyOlek05SdaMkM7tbvUB6H4n5sDMMNFp4q/RKoobdieiZslQli5q4Vi8 /wfLrh6qNPAgy/B/P9iLmVe+0kkvgbU= X-MC-Unique: smAMUlBUMMOx8vpcP59Sdg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 26/42] migration-test: create guest_use_shmem() Date: Fri, 9 Jun 2023 00:49:27 +0200 Message-Id: <20230608224943.3877-27-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265103741100001 Content-Type: text/plain; charset="utf-8" So now this is the same that everything else. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 46 +++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 933000ad81..0130a00707 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -164,6 +164,8 @@ typedef struct { */ const gchar *name; gchar *serial_path; + gchar *shmem_opts; + gchar *shmem_path; unsigned start_address; unsigned end_address; } GuestState; @@ -217,6 +219,9 @@ static void guest_destroy(GuestState *vm) g_free(vm->kvm_opts); unlink(vm->serial_path); g_free(vm->serial_path); + g_free(vm->shmem_opts); + unlink(vm->shmem_path); + g_free(vm->shmem_path); g_free(vm); } =20 @@ -226,6 +231,18 @@ static void guest_use_dirty_ring(GuestState *vm) vm->kvm_opts =3D g_strdup(",dirty-ring-size=3D4096"); } =20 +static void guest_use_shmem(GuestState *vm) +{ + g_assert(vm->shmem_opts =3D=3D NULL); + g_assert(vm->shmem_path =3D=3D NULL); + + vm->shmem_path =3D g_strdup_printf("/dev/shm/qemu-%d", getpid()); + vm->shmem_opts =3D g_strdup_printf( + "-object memory-backend-file,id=3Dmem0,size=3D%s" + ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", + vm->memory_size, vm->shmem_path); +} + /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -621,7 +638,6 @@ typedef struct { * unconditionally, because it means the user would like to be verbose. */ bool hide_stderr; - bool use_shmem; /* only launch the target process */ bool only_target; const char *opts_source; @@ -720,8 +736,6 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; const gchar *ignore_stderr =3D NULL; - g_autofree char *shmem_opts =3D NULL; - g_autofree char *shmem_path =3D NULL; =20 got_src_stop =3D false; got_dst_resume =3D false; @@ -738,14 +752,6 @@ static void test_migrate_start(GuestState *from, Guest= State *to, #endif } =20 - if (args->use_shmem) { - shmem_path =3D g_strdup_printf("/dev/shm/qemu-%d", getpid()); - shmem_opts =3D g_strdup_printf( - "-object memory-backend-file,id=3Dmem0,size=3D%s" - ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", - from->memory_size, shmem_path); - } - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name %s,debug-threads=3Don " "-m %s " @@ -757,7 +763,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, from->serial_path, from->arch_opts ? from->arch_opts : "", from->arch_source ? from->arch_source : "= ", - shmem_opts ? shmem_opts : "", + from->shmem_opts ? from->shmem_opts : "", args->opts_source ? args->opts_source : "= ", ignore_stderr ? ignore_stderr : ""); =20 @@ -781,21 +787,13 @@ static void test_migrate_start(GuestState *from, Gues= tState *to, uri, to->arch_opts ? to->arch_opts : "", to->arch_target ? to->arch_target : "", - shmem_opts ? shmem_opts : "", + to->shmem_opts ? to->shmem_opts : "", args->opts_target ? args->opts_target : "= ", ignore_stderr ? ignore_stderr : ""); to->qs =3D qtest_init(cmd_target); qtest_qmp_set_event_callback(to->qs, migrate_watch_for_resume, &got_dst_resume); - - /* - * Remove shmem file immediately to avoid memory leak in test failed c= ase. - * It's valid becase QEMU has already opened this file - */ - if (args->use_shmem) { - unlink(shmem_path); - } } =20 static void test_migrate_end(GuestState *from, GuestState *to, bool test_d= est) @@ -1637,10 +1635,10 @@ static void test_ignore_shared(void) g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { - .use_shmem =3D true - }; + MigrateStart args =3D { }; =20 + guest_use_shmem(from); + guest_use_shmem(to); test_migrate_start(from, to, uri, &args); =20 migrate_set_capability(from->qs, "x-ignore-shared", true); --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686265029; cv=none; d=zohomail.com; s=zohoarc; b=aCk29O/Ik+WcXRdtPJAWyoyCLpLXj81L1cL31fnlrNQ0fuOutzC67+sKMx/eiF3nq+ufiLZ+6HdA0DDobHuo75sXXUu/IPNuOilSnOZoFz8JCNZfs25dASNqZkZvB+FgB4n68f6N5PDFgQiwYroga3txsT8dvYMwomnMSciLSSs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265028; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YbFyLack4wDnUym7oF0k7wqkTIuMqatFAHhadVBxf8g=; b=NSiEg74fea0UklKgAuq9wDplZ9GJrSaa6b5fR683Lhqkl/nToyJFhpJlgPXn5Rn3RlYpijC2dP2iX3hkBTGDbUtTvhMT9sQzIS0IOkv+ig4iyo3bslkn9WPRI+AyopzMvpo3gO+oAt9N5BBo0wCVunuZGoKMVcAI4iF26Nfblno= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686265028991253.28948947737103; Thu, 8 Jun 2023 15:57:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSt-0004bo-5H; Thu, 08 Jun 2023 18:50:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSq-0004RH-Hb for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSm-0005EQ-UA for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:43 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-623-khLabbbFNBq2PCstQX6PYg-1; Thu, 08 Jun 2023 18:50:38 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6873C1C0513A; Thu, 8 Jun 2023 22:50:38 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA9CE48205E; Thu, 8 Jun 2023 22:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YbFyLack4wDnUym7oF0k7wqkTIuMqatFAHhadVBxf8g=; b=NoFtPhN12FuGcVGdYT8bS8+7wvaKsjoqYPjs+U/l22bcc81wsd4mjbdcOPNrSBubaOZPPK LH80oWzzjHB84eJ7jhuvwTT5ZZg9RynV9W0ZkWhDAkDQDC73s1q9R8nbX23xT0WPEKRyp5 m0miXdfFb5nKOL6HdpKSjh4EHErjkLM= X-MC-Unique: khLabbbFNBq2PCstQX6PYg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 27/42] migration-test: Create guest_extra_opts() Date: Fri, 9 Jun 2023 00:49:28 +0200 Message-Id: <20230608224943.3877-28-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265029588100023 Content-Type: text/plain; charset="utf-8" If a guest has extra command line options, add it with this. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 0130a00707..b9b11ebb0f 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -156,6 +156,7 @@ typedef struct { gchar *arch_opts; gchar *arch_source; gchar *arch_target; + const gchar *extra_opts; gchar *kvm_opts; const gchar *memory_size; /* @@ -243,6 +244,12 @@ static void guest_use_shmem(GuestState *vm) vm->memory_size, vm->shmem_path); } =20 +static void guest_extra_opts(GuestState *vm, const gchar *opts) +{ + g_assert(vm->extra_opts =3D=3D NULL); + vm->extra_opts =3D opts; +} + /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -640,8 +647,6 @@ typedef struct { bool hide_stderr; /* only launch the target process */ bool only_target; - const char *opts_source; - const char *opts_target; } MigrateStart; =20 /* @@ -764,7 +769,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, from->arch_opts ? from->arch_opts : "", from->arch_source ? from->arch_source : "= ", from->shmem_opts ? from->shmem_opts : "", - args->opts_source ? args->opts_source : "= ", + from->extra_opts ? from->extra_opts : "", ignore_stderr ? ignore_stderr : ""); =20 if (!args->only_target) { @@ -788,7 +793,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, to->arch_opts ? to->arch_opts : "", to->arch_target ? to->arch_target : "", to->shmem_opts ? to->shmem_opts : "", - args->opts_target ? args->opts_target : "= ", + to->extra_opts ? to->extra_opts : "", ignore_stderr ? ignore_stderr : ""); to->qs =3D qtest_init(cmd_target); qtest_qmp_set_event_callback(to->qs, @@ -1996,11 +2001,10 @@ static void test_validate_uuid(void) { GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", - .opts_target =3D "-uuid 11111111-1111-1111-1111-111111111111", - }; + MigrateStart args =3D { }; =20 + guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111"); + guest_extra_opts(to, "-uuid 11111111-1111-1111-1111-111111111111"); do_test_validate_uuid(from, to, &args, false); } =20 @@ -2009,11 +2013,11 @@ static void test_validate_uuid_error(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", - .opts_target =3D "-uuid 22222222-2222-2222-2222-222222222222", .hide_stderr =3D true, }; =20 + guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111"); + guest_extra_opts(to, "-uuid 22222222-2222-2222-2222-222222222222"); do_test_validate_uuid(from, to, &args, true); } =20 @@ -2022,10 +2026,10 @@ static void test_validate_uuid_src_not_set(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateStart args =3D { - .opts_target =3D "-uuid 22222222-2222-2222-2222-222222222222", .hide_stderr =3D true, }; =20 + guest_extra_opts(to, "-uuid 22222222-2222-2222-2222-222222222222"); do_test_validate_uuid(from, to, &args, false); } =20 @@ -2034,10 +2038,10 @@ static void test_validate_uuid_dst_not_set(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateStart args =3D { - .opts_source =3D "-uuid 11111111-1111-1111-1111-111111111111", .hide_stderr =3D true, }; =20 + guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111"); do_test_validate_uuid(from, to, &args, false); } =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686265024; cv=none; d=zohomail.com; s=zohoarc; b=b39vTTQuxYZpJrnWn+iYI3iHPamK72TZljulYBzJD1hJc3p/+O7qjAmclz/yyE1ByGmmwWdnPNsiRiENMQKkHPYifTXeVWVAx4zwL7GzFIkt+oO2F3UJj32pRRY/hfgpccmOI2AhD+fCZyxiCtYKPmZvBEBcTQfpH0ZGLUYz4ZU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265024; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XqlkLQmG60AE7FrdA+ymuLG4WbW2mGDFDGR5H0KViKE=; b=FxCBSOGpEx320Nr0FuNKri/Du1a2A52G3NsXRKJKjIot69/fuXcaHlvhBxNpODXcCP5FOkQTX+yvDiQNPjB+6WTdcqUw0lpQtH5JGPbAWvHQa2j5CtE0fANJSntyMcNN/eS1aLiUASvoX6VMyv6ByOSKCup5BKuQAVytc68VfaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686265024942743.5803377549918; Thu, 8 Jun 2023 15:57:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSv-0004jw-Hu; Thu, 08 Jun 2023 18:50:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSs-0004Zp-Ra for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSq-0005Hs-ME for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:46 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-500-hzM9HUqdNNC6sHjwexdOSQ-1; Thu, 08 Jun 2023 18:50:40 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5F54C3855571; Thu, 8 Jun 2023 22:50:40 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id B10FE492B00; Thu, 8 Jun 2023 22:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XqlkLQmG60AE7FrdA+ymuLG4WbW2mGDFDGR5H0KViKE=; b=ZvKdsKpGbjp6xC6K75JD4Pzf4kJ9DtSY9tDP7sN2eTRPSRGb9Y1jnJVkCv8WRhUror2pe6 7lkjtFH7odicSqfVT5/JoOFj+p/N1nYAkBm9O4lxgvVZvoI7c3I6heQM0IchHsXxf2/M7w mkMFV+WnkO+wMDZPZIWVPt4annlo+nM= X-MC-Unique: hzM9HUqdNNC6sHjwexdOSQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 28/42] migration-test: Create guest_hide_stderr() Date: Fri, 9 Jun 2023 00:49:29 +0200 Message-Id: <20230608224943.3877-29-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265026700100001 Content-Type: text/plain; charset="utf-8" So we can handle in a single place all the error output handling. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 115 ++++++++++++++++------------------- 1 file changed, 54 insertions(+), 61 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b9b11ebb0f..c70b08e7db 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -157,6 +157,7 @@ typedef struct { gchar *arch_source; gchar *arch_target; const gchar *extra_opts; + const gchar *hide_stderr; gchar *kvm_opts; const gchar *memory_size; /* @@ -244,6 +245,23 @@ static void guest_use_shmem(GuestState *vm) vm->memory_size, vm->shmem_path); } =20 +static void guest_hide_stderr(GuestState *vm) +{ + g_assert(vm->hide_stderr =3D=3D NULL); + + if (!getenv("QTEST_LOG")) { +#ifndef _WIN32 + vm->hide_stderr =3D "2>/dev/null"; +#else + /* + * On Windows the QEMU executable is created via CreateProcess() a= nd + * IO redirection does not work, so don't bother adding IO redirec= tion + * to the command line. + */ +#endif + } +} + static void guest_extra_opts(GuestState *vm, const gchar *opts) { g_assert(vm->extra_opts =3D=3D NULL); @@ -640,11 +658,6 @@ static void do_migrate(GuestState *from, GuestState *t= o, const gchar *uri) } =20 typedef struct { - /* - * QTEST_LOG=3D1 may override this. When QTEST_LOG=3D1, we always dum= p errors - * unconditionally, because it means the user would like to be verbose. - */ - bool hide_stderr; /* only launch the target process */ bool only_target; } MigrateStart; @@ -740,23 +753,10 @@ static void test_migrate_start(GuestState *from, Gues= tState *to, { g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; - const gchar *ignore_stderr =3D NULL; =20 got_src_stop =3D false; got_dst_resume =3D false; =20 - if (!getenv("QTEST_LOG") && args->hide_stderr) { -#ifndef _WIN32 - ignore_stderr =3D "2>/dev/null"; -#else - /* - * On Windows the QEMU executable is created via CreateProcess() a= nd - * IO redirection does not work, so don't bother adding IO redirec= tion - * to the command line. - */ -#endif - } - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name %s,debug-threads=3Don " "-m %s " @@ -770,7 +770,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, from->arch_source ? from->arch_source : "= ", from->shmem_opts ? from->shmem_opts : "", from->extra_opts ? from->extra_opts : "", - ignore_stderr ? ignore_stderr : ""); + from->hide_stderr ? from->hide_stderr : "= "); =20 if (!args->only_target) { from->qs =3D qtest_init(cmd_source); @@ -794,7 +794,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, to->arch_target ? to->arch_target : "", to->shmem_opts ? to->shmem_opts : "", to->extra_opts ? to->extra_opts : "", - ignore_stderr ? ignore_stderr : ""); + to->hide_stderr ? to->hide_stderr : ""); to->qs =3D qtest_init(cmd_target); qtest_qmp_set_event_callback(to->qs, migrate_watch_for_resume, @@ -1323,8 +1323,8 @@ static void test_postcopy_recovery_common(MigrateComm= on *args) g_autofree char *uri =3D NULL; =20 /* Always hide errors for postcopy recover tests since they're expecte= d */ - args->start.hide_stderr =3D true; - + guest_hide_stderr(from); + guest_hide_stderr(to); migrate_postcopy_prepare(from, to, args); =20 /* Turn postcopy speed down, 4K/s is slow enough on any machines */ @@ -1431,12 +1431,12 @@ static void test_postcopy_preempt_all(void) =20 static void test_baddest(void) { - MigrateStart args =3D { - .hide_stderr =3D true - }; + MigrateStart args =3D { }; GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); =20 + guest_hide_stderr(from); + guest_hide_stderr(to); test_migrate_start(from, to, "tcp:127.0.0.1:0", &args); /* * Don't change to do_migrate(). We are using a wrong uri on purpose. @@ -1605,9 +1605,6 @@ static void test_precopy_unix_tls_x509_default_host(v= oid) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, .connect_uri =3D uri, .listen_uri =3D uri, .start_hook =3D test_migrate_tls_x509_start_default_host, @@ -1615,6 +1612,8 @@ static void test_precopy_unix_tls_x509_default_host(v= oid) .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, }; =20 + guest_hide_stderr(from); + guest_hide_stderr(to); test_precopy_common(from, to, &args); } =20 @@ -1780,15 +1779,14 @@ static void test_precopy_tcp_tls_psk_mismatch(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_psk_start_mismatch, .finish_hook =3D test_migrate_tls_psk_finish, .result =3D MIG_TEST_FAIL, }; =20 + guest_hide_stderr(from); + guest_hide_stderr(to); test_precopy_common(from, to, &args); } =20 @@ -1824,15 +1822,14 @@ static void test_precopy_tcp_tls_x509_mismatch_host= (void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_mismatch_host, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, }; =20 + guest_hide_stderr(from); + guest_hide_stderr(to); test_precopy_common(from, to, &args); } =20 @@ -1854,15 +1851,14 @@ static void test_precopy_tcp_tls_x509_hostile_clien= t(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_hostile_client, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL, }; =20 + guest_hide_stderr(from); + guest_hide_stderr(to); test_precopy_common(from, to, &args); } =20 @@ -1884,15 +1880,14 @@ static void test_precopy_tcp_tls_x509_reject_anon_c= lient(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_reject_anon_client, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL, }; =20 + guest_hide_stderr(from); + guest_hide_stderr(to); test_precopy_common(from, to, &args); } #endif /* CONFIG_TASN1 */ @@ -2012,10 +2007,10 @@ static void test_validate_uuid_error(void) { GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { - .hide_stderr =3D true, - }; + MigrateStart args =3D { }; =20 + guest_hide_stderr(from); + guest_hide_stderr(to); guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111"); guest_extra_opts(to, "-uuid 22222222-2222-2222-2222-222222222222"); do_test_validate_uuid(from, to, &args, true); @@ -2025,10 +2020,10 @@ static void test_validate_uuid_src_not_set(void) { GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { - .hide_stderr =3D true, - }; + MigrateStart args =3D { }; =20 + guest_hide_stderr(from); + guest_hide_stderr(to); guest_extra_opts(to, "-uuid 22222222-2222-2222-2222-222222222222"); do_test_validate_uuid(from, to, &args, false); } @@ -2037,10 +2032,10 @@ static void test_validate_uuid_dst_not_set(void) { GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { - .hide_stderr =3D true, - }; + MigrateStart args =3D { }; =20 + guest_hide_stderr(from); + guest_hide_stderr(to); guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111"); do_test_validate_uuid(from, to, &args, false); } @@ -2292,14 +2287,13 @@ static void test_multifd_tcp_tls_psk_mismatch(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tcp_tls_psk_start_mismatch, .finish_hook =3D test_migrate_tls_psk_finish, .result =3D MIG_TEST_FAIL, }; + guest_hide_stderr(from); + guest_hide_stderr(to); test_precopy_common(from, to, &args); } =20 @@ -2346,14 +2340,13 @@ static void test_multifd_tcp_tls_x509_mismatch_host= (void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tls_x509_start_mismatch_host, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL, }; + guest_hide_stderr(from); + guest_hide_stderr(to); test_precopy_common(from, to, &args); } =20 @@ -2374,14 +2367,13 @@ static void test_multifd_tcp_tls_x509_reject_anon_c= lient(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .start =3D { - .hide_stderr =3D true, - }, .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tls_x509_start_reject_anon_cl= ient, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL, }; + guest_hide_stderr(from); + guest_hide_stderr(to); test_precopy_common(from, to, &args); } #endif /* CONFIG_TASN1 */ @@ -2400,13 +2392,14 @@ static void test_multifd_tcp_tls_x509_reject_anon_c= lient(void) */ static void test_multifd_tcp_cancel(void) { - MigrateStart args =3D { - .hide_stderr =3D true, - }; + MigrateStart args =3D { }; GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); GuestState *to2 =3D guest_create("target2"); =20 + guest_hide_stderr(from); + guest_hide_stderr(to); + test_migrate_start(from, to, "defer", &args); =20 migrate_ensure_non_converge(from->qs); --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264952; cv=none; d=zohomail.com; s=zohoarc; b=Dy2WCbKEqcH750PQl8yfmFRQLHI/IrynQxg855aSfcuahgihrTHYSmsAphimfKHwSBQV9yHxPFwXrb/RYvAilAPMFIhgXQnTGkzJUv+tEUignkBrEGlPLsNbnkrQgt6azr2ALPfA7UjdOSspmWtq9+ZAvRusJyHWHPq0GxOgR0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264952; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9B5T8CASrZdmFWPRYfWRj9lntP6nFGjSGp/jvVEMfcA=; b=LhZlE7+I8Xrb4ra8L3bjiXZQ7mRALlITpOlOYBT46eKr4EKIbEWDZDLURinV4RnXRUdhtbcLmOsc1+l4QPjOxIW+DAhvlSCS/pKuFP3KdwkY+LGVL7SIWaafIWJTRi6ZiT3/ZcoSwvIn06z+4V/hWcpoCUdRG9+hTtYG9ArhJ+k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168626495255350.99001873501845; Thu, 8 Jun 2023 15:55:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSv-0004k0-Hg; Thu, 08 Jun 2023 18:50:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSs-0004Y6-Af for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSq-0005Hq-Fv for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:46 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-q-Ro9yRBP-aWltfBqdiFqA-1; Thu, 08 Jun 2023 18:50:42 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5350C801182; Thu, 8 Jun 2023 22:50:42 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id A77CA492B00; Thu, 8 Jun 2023 22:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9B5T8CASrZdmFWPRYfWRj9lntP6nFGjSGp/jvVEMfcA=; b=QOCFRWdQkOpGOMHE+V2XvchrZXq6CXfRIOhHNRpiRoDNG6ZHUHQ9nmwu1S73Fiy0/hixCk Uv1zPc/VwCRpJHu+6Wy2ich4/J86HkCinhg2KEeB8fOmzdruy5wHeFFroSiY3kb9rNctnd SN9W/6+1ib2Rckp+yMuQTHNA9CQmUhQ= X-MC-Unique: q-Ro9yRBP-aWltfBqdiFqA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 29/42] migration-test: Create the migration unix socket by guest Date: Fri, 9 Jun 2023 00:49:30 +0200 Message-Id: <20230608224943.3877-30-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264954415100009 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 50 +++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index c70b08e7db..a0ed8eb05a 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -168,6 +168,8 @@ typedef struct { gchar *serial_path; gchar *shmem_opts; gchar *shmem_path; + gchar *unix_socket; + gchar *uri; unsigned start_address; unsigned end_address; } GuestState; @@ -224,6 +226,11 @@ static void guest_destroy(GuestState *vm) g_free(vm->shmem_opts); unlink(vm->shmem_path); g_free(vm->shmem_path); + if (vm->unix_socket) { + unlink(vm->unix_socket); + g_free(vm->unix_socket); + } + g_free(vm->uri); g_free(vm); } =20 @@ -268,6 +275,17 @@ static void guest_extra_opts(GuestState *vm, const gch= ar *opts) vm->extra_opts =3D opts; } =20 +static void guest_listen_unix_socket(GuestState *vm) +{ + if (vm->unix_socket) { + unlink(vm->unix_socket); + g_free(vm->unix_socket); + } + g_free(vm->uri); + vm->unix_socket =3D g_strdup_printf("%s/migsocket", tmpfs); + vm->uri =3D g_strdup_printf("unix:%s", vm->unix_socket); +} + /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -789,7 +807,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, to->name, to->memory_size, to->serial_path, - uri, + to->uri ? to->uri : uri, to->arch_opts ? to->arch_opts : "", to->arch_target ? to->arch_target : "", to->shmem_opts ? to->shmem_opts : "", @@ -1202,9 +1220,8 @@ static void migrate_postcopy_prepare(GuestState *from, GuestState *to, MigrateCommon *args) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - - test_migrate_start(from, to, uri, &args->start); + guest_listen_unix_socket(to); + test_migrate_start(from, to, NULL, &args->start); =20 if (args->start_hook) { args->postcopy_data =3D args->start_hook(from->qs, to->qs); @@ -1224,7 +1241,7 @@ static void migrate_postcopy_prepare(GuestState *from, /* Wait for the first serial output from the source */ wait_for_serial(from); =20 - do_migrate(from, to, uri); + do_migrate(from, to, to->uri); =20 wait_for_migration_pass(from->qs); } @@ -1320,8 +1337,6 @@ static void test_postcopy_recovery_common(MigrateComm= on *args) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); =20 - g_autofree char *uri =3D NULL; - /* Always hide errors for postcopy recover tests since they're expecte= d */ guest_hide_stderr(from); guest_hide_stderr(to); @@ -1359,8 +1374,8 @@ static void test_postcopy_recovery_common(MigrateComm= on *args) * from the broken migration channel; tell the destination to * listen to the new port */ - uri =3D g_strdup_printf("unix:%s/migsocket-recover", tmpfs); - migrate_recover(to->qs, uri); + guest_listen_unix_socket(to); + migrate_recover(to->qs, to->uri); =20 /* * Try to rebuild the migration channel using the resume flag and @@ -1369,7 +1384,7 @@ static void test_postcopy_recovery_common(MigrateComm= on *args) wait_for_migration_status(from->qs, "postcopy-paused", (const char * []) { "failed", "active", "completed", NULL }); - migrate_qmp(from->qs, uri, "{'resume': true}"); + migrate_qmp(from->qs, to->uri, "{'resume': true}"); =20 /* Restore the postcopy bandwidth to unlimited */ migrate_set_parameter_int(from->qs, "max-postcopy-bandwidth", 0); @@ -1651,7 +1666,7 @@ static void test_ignore_shared(void) /* Wait for the first serial output from the source */ wait_for_serial(from); =20 - do_migrate(from, to, uri); + do_migrate(from, to, to->uri); =20 wait_for_migration_pass(from->qs); =20 @@ -1965,9 +1980,8 @@ static void test_migrate_fd_proto(void) static void do_test_validate_uuid(GuestState *from, GuestState *to, MigrateStart *args, bool should_fail) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); - - test_migrate_start(from, to, uri, args); + guest_listen_unix_socket(to); + test_migrate_start(from, to, NULL, args); =20 /* * UUID validation is at the begin of migration. So, the main process = of @@ -1980,7 +1994,7 @@ static void do_test_validate_uuid(GuestState *from, G= uestState *to, /* Wait for the first serial output from the source */ wait_for_serial(from); =20 - do_migrate(from, to, uri); + do_migrate(from, to, to->uri); =20 if (should_fail) { qtest_set_expected_status(to->qs, EXIT_FAILURE); @@ -2057,7 +2071,6 @@ static void test_validate_uuid_dst_not_set(void) */ static void test_migrate_auto_converge(void) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); MigrateStart args =3D {}; GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); @@ -2070,7 +2083,8 @@ static void test_migrate_auto_converge(void) */ const int64_t init_pct =3D 5, inc_pct =3D 25, max_pct =3D 95; =20 - test_migrate_start(from, to, uri, &args); + guest_listen_unix_socket(to); + test_migrate_start(from, to, to->uri, &args); =20 migrate_set_capability(from->qs, "auto-converge", true); migrate_set_parameter_int(from->qs, "cpu-throttle-initial", init_pct); @@ -2089,7 +2103,7 @@ static void test_migrate_auto_converge(void) /* Wait for the first serial output from the source */ wait_for_serial(from); =20 - do_migrate(from, to, uri); + do_migrate(from, to, to->uri); =20 /* Wait for throttling begins */ percentage =3D 0; --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264733; cv=none; d=zohomail.com; s=zohoarc; b=R/BVxvaLsQ7a4ROy/5TOtUTvRl+sB+7GEIKZri2iDO5391iiGr/f/XtolOBo+7g8xOGIWNg4c0IRQk06gmeuKbvwhr6gYdy/hTSpcHL8tDXGfAAGwrIUXd/JynhMgmbT/wBRZWJDa/yTTqKPc+IK87a+KO/CGcPFHCWvuPSj550= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264733; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/PwsaOYTlnXmqOenIJcSOycZ+5tMERiC1FuCEF58WIg=; b=mPW4HN825/TxWwLWOk4vs3CzgF1rcpLx+BeizmBQ4eNSXelIs9+BpC8iAbvhcHI+WgbgkUOhNF+8OAxYzEEv32v7dA+HHolyr5ea3Rte8QoDTooQJmy+UBObIf2KgriznKC9xjfInlp+2ISbyeMHLRZpxaTC4AnwfS3nhAJCTws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264733240552.0111483447504; Thu, 8 Jun 2023 15:52:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OT3-0004ws-Jg; Thu, 08 Jun 2023 18:50:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSw-0004oB-3g for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSt-0005Io-IX for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:49 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-222-bk17veaLPo2wGRMTT8LGxA-1; Thu, 08 Jun 2023 18:50:44 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4AFEB85A5A8; Thu, 8 Jun 2023 22:50:44 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D077492B00; Thu, 8 Jun 2023 22:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/PwsaOYTlnXmqOenIJcSOycZ+5tMERiC1FuCEF58WIg=; b=OXjm0l5HW96bM6PDhTjX5o878OS1knFpyTuMmUUQqanGabgW33FM9b01bvF0qwAD7JnKeF WGyvvJY3xPO7gCOdWcXf/GuN4ISXZrxtzI2x13law6XTa7PEkVnBl95xXTZ5h3iTm4vCmE JgaybHX35NeUyKUn0r17tuq6yOJk7xo= X-MC-Unique: bk17veaLPo2wGRMTT8LGxA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 30/42] migration-test: Hooks also need GuestState Date: Fri, 9 Jun 2023 00:49:31 +0200 Message-Id: <20230608224943.3877-31-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264734102100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 198 +++++++++++++++-------------------- 1 file changed, 86 insertions(+), 112 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index a0ed8eb05a..6438379dcf 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -653,15 +653,16 @@ static void migrate_set_capability(QTestState *who, c= onst char *capability, capability, value); } =20 -static void migrate_postcopy_start(QTestState *from, QTestState *to) +static void migrate_postcopy_start(GuestState *from, GuestState *to) { - qtest_qmp_assert_success(from, "{ 'execute': 'migrate-start-postcopy' = }"); + qtest_qmp_assert_success(from->qs, + "{ 'execute': 'migrate-start-postcopy' }"); =20 if (!got_src_stop) { - qtest_qmp_eventwait(from, "STOP"); + qtest_qmp_eventwait(from->qs, "STOP"); } =20 - qtest_qmp_eventwait(to, "RESUME"); + qtest_qmp_eventwait(to->qs, "RESUME"); } =20 static void do_migrate(GuestState *from, GuestState *to, const gchar *uri) @@ -688,8 +689,7 @@ typedef struct { * Returns: NULL, or a pointer to opaque state to be * later passed to the TestMigrateFinishHook */ -typedef void * (*TestMigrateStartHook)(QTestState *from, - QTestState *to); +typedef void * (*TestMigrateStartHook)(GuestState *from, GuestState *to); =20 /* * A hook that runs after the migration has finished, @@ -700,8 +700,7 @@ typedef void * (*TestMigrateStartHook)(QTestState *from, * @opaque is a pointer to state previously returned * by the TestMigrateStartHook if any, or NULL. */ -typedef void (*TestMigrateFinishHook)(QTestState *from, - QTestState *to, +typedef void (*TestMigrateFinishHook)(GuestState *from, GuestState *to, void *opaque); =20 typedef struct { @@ -859,8 +858,7 @@ struct TestMigrateTLSPSKData { }; =20 static void * -test_migrate_tls_psk_start_common(QTestState *from, - QTestState *to, +test_migrate_tls_psk_start_common(GuestState *from, GuestState *to, bool mismatch) { struct TestMigrateTLSPSKData *data =3D @@ -880,7 +878,7 @@ test_migrate_tls_psk_start_common(QTestState *from, test_tls_psk_init_alt(data->pskfilealt); } =20 - qtest_qmp_assert_success(from, + qtest_qmp_assert_success(from->qs, "{ 'execute': 'object-add'," " 'arguments': { 'qom-type': 'tls-creds-psk'= ," " 'id': 'tlscredspsk0'," @@ -889,7 +887,7 @@ test_migrate_tls_psk_start_common(QTestState *from, " 'username': 'qemu'} }", data->workdir); =20 - qtest_qmp_assert_success(to, + qtest_qmp_assert_success(to->qs, "{ 'execute': 'object-add'," " 'arguments': { 'qom-type': 'tls-creds-psk'= ," " 'id': 'tlscredspsk0'," @@ -897,30 +895,26 @@ test_migrate_tls_psk_start_common(QTestState *from, " 'dir': %s } }", mismatch ? data->workdiralt : data->workdir); =20 - migrate_set_parameter_str(from, "tls-creds", "tlscredspsk0"); - migrate_set_parameter_str(to, "tls-creds", "tlscredspsk0"); + migrate_set_parameter_str(from->qs, "tls-creds", "tlscredspsk0"); + migrate_set_parameter_str(to->qs, "tls-creds", "tlscredspsk0"); =20 return data; } =20 static void * -test_migrate_tls_psk_start_match(QTestState *from, - QTestState *to) +test_migrate_tls_psk_start_match(GuestState *from, GuestState *to) { return test_migrate_tls_psk_start_common(from, to, false); } =20 static void * -test_migrate_tls_psk_start_mismatch(QTestState *from, - QTestState *to) +test_migrate_tls_psk_start_mismatch(GuestState *from, GuestState *to) { return test_migrate_tls_psk_start_common(from, to, true); } =20 static void -test_migrate_tls_psk_finish(QTestState *from, - QTestState *to, - void *opaque) +test_migrate_tls_psk_finish(GuestState *from, GuestState *to, void *opaque) { struct TestMigrateTLSPSKData *data =3D opaque; =20 @@ -961,8 +955,7 @@ typedef struct { } TestMigrateTLSX509; =20 static void * -test_migrate_tls_x509_start_common(QTestState *from, - QTestState *to, +test_migrate_tls_x509_start_common(GuestState *from, GuestState *to, TestMigrateTLSX509 *args) { TestMigrateTLSX509Data *data =3D g_new0(TestMigrateTLSX509Data, 1); @@ -1008,7 +1001,7 @@ test_migrate_tls_x509_start_common(QTestState *from, args->certhostname, args->certipaddr); =20 - qtest_qmp_assert_success(from, + qtest_qmp_assert_success(from->qs, "{ 'execute': 'object-add'," " 'arguments': { 'qom-type': 'tls-creds-x509= '," " 'id': 'tlscredsx509client0'= ," @@ -1017,12 +1010,12 @@ test_migrate_tls_x509_start_common(QTestState *from, " 'sanity-check': true," " 'verify-peer': true} }", data->workdir); - migrate_set_parameter_str(from, "tls-creds", "tlscredsx509client0"); + migrate_set_parameter_str(from->qs, "tls-creds", "tlscredsx509client0"= ); if (args->certhostname) { - migrate_set_parameter_str(from, "tls-hostname", args->certhostname= ); + migrate_set_parameter_str(from->qs, "tls-hostname", args->certhost= name); } =20 - qtest_qmp_assert_success(to, + qtest_qmp_assert_success(to->qs, "{ 'execute': 'object-add'," " 'arguments': { 'qom-type': 'tls-creds-x509= '," " 'id': 'tlscredsx509server0'= ," @@ -1031,16 +1024,16 @@ test_migrate_tls_x509_start_common(QTestState *from, " 'sanity-check': true," " 'verify-peer': %i} }", data->workdir, args->verifyclient); - migrate_set_parameter_str(to, "tls-creds", "tlscredsx509server0"); + migrate_set_parameter_str(to->qs, "tls-creds", "tlscredsx509server0"); =20 if (args->authzclient) { - qtest_qmp_assert_success(to, + qtest_qmp_assert_success(to->qs, "{ 'execute': 'object-add'," " 'arguments': { 'qom-type': 'authz-simp= le'," " 'id': 'tlsauthz0'," " 'identity': %s} }", "CN=3D" QCRYPTO_TLS_TEST_CLIENT_NAME); - migrate_set_parameter_str(to, "tls-authz", "tlsauthz0"); + migrate_set_parameter_str(to->qs, "tls-authz", "tlsauthz0"); } =20 return data; @@ -1051,8 +1044,7 @@ test_migrate_tls_x509_start_common(QTestState *from, * whatever host we were telling QEMU to connect to (if any) */ static void * -test_migrate_tls_x509_start_default_host(QTestState *from, - QTestState *to) +test_migrate_tls_x509_start_default_host(GuestState *from, GuestState *to) { TestMigrateTLSX509 args =3D { .verifyclient =3D true, @@ -1068,8 +1060,7 @@ test_migrate_tls_x509_start_default_host(QTestState *= from, * so we must give QEMU an explicit hostname to validate */ static void * -test_migrate_tls_x509_start_override_host(QTestState *from, - QTestState *to) +test_migrate_tls_x509_start_override_host(GuestState *from, GuestState *to) { TestMigrateTLSX509 args =3D { .verifyclient =3D true, @@ -1085,8 +1076,7 @@ test_migrate_tls_x509_start_override_host(QTestState = *from, * expect the client to reject the server */ static void * -test_migrate_tls_x509_start_mismatch_host(QTestState *from, - QTestState *to) +test_migrate_tls_x509_start_mismatch_host(GuestState *from, GuestState *to) { TestMigrateTLSX509 args =3D { .verifyclient =3D true, @@ -1097,8 +1087,7 @@ test_migrate_tls_x509_start_mismatch_host(QTestState = *from, } =20 static void * -test_migrate_tls_x509_start_friendly_client(QTestState *from, - QTestState *to) +test_migrate_tls_x509_start_friendly_client(GuestState *from, GuestState *= to) { TestMigrateTLSX509 args =3D { .verifyclient =3D true, @@ -1110,8 +1099,7 @@ test_migrate_tls_x509_start_friendly_client(QTestStat= e *from, } =20 static void * -test_migrate_tls_x509_start_hostile_client(QTestState *from, - QTestState *to) +test_migrate_tls_x509_start_hostile_client(GuestState *from, GuestState *t= o) { TestMigrateTLSX509 args =3D { .verifyclient =3D true, @@ -1128,8 +1116,7 @@ test_migrate_tls_x509_start_hostile_client(QTestState= *from, * and no server verification */ static void * -test_migrate_tls_x509_start_allow_anon_client(QTestState *from, - QTestState *to) +test_migrate_tls_x509_start_allow_anon_client(GuestState *from, GuestState= *to) { TestMigrateTLSX509 args =3D { .certipaddr =3D "127.0.0.1", @@ -1142,8 +1129,7 @@ test_migrate_tls_x509_start_allow_anon_client(QTestSt= ate *from, * and server verification rejecting */ static void * -test_migrate_tls_x509_start_reject_anon_client(QTestState *from, - QTestState *to) +test_migrate_tls_x509_start_reject_anon_client(GuestState *from, GuestStat= e *to) { TestMigrateTLSX509 args =3D { .verifyclient =3D true, @@ -1153,9 +1139,7 @@ test_migrate_tls_x509_start_reject_anon_client(QTestS= tate *from, } =20 static void -test_migrate_tls_x509_finish(QTestState *from, - QTestState *to, - void *opaque) +test_migrate_tls_x509_finish(GuestState *from, GuestState *to, void *opaqu= e) { TestMigrateTLSX509Data *data =3D opaque; =20 @@ -1187,31 +1171,29 @@ test_migrate_tls_x509_finish(QTestState *from, #endif /* CONFIG_GNUTLS */ =20 static void * -test_migrate_compress_start(QTestState *from, - QTestState *to) +test_migrate_compress_start(GuestState *from, GuestState *to) { - migrate_set_parameter_int(from, "compress-level", 1); - migrate_set_parameter_int(from, "compress-threads", 4); - migrate_set_parameter_bool(from, "compress-wait-thread", true); - migrate_set_parameter_int(to, "decompress-threads", 4); + migrate_set_parameter_int(from->qs, "compress-level", 1); + migrate_set_parameter_int(from->qs, "compress-threads", 4); + migrate_set_parameter_bool(from->qs, "compress-wait-thread", true); + migrate_set_parameter_int(to->qs, "decompress-threads", 4); =20 - migrate_set_capability(from, "compress", true); - migrate_set_capability(to, "compress", true); + migrate_set_capability(from->qs, "compress", true); + migrate_set_capability(to->qs, "compress", true); =20 return NULL; } =20 static void * -test_migrate_compress_nowait_start(QTestState *from, - QTestState *to) +test_migrate_compress_nowait_start(GuestState *from, GuestState *to) { - migrate_set_parameter_int(from, "compress-level", 9); - migrate_set_parameter_int(from, "compress-threads", 1); - migrate_set_parameter_bool(from, "compress-wait-thread", false); - migrate_set_parameter_int(to, "decompress-threads", 1); + migrate_set_parameter_int(from->qs, "compress-level", 9); + migrate_set_parameter_int(from->qs, "compress-threads", 1); + migrate_set_parameter_bool(from->qs, "compress-wait-thread", false); + migrate_set_parameter_int(to->qs, "decompress-threads", 1); =20 - migrate_set_capability(from, "compress", true); - migrate_set_capability(to, "compress", true); + migrate_set_capability(from->qs, "compress", true); + migrate_set_capability(to->qs, "compress", true); =20 return NULL; } @@ -1224,7 +1206,7 @@ static void migrate_postcopy_prepare(GuestState *from, test_migrate_start(from, to, NULL, &args->start); =20 if (args->start_hook) { - args->postcopy_data =3D args->start_hook(from->qs, to->qs); + args->postcopy_data =3D args->start_hook(from, to); } =20 migrate_set_capability(from->qs, "postcopy-ram", true); @@ -1259,7 +1241,7 @@ static void migrate_postcopy_complete(GuestState *fro= m, GuestState *to, } =20 if (args->finish_hook) { - args->finish_hook(from->qs, to->qs, args->postcopy_data); + args->finish_hook(from, to, args->postcopy_data); args->postcopy_data =3D NULL; } =20 @@ -1270,7 +1252,7 @@ static void test_postcopy_common(GuestState *from, Gu= estState *to, MigrateCommon *args) { migrate_postcopy_prepare(from, to, args); - migrate_postcopy_start(from->qs, to->qs); + migrate_postcopy_start(from, to); migrate_postcopy_complete(from, to, args); } =20 @@ -1346,7 +1328,7 @@ static void test_postcopy_recovery_common(MigrateComm= on *args) migrate_set_parameter_int(from->qs, "max-postcopy-bandwidth", 4096); =20 /* Now we start the postcopy */ - migrate_postcopy_start(from->qs, to->qs); + migrate_postcopy_start(from, to); =20 /* * Wait until postcopy is really started; we can only run the @@ -1469,7 +1451,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, test_migrate_start(from, to, args->listen_uri, &args->start); =20 if (args->start_hook) { - data_hook =3D args->start_hook(from->qs, to->qs); + data_hook =3D args->start_hook(from, to); } =20 /* Wait for the first serial output from the source */ @@ -1552,7 +1534,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, } =20 if (args->finish_hook) { - args->finish_hook(from->qs, to->qs, data_hook); + args->finish_hook(from, to, data_hook); } =20 test_migrate_end(from, to, args->result =3D=3D MIG_TEST_SUCCEED); @@ -1687,13 +1669,12 @@ static void test_ignore_shared(void) } =20 static void * -test_migrate_xbzrle_start(QTestState *from, - QTestState *to) +test_migrate_xbzrle_start(GuestState *from, GuestState *to) { - migrate_set_parameter_int(from, "xbzrle-cache-size", 33554432); + migrate_set_parameter_int(from->qs, "xbzrle-cache-size", 33554432); =20 - migrate_set_capability(from, "xbzrle", true); - migrate_set_capability(to, "xbzrle", true); + migrate_set_capability(from->qs, "xbzrle", true); + migrate_set_capability(to->qs, "xbzrle", true); =20 return NULL; } @@ -1909,8 +1890,7 @@ static void test_precopy_tcp_tls_x509_reject_anon_cli= ent(void) #endif /* CONFIG_GNUTLS */ =20 #ifndef _WIN32 -static void *test_migrate_fd_start_hook(QTestState *from, - QTestState *to) +static void *test_migrate_fd_start_hook(GuestState *from, GuestState *to) { int ret; int pair[2]; @@ -1920,17 +1900,17 @@ static void *test_migrate_fd_start_hook(QTestState = *from, g_assert_cmpint(ret, =3D=3D, 0); =20 /* Send the 1st socket to the target */ - qtest_qmp_fds_assert_success(to, &pair[0], 1, + qtest_qmp_fds_assert_success(to->qs, &pair[0], 1, "{ 'execute': 'getfd'," " 'arguments': { 'fdname': 'fd-mig' }}"); close(pair[0]); =20 /* Start incoming migration from the 1st socket */ - qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," + qtest_qmp_assert_success(to->qs, "{ 'execute': 'migrate-incoming'," " 'arguments': { 'uri': 'fd:fd-mig' }}"); =20 /* Send the 2nd socket to the target */ - qtest_qmp_fds_assert_success(from, &pair[1], 1, + qtest_qmp_fds_assert_success(from->qs, &pair[1], 1, "{ 'execute': 'getfd'," " 'arguments': { 'fdname': 'fd-mig' }}"); close(pair[1]); @@ -1938,8 +1918,7 @@ static void *test_migrate_fd_start_hook(QTestState *f= rom, return NULL; } =20 -static void test_migrate_fd_finish_hook(QTestState *from, - QTestState *to, +static void test_migrate_fd_finish_hook(GuestState *from, GuestState *to, void *opaque) { QDict *rsp; @@ -1948,14 +1927,14 @@ static void test_migrate_fd_finish_hook(QTestState = *from, /* Test closing fds */ /* We assume, that QEMU removes named fd from its list, * so this should fail */ - rsp =3D qtest_qmp(from, "{ 'execute': 'closefd'," + rsp =3D qtest_qmp(from->qs, "{ 'execute': 'closefd'," " 'arguments': { 'fdname': 'fd-mig' }}"); g_assert_true(qdict_haskey(rsp, "error")); error_desc =3D qdict_get_str(qdict_get_qdict(rsp, "error"), "desc"); g_assert_cmpstr(error_desc, =3D=3D, "File descriptor named 'fd-mig' no= t found"); qobject_unref(rsp); =20 - rsp =3D qtest_qmp(to, "{ 'execute': 'closefd'," + rsp =3D qtest_qmp(to->qs, "{ 'execute': 'closefd'," " 'arguments': { 'fdname': 'fd-mig' }}"); g_assert_true(qdict_haskey(rsp, "error")); error_desc =3D qdict_get_str(qdict_get_qdict(rsp, "error"), "desc"); @@ -2141,44 +2120,40 @@ static void test_migrate_auto_converge(void) } =20 static void * -test_migrate_precopy_tcp_multifd_start_common(QTestState *from, - QTestState *to, +test_migrate_precopy_tcp_multifd_start_common(GuestState *from, GuestState= *to, const char *method) { - migrate_set_parameter_int(from, "multifd-channels", 16); - migrate_set_parameter_int(to, "multifd-channels", 16); + migrate_set_parameter_int(from->qs, "multifd-channels", 16); + migrate_set_parameter_int(to->qs, "multifd-channels", 16); =20 - migrate_set_parameter_str(from, "multifd-compression", method); - migrate_set_parameter_str(to, "multifd-compression", method); + migrate_set_parameter_str(from->qs, "multifd-compression", method); + migrate_set_parameter_str(to->qs, "multifd-compression", method); =20 - migrate_set_capability(from, "multifd", true); - migrate_set_capability(to, "multifd", true); + migrate_set_capability(from->qs, "multifd", true); + migrate_set_capability(to->qs, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," + qtest_qmp_assert_success(to->qs, "{ 'execute': 'migrate-incoming'," " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); =20 return NULL; } =20 static void * -test_migrate_precopy_tcp_multifd_start(QTestState *from, - QTestState *to) +test_migrate_precopy_tcp_multifd_start(GuestState *from, GuestState *to) { return test_migrate_precopy_tcp_multifd_start_common(from, to, "none"); } =20 static void * -test_migrate_precopy_tcp_multifd_zlib_start(QTestState *from, - QTestState *to) +test_migrate_precopy_tcp_multifd_zlib_start(GuestState *from, GuestState *= to) { return test_migrate_precopy_tcp_multifd_start_common(from, to, "zlib"); } =20 #ifdef CONFIG_ZSTD static void * -test_migrate_precopy_tcp_multifd_zstd_start(QTestState *from, - QTestState *to) +test_migrate_precopy_tcp_multifd_zstd_start(GuestState *from, GuestState *= to) { return test_migrate_precopy_tcp_multifd_start_common(from, to, "zstd"); } @@ -2227,16 +2202,15 @@ static void test_multifd_tcp_zstd(void) =20 #ifdef CONFIG_GNUTLS static void * -test_migrate_multifd_tcp_tls_psk_start_match(QTestState *from, - QTestState *to) +test_migrate_multifd_tcp_tls_psk_start_match(GuestState *from, GuestState = *to) { test_migrate_precopy_tcp_multifd_start_common(from, to, "none"); return test_migrate_tls_psk_start_match(from, to); } =20 static void * -test_migrate_multifd_tcp_tls_psk_start_mismatch(QTestState *from, - QTestState *to) +test_migrate_multifd_tcp_tls_psk_start_mismatch(GuestState *from, + GuestState *to) { test_migrate_precopy_tcp_multifd_start_common(from, to, "none"); return test_migrate_tls_psk_start_mismatch(from, to); @@ -2244,40 +2218,40 @@ test_migrate_multifd_tcp_tls_psk_start_mismatch(QTe= stState *from, =20 #ifdef CONFIG_TASN1 static void * -test_migrate_multifd_tls_x509_start_default_host(QTestState *from, - QTestState *to) +test_migrate_multifd_tls_x509_start_default_host(GuestState *from, + GuestState *to) { test_migrate_precopy_tcp_multifd_start_common(from, to, "none"); return test_migrate_tls_x509_start_default_host(from, to); } =20 static void * -test_migrate_multifd_tls_x509_start_override_host(QTestState *from, - QTestState *to) +test_migrate_multifd_tls_x509_start_override_host(GuestState *from, + GuestState *to) { test_migrate_precopy_tcp_multifd_start_common(from, to, "none"); return test_migrate_tls_x509_start_override_host(from, to); } =20 static void * -test_migrate_multifd_tls_x509_start_mismatch_host(QTestState *from, - QTestState *to) +test_migrate_multifd_tls_x509_start_mismatch_host(GuestState *from, + GuestState *to) { test_migrate_precopy_tcp_multifd_start_common(from, to, "none"); return test_migrate_tls_x509_start_mismatch_host(from, to); } =20 static void * -test_migrate_multifd_tls_x509_start_allow_anon_client(QTestState *from, - QTestState *to) +test_migrate_multifd_tls_x509_start_allow_anon_client(GuestState *from, + GuestState *to) { test_migrate_precopy_tcp_multifd_start_common(from, to, "none"); return test_migrate_tls_x509_start_allow_anon_client(from, to); } =20 static void * -test_migrate_multifd_tls_x509_start_reject_anon_client(QTestState *from, - QTestState *to) +test_migrate_multifd_tls_x509_start_reject_anon_client(GuestState *from, + GuestState *to) { test_migrate_precopy_tcp_multifd_start_common(from, to, "none"); return test_migrate_tls_x509_start_reject_anon_client(from, to); --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264680; cv=none; d=zohomail.com; s=zohoarc; b=VCjwU84Gx0zAH6GfDSBHk2dKgENjRd59FNfU/Z2M/nhTVD2xQ17aUVYQkLWRHYDYE3+UMhz5emhWy9JKww05rmUQQvm7DoCfeg6vN7s+RZDwDJVBzixBMhJM/5Yoi1vRxSkFpCzh5tRFfKZxxMSxpSOpnpa2H5f26T086hgoTb8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264680; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WQYcvVui393GERT+f111xji4B0l6I7VfZfdJQ9wA1dY=; b=R10r3jdAbQd3rTuIGWEA4hZB2MxXm0DRrln1nw+DUxWUAGeFIrTiICM3KX3kUv/4rDh/VTOUNSEs5McOJuneWS7P6uiA1u/C6RBGjydeIE1MtAXjwpZmZbeYF7peqWWc8DAOAlIwGQgm7iJ3AIUiNuAxcxGp24EwiQdCFlKnHlc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264680349299.7561216530006; Thu, 8 Jun 2023 15:51:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OT9-0004xi-Bg; Thu, 08 Jun 2023 18:51:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSx-0004si-La for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSw-0005JF-3u for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:51 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-64-7ywYv6jjMQW-AIDasX-gEw-1; Thu, 08 Jun 2023 18:50:46 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 244D81C04191; Thu, 8 Jun 2023 22:50:46 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9307E492B00; Thu, 8 Jun 2023 22:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WQYcvVui393GERT+f111xji4B0l6I7VfZfdJQ9wA1dY=; b=BL06X15Vl+f9UnoFLiyjmFiCoVI23cZTzs9VgEXFU4ckrJwte20J6JoRxEezpkVeGMzp7f RVm5LdxytFqlYPh7nT06UNYqMmd7OHnsBVlYXhjJmmyq9ogQZkzLuKDeHl0CMgIAlx0Bm/ uBP2utLAf+7P8bHPM5IBrv2du0ImpZM= X-MC-Unique: 7ywYv6jjMQW-AIDasX-gEw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 31/42] migration-test: Preffer to->uri to uri parameter for migration Date: Fri, 9 Jun 2023 00:49:32 +0200 Message-Id: <20230608224943.3877-32-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264681907100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 6438379dcf..0afe871cfb 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -667,12 +667,22 @@ static void migrate_postcopy_start(GuestState *from, = GuestState *to) =20 static void do_migrate(GuestState *from, GuestState *to, const gchar *uri) { - if (!uri) { - g_autofree char *tcp_uri =3D - migrate_get_socket_address(to->qs, "socket-address"); - migrate_qmp(from->qs, tcp_uri, "{}"); + if (to->uri) { + if (strncmp(to->uri, "tcp:", strlen("tcp:")) =3D=3D 0) { + g_autofree char *tcp_uri =3D + migrate_get_socket_address(to->qs, "socket-address"); + migrate_qmp(from->qs, tcp_uri, "{}"); + } else { + migrate_qmp(from->qs, to->uri, "{}"); + } } else { - migrate_qmp(from->qs, uri, "{}"); + if (!uri) { + g_autofree char *tcp_uri =3D + migrate_get_socket_address(to->qs, "socket-address"); + migrate_qmp(from->qs, tcp_uri, "{}"); + } else { + migrate_qmp(from->qs, uri, "{}"); + } } } =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264685; cv=none; d=zohomail.com; s=zohoarc; b=fG0grSOWNGBADBjWP3pHKKaeVK4H3HRD3dk6v940D1Q83z6urPQulECBzOVFwaXrG3dxm8OSvq+BbP9kmtjjRPPXdAWuZsHnzwedpvKN4TJUdWCCPR04GGOt8XM/IMCFlG35r07Dd7J8tA7uhb6MSfjnhqZBjSzmlVKcLDFQl+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264685; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=pVN1nXo6DujMCsHuqnOTEQUt2FzvOxE8/dS8ka8qYWg=; b=TaRmIhlDH0hp4zzfz+//oNMhj0oXyGG4H9AbtLAQ1CidzbF0wAt7pBBNNPwArBWU+QtDsL04vCAkeNQrU7rZmcobyYQBohKwWFJmjzsoE0IlqZmicnboCoNxMabgY8HIe+lWTsb4Ayu9amvOU8XsJXft+eIX1kueif1d3p3Yrv4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264685089656.803556656771; Thu, 8 Jun 2023 15:51:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OT3-0004wt-Jv; Thu, 08 Jun 2023 18:50:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSy-0004ub-9e for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSw-0005JR-6o for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:52 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-rf-it9liOu6KyKHe2o7ePA-1; Thu, 08 Jun 2023 18:50:48 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC8BB80013A; Thu, 8 Jun 2023 22:50:47 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AFEB492B00; Thu, 8 Jun 2023 22:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264649; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pVN1nXo6DujMCsHuqnOTEQUt2FzvOxE8/dS8ka8qYWg=; b=C9RqNUR7EtfoG5dQXqqga8zrXfdRuadbe1DxZvTOA1gBhdePYjZ9INdFMa+KQ9UTm7kv41 gZG2kG9aidSjhn8wN0GmbUwArDU1b3iCBS33otoALa9Lznaj9eiqKcO3RxqmMb95by2ybz hzmEkkFcmlmU+qUCdWagV0CrcUuEaKs= X-MC-Unique: rf-it9liOu6KyKHe2o7ePA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 32/42] migration-test: Create guest_set_uri() Date: Fri, 9 Jun 2023 00:49:33 +0200 Message-Id: <20230608224943.3877-33-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264686878100001 Content-Type: text/plain; charset="utf-8" We need this for migration-incoming cases. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 0afe871cfb..f029258f67 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -286,6 +286,12 @@ static void guest_listen_unix_socket(GuestState *vm) vm->uri =3D g_strdup_printf("unix:%s", vm->unix_socket); } =20 +static void guest_set_uri(GuestState *vm, const gchar *uri) +{ + g_free(vm->uri); + vm->uri =3D g_strdup(uri); +} + /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -1918,6 +1924,7 @@ static void *test_migrate_fd_start_hook(GuestState *f= rom, GuestState *to) /* Start incoming migration from the 1st socket */ qtest_qmp_assert_success(to->qs, "{ 'execute': 'migrate-incoming'," " 'arguments': { 'uri': 'fd:fd-mig' }}"); + guest_set_uri(to, "fd:fd-mig"); =20 /* Send the 2nd socket to the target */ qtest_qmp_fds_assert_success(from->qs, &pair[1], 1, @@ -1958,7 +1965,6 @@ static void test_migrate_fd_proto(void) GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D "defer", - .connect_uri =3D "fd:fd-mig", .start_hook =3D test_migrate_fd_start_hook, .finish_hook =3D test_migrate_fd_finish_hook }; @@ -2145,6 +2151,7 @@ test_migrate_precopy_tcp_multifd_start_common(GuestSt= ate *from, GuestState *to, /* Start incoming migration from the 1st socket */ qtest_qmp_assert_success(to->qs, "{ 'execute': 'migrate-incoming'," " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); + guest_set_uri(to, "tcp:127.0.0.1:0"); =20 return NULL; } @@ -2411,6 +2418,7 @@ static void test_multifd_tcp_cancel(void) /* Start incoming migration from the 1st socket */ qtest_qmp_assert_success(to->qs, "{ 'execute': 'migrate-incoming'," " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); + guest_set_uri(to, "tcp:127.0.0.1:0"); =20 /* Wait for the first serial output from the source */ wait_for_serial(from); @@ -2440,6 +2448,7 @@ static void test_multifd_tcp_cancel(void) /* Start incoming migration from the 1st socket */ qtest_qmp_assert_success(to2->qs, "{ 'execute': 'migrate-incoming'," " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); + guest_set_uri(to2, "tcp:127.0.0.1:0"); =20 wait_for_migration_status(from->qs, "cancelled", NULL); =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686265028; cv=none; d=zohomail.com; s=zohoarc; b=mHjjQLDri1+8vigCr1r5ErK84jIbkOuAnP1+w8TJ7bEmjvz0BDCN6jwlkDQh2YiC+4AXKzrTzOUym9dAfqxRGgFMMzDl+BjTUEQhIOgcjhP9de7M9wMB9GiiF8uPAmuu9q6vDMCG5j6MWVzPNBmAFtAwnWXag1VLakc4lqfBChE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265028; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FmVBbNYr8UlJROOV2zWzgfWTW/NpftgV/qHnpIjmsZ4=; b=ci8c7K3ofFJikAnvTRXq4KDGgLzQKZJV/R8oLPsOUTIjxrecysWq5M1ppikMICrMogQMKQf54CPAMtPjJrSf3Ptr6sINFJyAPd+ALNR0QBHbyjHuyA2be6h8GPLI5Y5JXCWWeUNgwEF82mry+A6CQh1UU52BoWt7TLispubMi+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686265028448429.39035634081483; Thu, 8 Jun 2023 15:57:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTL-0005Ki-E8; Thu, 08 Jun 2023 18:51:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OT0-0004wy-NA for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OSy-0005K7-IP for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:54 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-576-FnChPJ_BOn6C7Yj2K11G4A-1; Thu, 08 Jun 2023 18:50:50 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E38E02A59548; Thu, 8 Jun 2023 22:50:49 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 409FF492B00; Thu, 8 Jun 2023 22:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FmVBbNYr8UlJROOV2zWzgfWTW/NpftgV/qHnpIjmsZ4=; b=TsipUVwGKan0bL72opxUetH6yHKMoRBUqlX5aE9Kl2PfL6ZgdbRgmVfsJUaEldAst7TRdj izMeYLZ0vI9Ol0CV9zlYJXbKtgZ3m+adasTcASOsQXCySQl17pVQrbOJFurk2MlpFjYHin +tPQ/4X+VtNKKvSJIlo7NpLDsRPJWIQ= X-MC-Unique: FnChPJ_BOn6C7Yj2K11G4A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 33/42] migration-test: Remove connect_uri Date: Fri, 9 Jun 2023 00:49:34 +0200 Message-Id: <20230608224943.3877-34-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265029209100014 Content-Type: text/plain; charset="utf-8" We are using to->uri in everywhere know. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 52 +++++++++--------------------------- 1 file changed, 13 insertions(+), 39 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index f029258f67..3b1b76fe6f 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -671,24 +671,14 @@ static void migrate_postcopy_start(GuestState *from, = GuestState *to) qtest_qmp_eventwait(to->qs, "RESUME"); } =20 -static void do_migrate(GuestState *from, GuestState *to, const gchar *uri) +static void do_migrate(GuestState *from, GuestState *to) { - if (to->uri) { - if (strncmp(to->uri, "tcp:", strlen("tcp:")) =3D=3D 0) { - g_autofree char *tcp_uri =3D - migrate_get_socket_address(to->qs, "socket-address"); - migrate_qmp(from->qs, tcp_uri, "{}"); - } else { - migrate_qmp(from->qs, to->uri, "{}"); - } + if (!to->uri || strncmp(to->uri, "tcp:", strlen("tcp:")) =3D=3D 0) { + g_autofree char *tcp_uri =3D + migrate_get_socket_address(to->qs, "socket-address"); + migrate_qmp(from->qs, tcp_uri, "{}"); } else { - if (!uri) { - g_autofree char *tcp_uri =3D - migrate_get_socket_address(to->qs, "socket-address"); - migrate_qmp(from->qs, tcp_uri, "{}"); - } else { - migrate_qmp(from->qs, uri, "{}"); - } + migrate_qmp(from->qs, to->uri, "{}"); } } =20 @@ -726,14 +716,6 @@ typedef struct { /* Required: the URI for the dst QEMU to listen on */ const char *listen_uri; =20 - /* - * Optional: the URI for the src QEMU to connect to - * If NULL, then it will query the dst QEMU for its actual - * listening address and use that as the connect address. - * This allows for dynamically picking a free TCP port. - */ - const char *connect_uri; - /* Optional: callback to run at start to set migration parameters */ TestMigrateStartHook start_hook; /* Optional: callback to run at finish to cleanup */ @@ -1239,7 +1221,7 @@ static void migrate_postcopy_prepare(GuestState *from, /* Wait for the first serial output from the source */ wait_for_serial(from); =20 - do_migrate(from, to, to->uri); + do_migrate(from, to); =20 wait_for_migration_pass(from->qs); } @@ -1500,7 +1482,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, } } =20 - do_migrate(from, to, args->connect_uri); + do_migrate(from, to); =20 if (args->result !=3D MIG_TEST_SUCCEED) { bool allow_active =3D args->result =3D=3D MIG_TEST_FAIL; @@ -1563,7 +1545,6 @@ static void test_precopy_unix_plain(void) GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D uri, - .connect_uri =3D uri, /* * The simplest use case of precopy, covering smoke tests of * get-dirty-log dirty tracking. @@ -1582,7 +1563,6 @@ static void test_precopy_unix_dirty_ring(void) GuestState *to =3D guest_create("target"); MigrateCommon args =3D { .listen_uri =3D uri, - .connect_uri =3D uri, /* * Besides the precopy/unix basic test, cover dirty ring interface * rather than get-dirty-log. @@ -1602,7 +1582,6 @@ static void test_precopy_unix_tls_psk(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .connect_uri =3D uri, .listen_uri =3D uri, .start_hook =3D test_migrate_tls_psk_start_match, .finish_hook =3D test_migrate_tls_psk_finish, @@ -1618,7 +1597,6 @@ static void test_precopy_unix_tls_x509_default_host(v= oid) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .connect_uri =3D uri, .listen_uri =3D uri, .start_hook =3D test_migrate_tls_x509_start_default_host, .finish_hook =3D test_migrate_tls_x509_finish, @@ -1636,7 +1614,6 @@ static void test_precopy_unix_tls_x509_override_host(= void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .connect_uri =3D uri, .listen_uri =3D uri, .start_hook =3D test_migrate_tls_x509_start_override_host, .finish_hook =3D test_migrate_tls_x509_finish, @@ -1664,7 +1641,7 @@ static void test_ignore_shared(void) /* Wait for the first serial output from the source */ wait_for_serial(from); =20 - do_migrate(from, to, to->uri); + do_migrate(from, to); =20 wait_for_migration_pass(from->qs); =20 @@ -1701,7 +1678,6 @@ static void test_precopy_unix_xbzrle(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .connect_uri =3D uri, .listen_uri =3D uri, .start_hook =3D test_migrate_xbzrle_start, .iterations =3D 2, @@ -1721,7 +1697,6 @@ static void test_precopy_unix_compress(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .connect_uri =3D uri, .listen_uri =3D uri, .start_hook =3D test_migrate_compress_start, /* @@ -1746,7 +1721,6 @@ static void test_precopy_unix_compress_nowait(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .connect_uri =3D uri, .listen_uri =3D uri, .start_hook =3D test_migrate_compress_nowait_start, /* @@ -1989,7 +1963,7 @@ static void do_test_validate_uuid(GuestState *from, G= uestState *to, /* Wait for the first serial output from the source */ wait_for_serial(from); =20 - do_migrate(from, to, to->uri); + do_migrate(from, to); =20 if (should_fail) { qtest_set_expected_status(to->qs, EXIT_FAILURE); @@ -2098,7 +2072,7 @@ static void test_migrate_auto_converge(void) /* Wait for the first serial output from the source */ wait_for_serial(from); =20 - do_migrate(from, to, to->uri); + do_migrate(from, to); =20 /* Wait for throttling begins */ percentage =3D 0; @@ -2423,7 +2397,7 @@ static void test_multifd_tcp_cancel(void) /* Wait for the first serial output from the source */ wait_for_serial(from); =20 - do_migrate(from, to, "127.0.0.1:0"); + do_migrate(from, to); =20 wait_for_migration_pass(from->qs); =20 @@ -2454,7 +2428,7 @@ static void test_multifd_tcp_cancel(void) =20 migrate_ensure_converge(from->qs); =20 - do_migrate(from, to2, "127.0.0.1:0"); + do_migrate(from, to2); =20 wait_for_migration_pass(from->qs); =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264886; cv=none; d=zohomail.com; s=zohoarc; b=IHSgYLkxaGAA5ZqE1Z3e6ra+r4u81tSMaI0zbrcGXUCDsqmmn4kImJ6uK9bAyYXu4uX6CiNeNsYC0KqKhUpG3wyN21VN3zl0S0nqcNdnnJV36AxstLwOocNIWjsIGK1MR9RAdbLskMq/snqGgsLgq6plsX4agtf/TJXXKYiEvgk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264886; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QSGWendDyCd+WV+hmYwME6vB7l+YVlp30HEoATLBdUs=; b=ld7n0JYpI5PkPx8My0QG9+cKXwUux/f2N+fa5J83xBFYriwSkDLgkFhC0isZh4VhuePwrLcYIJr/jilOuMj9+vaXUXmOavpagez/r8zPxjau1hhMg5SbQklFml1lfUhn3NYgaN+cnPUXadHtQul3mxQgo5BKPMiUcvjjwgtDRws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264886139231.82247406318038; Thu, 8 Jun 2023 15:54:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTN-0005aa-8I; Thu, 08 Jun 2023 18:51:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTH-0005Hg-D9 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTD-0005MA-KD for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:10 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-31-Ey653PUbPGCRMRKmjIE8xg-1; Thu, 08 Jun 2023 18:51:05 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0DAE1811E7F; Thu, 8 Jun 2023 22:51:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37F54492B00; Thu, 8 Jun 2023 22:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QSGWendDyCd+WV+hmYwME6vB7l+YVlp30HEoATLBdUs=; b=GsWeEpFuLtlYbm27eSv5YR8Prcpy36upA3nWJgsump8GBUj1lRt3hr0NJzvlNCWDIFBD1R s7rWOd/zmAwJU7TtRf99jean63bva/eOKxJ9gz/CyCq+WUwuPk5Y64QGrzIJUBUXoeaDt6 Yz9ohguUg2EZehcCtM538+6wmEYMr20= X-MC-Unique: Ey653PUbPGCRMRKmjIE8xg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 34/42] migration-test: Use new schema for all tests that use unix sockets Date: Fri, 9 Jun 2023 00:49:35 +0200 Message-Id: <20230608224943.3877-35-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264888313100003 Content-Type: text/plain; charset="utf-8" Once there we can remove the now unused cleanup() function. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 39 ++++++++++-------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 3b1b76fe6f..76a5f8d353 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -462,13 +462,6 @@ static void check_guests_ram(GuestState *who) g_assert(bad =3D=3D 0); } =20 -static void cleanup(const char *filename) -{ - g_autofree char *path =3D g_strdup_printf("%s/%s", tmpfs, filename); - - unlink(path); -} - static char *SocketAddress_to_str(SocketAddress *addr) { switch (addr->type) { @@ -843,8 +836,6 @@ static void test_migrate_end(GuestState *from, GuestSta= te *to, bool test_dest) } =20 guest_destroy(to); - - cleanup("migsocket"); } =20 #ifdef CONFIG_GNUTLS @@ -1540,11 +1531,9 @@ static void test_precopy_common(GuestState *from, Gu= estState *to, =20 static void test_precopy_unix_plain(void) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D uri, /* * The simplest use case of precopy, covering smoke tests of * get-dirty-log dirty tracking. @@ -1552,17 +1541,16 @@ static void test_precopy_unix_plain(void) .live =3D true, }; =20 + guest_listen_unix_socket(to); test_precopy_common(from, to, &args); } =20 =20 static void test_precopy_unix_dirty_ring(void) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D uri, /* * Besides the precopy/unix basic test, cover dirty ring interface * rather than get-dirty-log. @@ -1572,32 +1560,30 @@ static void test_precopy_unix_dirty_ring(void) =20 guest_use_dirty_ring(from); guest_use_dirty_ring(to); + guest_listen_unix_socket(to); test_precopy_common(from, to, &args); } =20 #ifdef CONFIG_GNUTLS static void test_precopy_unix_tls_psk(void) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D uri, .start_hook =3D test_migrate_tls_psk_start_match, .finish_hook =3D test_migrate_tls_psk_finish, }; =20 + guest_listen_unix_socket(to); test_precopy_common(from, to, &args); } =20 #ifdef CONFIG_TASN1 static void test_precopy_unix_tls_x509_default_host(void) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D uri, .start_hook =3D test_migrate_tls_x509_start_default_host, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, @@ -1605,20 +1591,20 @@ static void test_precopy_unix_tls_x509_default_host= (void) =20 guest_hide_stderr(from); guest_hide_stderr(to); + guest_listen_unix_socket(to); test_precopy_common(from, to, &args); } =20 static void test_precopy_unix_tls_x509_override_host(void) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D uri, .start_hook =3D test_migrate_tls_x509_start_override_host, .finish_hook =3D test_migrate_tls_x509_finish, }; =20 + guest_listen_unix_socket(to); test_precopy_common(from, to, &args); } #endif /* CONFIG_TASN1 */ @@ -1626,14 +1612,14 @@ static void test_precopy_unix_tls_x509_override_hos= t(void) =20 static void test_ignore_shared(void) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateStart args =3D { }; =20 guest_use_shmem(from); guest_use_shmem(to); - test_migrate_start(from, to, uri, &args); + guest_listen_unix_socket(to); + test_migrate_start(from, to, NULL, &args); =20 migrate_set_capability(from->qs, "x-ignore-shared", true); migrate_set_capability(to->qs, "x-ignore-shared", true); @@ -1674,11 +1660,9 @@ test_migrate_xbzrle_start(GuestState *from, GuestSta= te *to) =20 static void test_precopy_unix_xbzrle(void) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D uri, .start_hook =3D test_migrate_xbzrle_start, .iterations =3D 2, /* @@ -1688,16 +1672,15 @@ static void test_precopy_unix_xbzrle(void) .live =3D true, }; =20 + guest_listen_unix_socket(to); test_precopy_common(from, to, &args); } =20 static void test_precopy_unix_compress(void) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D uri, .start_hook =3D test_migrate_compress_start, /* * Test that no invalid thread state is left over from @@ -1712,16 +1695,15 @@ static void test_precopy_unix_compress(void) .live =3D true, }; =20 + guest_listen_unix_socket(to); test_precopy_common(from, to, &args); } =20 static void test_precopy_unix_compress_nowait(void) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D uri, .start_hook =3D test_migrate_compress_nowait_start, /* * Test that no invalid thread state is left over from @@ -1732,6 +1714,7 @@ static void test_precopy_unix_compress_nowait(void) .live =3D true, }; =20 + guest_listen_unix_socket(to); test_precopy_common(from, to, &args); } =20 @@ -2053,7 +2036,7 @@ static void test_migrate_auto_converge(void) const int64_t init_pct =3D 5, inc_pct =3D 25, max_pct =3D 95; =20 guest_listen_unix_socket(to); - test_migrate_start(from, to, to->uri, &args); + test_migrate_start(from, to, NULL, &args); =20 migrate_set_capability(from->qs, "auto-converge", true); migrate_set_parameter_int(from->qs, "cpu-throttle-initial", init_pct); --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264957; cv=none; d=zohomail.com; s=zohoarc; b=ef2fRenZFc8HBSc5hrfyW7JU8zirCXYLeGlFD/slVYAT4PTdFB4eq4OYehVe0aPZUrRuVhC7QfYgG5HWKk/Col7RAo8+Hznc4Rj/w5RBdVTutjUNcQFeYeBqF+gHehQZwvABWyJ2D3ISEDrvIGoj9tQxlCocqg4/YmAuMFMm5fY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264957; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EDGtoV7qXWzFl+UYDyXYjN+Gedv5Mn0oMfKvI+Lso98=; b=HVH0lAGqjOjmEoxkgHX/KJ5NKsbAh6hGDEl5abl4CzyDSki+GD6Btt/x2jkprx4ygNwoi1ECurI1KazR76BA1R0C4b88/mfSvwfe3PRqHXzNiN8kREuoi0TrvIQRKcWMkaPevNHsiBLxxdpOIqYtPmfxycnbd84VAORNBlrLHjw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264957540644.1353394054894; Thu, 8 Jun 2023 15:55:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTM-0005Tq-8h; Thu, 08 Jun 2023 18:51:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTJ-0005Hj-2d for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTG-0005MT-1Y for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:12 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-604-ROmBqgvRM0ygEWzLyiadTg-1; Thu, 08 Jun 2023 18:51:07 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 02D9D811E7C; Thu, 8 Jun 2023 22:51:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5403A492B00; Thu, 8 Jun 2023 22:51:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264668; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EDGtoV7qXWzFl+UYDyXYjN+Gedv5Mn0oMfKvI+Lso98=; b=GaAfheuk4q+VIak3HCuB01/U+IBiZJOW6rNU4/ARlj/h1rvOHT06Hy+tWFZpnQlxi/Lo0+ 5o9OoC0LpZCf7Bdni/VxykJ1AdzkCTQF1x326DutqbBQD3eVDkXrHrl/OI6aOr/+iMq6wn eU6nt8x9DaTlip/cnTQGQYppF+s875w= X-MC-Unique: ROmBqgvRM0ygEWzLyiadTg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 35/42] migration-test: Set uri for tcp tests with guest_set_uri() Date: Fri, 9 Jun 2023 00:49:36 +0200 Message-Id: <20230608224943.3877-36-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264959018100022 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 76a5f8d353..8d497d0940 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1423,7 +1423,8 @@ static void test_baddest(void) =20 guest_hide_stderr(from); guest_hide_stderr(to); - test_migrate_start(from, to, "tcp:127.0.0.1:0", &args); + guest_set_uri(to, "tcp:127.0.0.1:0"); + test_migrate_start(from, to, NULL, &args); /* * Don't change to do_migrate(). We are using a wrong uri on purpose. */ @@ -1722,10 +1723,9 @@ static void test_precopy_tcp_plain(void) { GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", - }; + MigrateCommon args =3D { }; =20 + guest_set_uri(to, "tcp:127.0.0.1:0"); test_precopy_common(from, to, &args); } =20 @@ -1735,11 +1735,11 @@ static void test_precopy_tcp_tls_psk_match(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_psk_start_match, .finish_hook =3D test_migrate_tls_psk_finish, }; =20 + guest_set_uri(to, "tcp:127.0.0.1:0"); test_precopy_common(from, to, &args); } =20 @@ -1748,7 +1748,6 @@ static void test_precopy_tcp_tls_psk_mismatch(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_psk_start_mismatch, .finish_hook =3D test_migrate_tls_psk_finish, .result =3D MIG_TEST_FAIL, @@ -1756,6 +1755,7 @@ static void test_precopy_tcp_tls_psk_mismatch(void) =20 guest_hide_stderr(from); guest_hide_stderr(to); + guest_set_uri(to, "tcp:127.0.0.1:0"); test_precopy_common(from, to, &args); } =20 @@ -1765,11 +1765,11 @@ static void test_precopy_tcp_tls_x509_default_host(= void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_default_host, .finish_hook =3D test_migrate_tls_x509_finish, }; =20 + guest_set_uri(to, "tcp:127.0.0.1:0"); test_precopy_common(from, to, &args); } =20 @@ -1778,11 +1778,11 @@ static void test_precopy_tcp_tls_x509_override_host= (void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_override_host, .finish_hook =3D test_migrate_tls_x509_finish, }; =20 + guest_set_uri(to, "tcp:127.0.0.1:0"); test_precopy_common(from, to, &args); } =20 @@ -1791,7 +1791,6 @@ static void test_precopy_tcp_tls_x509_mismatch_host(v= oid) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_mismatch_host, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL_DEST_QUIT_ERR, @@ -1799,6 +1798,7 @@ static void test_precopy_tcp_tls_x509_mismatch_host(v= oid) =20 guest_hide_stderr(from); guest_hide_stderr(to); + guest_set_uri(to, "tcp:127.0.0.1:0"); test_precopy_common(from, to, &args); } =20 @@ -1807,11 +1807,11 @@ static void test_precopy_tcp_tls_x509_friendly_clie= nt(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_friendly_client, .finish_hook =3D test_migrate_tls_x509_finish, }; =20 + guest_set_uri(to, "tcp:127.0.0.1:0"); test_precopy_common(from, to, &args); } =20 @@ -1820,7 +1820,6 @@ static void test_precopy_tcp_tls_x509_hostile_client(= void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_hostile_client, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL, @@ -1828,6 +1827,7 @@ static void test_precopy_tcp_tls_x509_hostile_client(= void) =20 guest_hide_stderr(from); guest_hide_stderr(to); + guest_set_uri(to, "tcp:127.0.0.1:0"); test_precopy_common(from, to, &args); } =20 @@ -1836,11 +1836,11 @@ static void test_precopy_tcp_tls_x509_allow_anon_cl= ient(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_allow_anon_client, .finish_hook =3D test_migrate_tls_x509_finish, }; =20 + guest_set_uri(to, "tcp:127.0.0.1:0"); test_precopy_common(from, to, &args); } =20 @@ -1849,7 +1849,6 @@ static void test_precopy_tcp_tls_x509_reject_anon_cli= ent(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "tcp:127.0.0.1:0", .start_hook =3D test_migrate_tls_x509_start_reject_anon_client, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL, @@ -1857,6 +1856,7 @@ static void test_precopy_tcp_tls_x509_reject_anon_cli= ent(void) =20 guest_hide_stderr(from); guest_hide_stderr(to); + guest_set_uri(to, "tcp:127.0.0.1:0"); test_precopy_common(from, to, &args); } #endif /* CONFIG_TASN1 */ --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686265027; cv=none; d=zohomail.com; s=zohoarc; b=DcXPoshf418E85yfvbmMpUUMfA75MaJcUklW614HLwAInm/5ZKz+vrlXuT93xDIx3Dm7LaQbYRb3UT6MhB7FaXBAOLUYTU2zOpOyfkc0bLVeq7i1VrRNOoNb1/vkzf+7cCEzwFxVSrAMzC1sPfmoIuMLX29KkcaUfheMMmqHtLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265027; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sQlbzlzJdsTEByR8DWR4rIJeodH/2vrPkeinuu5si9M=; b=hlu1ijhzBqndI7cj/sPwHLY/vAEFJU9K8LV5URQPrq/vH3utPBCc189HYIgiM+94mss3xkTYtUBDdt+VYcCRRNzhGPZpHril7EFUjgM5KUyH4FNR9bH5j/U9KQ8GKBHmrj6KahGoUlsWUwRIOjfs2C/vrKZnaWkJ2MV/GoJVs7I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168626502729521.760662858346905; Thu, 8 Jun 2023 15:57:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTO-0005nn-IE; Thu, 08 Jun 2023 18:51:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTL-0005LH-DA for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTJ-0005N3-6d for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:14 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-658-vqcsAxxeP6Ce4sBAksVTYw-1; Thu, 08 Jun 2023 18:51:09 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F184D80013A; Thu, 8 Jun 2023 22:51:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D201492B00; Thu, 8 Jun 2023 22:51:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264672; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sQlbzlzJdsTEByR8DWR4rIJeodH/2vrPkeinuu5si9M=; b=ZCJhMKjKYHp6QXc3PAYc9851U/TwoDCycOhwjHxlKIpcR0fSJNibOYCtnm4doX4tn8yMtr cW8766AG/VjNYFo2CLqRyvIGb0zHjR9YR7iUpNpqeukXCDwZPDAV2SV8XbjwLSuL4QVXMK gGk6uOEXWYBugZ5Dhwe2RQV3jvaAGmE= X-MC-Unique: vqcsAxxeP6Ce4sBAksVTYw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 36/42] migration-test: Remove unused listen_uri Date: Fri, 9 Jun 2023 00:49:37 +0200 Message-Id: <20230608224943.3877-37-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265029217100015 Content-Type: text/plain; charset="utf-8" Only remaining use was to transfer "defer". But we make "defer" the default if no uri is given. Once there Remove the uri parameter to test_migrate_start(). Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 8d497d0940..95b7c9ed73 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -706,9 +706,6 @@ typedef struct { /* Optional: fine tune start parameters */ MigrateStart start; =20 - /* Required: the URI for the dst QEMU to listen on */ - const char *listen_uri; - /* Optional: callback to run at start to set migration parameters */ TestMigrateStartHook start_hook; /* Optional: callback to run at finish to cleanup */ @@ -757,7 +754,7 @@ typedef struct { } MigrateCommon; =20 static void test_migrate_start(GuestState *from, GuestState *to, - const char *uri, MigrateStart *args) + MigrateStart *args) { g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; @@ -797,7 +794,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, to->name, to->memory_size, to->serial_path, - to->uri ? to->uri : uri, + to->uri ? to->uri : "defer", to->arch_opts ? to->arch_opts : "", to->arch_target ? to->arch_target : "", to->shmem_opts ? to->shmem_opts : "", @@ -1192,7 +1189,7 @@ static void migrate_postcopy_prepare(GuestState *from, MigrateCommon *args) { guest_listen_unix_socket(to); - test_migrate_start(from, to, NULL, &args->start); + test_migrate_start(from, to, &args->start); =20 if (args->start_hook) { args->postcopy_data =3D args->start_hook(from, to); @@ -1424,7 +1421,7 @@ static void test_baddest(void) guest_hide_stderr(from); guest_hide_stderr(to); guest_set_uri(to, "tcp:127.0.0.1:0"); - test_migrate_start(from, to, NULL, &args); + test_migrate_start(from, to, &args); /* * Don't change to do_migrate(). We are using a wrong uri on purpose. */ @@ -1438,7 +1435,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, { void *data_hook =3D NULL; =20 - test_migrate_start(from, to, args->listen_uri, &args->start); + test_migrate_start(from, to, &args->start); =20 if (args->start_hook) { data_hook =3D args->start_hook(from, to); @@ -1620,7 +1617,7 @@ static void test_ignore_shared(void) guest_use_shmem(from); guest_use_shmem(to); guest_listen_unix_socket(to); - test_migrate_start(from, to, NULL, &args); + test_migrate_start(from, to, &args); =20 migrate_set_capability(from->qs, "x-ignore-shared", true); migrate_set_capability(to->qs, "x-ignore-shared", true); @@ -1921,7 +1918,6 @@ static void test_migrate_fd_proto(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_fd_start_hook, .finish_hook =3D test_migrate_fd_finish_hook }; @@ -1933,7 +1929,7 @@ static void do_test_validate_uuid(GuestState *from, G= uestState *to, MigrateStart *args, bool should_fail) { guest_listen_unix_socket(to); - test_migrate_start(from, to, NULL, args); + test_migrate_start(from, to, args); =20 /* * UUID validation is at the begin of migration. So, the main process = of @@ -2036,7 +2032,7 @@ static void test_migrate_auto_converge(void) const int64_t init_pct =3D 5, inc_pct =3D 25, max_pct =3D 95; =20 guest_listen_unix_socket(to); - test_migrate_start(from, to, NULL, &args); + test_migrate_start(from, to, &args); =20 migrate_set_capability(from->qs, "auto-converge", true); migrate_set_parameter_int(from->qs, "cpu-throttle-initial", init_pct); @@ -2138,7 +2134,6 @@ static void test_multifd_tcp_none(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_precopy_tcp_multifd_start, /* * Multifd is more complicated than most of the features, it @@ -2155,7 +2150,6 @@ static void test_multifd_tcp_zlib(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_precopy_tcp_multifd_zlib_start, }; test_precopy_common(from, to, &args); @@ -2167,7 +2161,6 @@ static void test_multifd_tcp_zstd(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_precopy_tcp_multifd_zstd_start, }; test_precopy_common(from, to, &args); @@ -2237,7 +2230,6 @@ static void test_multifd_tcp_tls_psk_match(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tcp_tls_psk_start_match, .finish_hook =3D test_migrate_tls_psk_finish, }; @@ -2249,7 +2241,6 @@ static void test_multifd_tcp_tls_psk_mismatch(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tcp_tls_psk_start_mismatch, .finish_hook =3D test_migrate_tls_psk_finish, .result =3D MIG_TEST_FAIL, @@ -2265,7 +2256,6 @@ static void test_multifd_tcp_tls_x509_default_host(vo= id) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tls_x509_start_default_host, .finish_hook =3D test_migrate_tls_x509_finish, }; @@ -2277,7 +2267,6 @@ static void test_multifd_tcp_tls_x509_override_host(v= oid) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tls_x509_start_override_host, .finish_hook =3D test_migrate_tls_x509_finish, }; @@ -2302,7 +2291,6 @@ static void test_multifd_tcp_tls_x509_mismatch_host(v= oid) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tls_x509_start_mismatch_host, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL, @@ -2317,7 +2305,6 @@ static void test_multifd_tcp_tls_x509_allow_anon_clie= nt(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tls_x509_start_allow_anon_cli= ent, .finish_hook =3D test_migrate_tls_x509_finish, }; @@ -2329,7 +2316,6 @@ static void test_multifd_tcp_tls_x509_reject_anon_cli= ent(void) GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); MigrateCommon args =3D { - .listen_uri =3D "defer", .start_hook =3D test_migrate_multifd_tls_x509_start_reject_anon_cl= ient, .finish_hook =3D test_migrate_tls_x509_finish, .result =3D MIG_TEST_FAIL, @@ -2362,7 +2348,7 @@ static void test_multifd_tcp_cancel(void) guest_hide_stderr(from); guest_hide_stderr(to); =20 - test_migrate_start(from, to, "defer", &args); + test_migrate_start(from, to, &args); =20 migrate_ensure_non_converge(from->qs); =20 @@ -2396,7 +2382,7 @@ static void test_multifd_tcp_cancel(void) .only_target =3D true, }; =20 - test_migrate_start(from, to2, "defer", &args); + test_migrate_start(from, to2, &args); =20 migrate_set_parameter_int(to2->qs, "multifd-channels", 16); =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686265009; cv=none; d=zohomail.com; s=zohoarc; b=mYk6ISqeKBctter0RyauFkH9s6daetqU5KIrf2wwdw5jleY0LQ6bbPAKBt/4DyxohrMXTNuQnRu9Bis+4+WQsir4gEvrGF4W7Xnhs3U1+NCeMvz8Bxeej8FCGmCYux3uFjcC3I7YxMw6rv7z2BBKZCVxaqz+GrCCGWclw76p2bo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265009; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jyurFvDURCZbEwa8AO4WSQ20OAwsMG3UWiZ1c2Nvryo=; b=ftDtnczqD4IZpFVMibTq1cvVZu9ge4IEoxY8ysnqQBLSmi2vppfz8VILXiCAeEd2AIOG9lOBLHC6GL/xD0tCuMxedp34W4ggq/w/EyPsA+d1PmydmP5hEKmHWorStebk1+2RBsrPHddkBAVEqdJPGQ4cOA+2fQUulrwRhlb33S0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686265009468779.5763971198295; Thu, 8 Jun 2023 15:56:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTO-0005qT-Ul; Thu, 08 Jun 2023 18:51:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTM-0005Xg-Th for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTL-0005NJ-35 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:16 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-662-ZFHyJ0eEMlS_eSadg47ohA-1; Thu, 08 Jun 2023 18:51:11 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E7BA7385556A; Thu, 8 Jun 2023 22:51:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45655492B00; Thu, 8 Jun 2023 22:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264673; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jyurFvDURCZbEwa8AO4WSQ20OAwsMG3UWiZ1c2Nvryo=; b=SKDjlUSzcI0z5nUszaWW5f6yhj0oTmA1J5yllxioxFvQUTnwgW8l7JTU/qiTbwPpsFYR05 SILvNi1DiZZSd72CXGVL5goL+NoL+0S923/3IVRhCMDaiFhH+Utyaeeeu8ihYaBX/Theto CTdPwOpLhMCiYUluDbnMWqzlpbVGfTA= X-MC-Unique: ZFHyJ0eEMlS_eSadg47ohA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 37/42] migration-test: Create get_event GuestState variable Date: Fri, 9 Jun 2023 00:49:38 +0200 Message-Id: <20230608224943.3877-38-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265010655100001 Content-Type: text/plain; charset="utf-8" So we don't use a global variable for events. We use one by guest. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 48 +++++++++++++++++------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 95b7c9ed73..a96eb3eec7 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -41,8 +41,6 @@ #endif =20 static bool uffd_feature_thread_id; -static bool got_src_stop; -static bool got_dst_resume; =20 /* * Dirtylimit stop working if dirty page rate error @@ -172,6 +170,7 @@ typedef struct { gchar *uri; unsigned start_address; unsigned end_address; + bool got_event; } GuestState; =20 static GuestState *guest_create(const char *name) @@ -396,21 +395,21 @@ static void read_blocktime(QTestState *who) qobject_unref(rsp_return); } =20 -static void wait_for_migration_pass(QTestState *who) +static void wait_for_migration_pass(GuestState *who) { - uint64_t initial_pass =3D get_migration_pass(who); + uint64_t initial_pass =3D get_migration_pass(who->qs); uint64_t pass; =20 /* Wait for the 1st sync */ - while (!got_src_stop && !initial_pass) { + while (!who->got_event && !initial_pass) { usleep(1000); - initial_pass =3D get_migration_pass(who); + initial_pass =3D get_migration_pass(who->qs); } =20 do { usleep(1000); - pass =3D get_migration_pass(who); - } while (pass =3D=3D initial_pass && !got_src_stop); + pass =3D get_migration_pass(who->qs); + } while (pass =3D=3D initial_pass && !who->got_event); } =20 static void check_guests_ram(GuestState *who) @@ -657,7 +656,7 @@ static void migrate_postcopy_start(GuestState *from, Gu= estState *to) qtest_qmp_assert_success(from->qs, "{ 'execute': 'migrate-start-postcopy' }"); =20 - if (!got_src_stop) { + if (!from->got_event) { qtest_qmp_eventwait(from->qs, "STOP"); } =20 @@ -759,9 +758,6 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; =20 - got_src_stop =3D false; - got_dst_resume =3D false; - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name %s,debug-threads=3Don " "-m %s " @@ -781,7 +777,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, from->qs =3D qtest_init(cmd_source); qtest_qmp_set_event_callback(from->qs, migrate_watch_for_stop, - &got_src_stop); + &from->got_event); } =20 cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " @@ -803,7 +799,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, to->qs =3D qtest_init(cmd_target); qtest_qmp_set_event_callback(to->qs, migrate_watch_for_resume, - &got_dst_resume); + &to->got_event); } =20 static void test_migrate_end(GuestState *from, GuestState *to, bool test_d= est) @@ -1211,7 +1207,7 @@ static void migrate_postcopy_prepare(GuestState *from, =20 do_migrate(from, to); =20 - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); } =20 static void migrate_postcopy_complete(GuestState *from, GuestState *to, @@ -1464,7 +1460,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, */ if (args->result =3D=3D MIG_TEST_SUCCEED) { qtest_qmp_assert_success(from->qs, "{ 'execute' : 'stop'}"); - if (!got_src_stop) { + if (!from->got_event) { qtest_qmp_eventwait(from->qs, "STOP"); } migrate_ensure_converge(from->qs); @@ -1484,10 +1480,10 @@ static void test_precopy_common(GuestState *from, G= uestState *to, if (args->live) { if (args->iterations) { while (args->iterations--) { - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); } } else { - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); } =20 migrate_ensure_converge(from->qs); @@ -1498,7 +1494,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, */ wait_for_migration_complete(from->qs); =20 - if (!got_src_stop) { + if (!from->got_event) { qtest_qmp_eventwait(from->qs, "STOP"); } } else { @@ -1513,7 +1509,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, qtest_qmp_assert_success(to->qs, "{ 'execute' : 'cont'}"); } =20 - if (!got_dst_resume) { + if (!to->got_event) { qtest_qmp_eventwait(to->qs, "RESUME"); } =20 @@ -1627,9 +1623,9 @@ static void test_ignore_shared(void) =20 do_migrate(from, to); =20 - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); =20 - if (!got_src_stop) { + if (!from->got_event) { qtest_qmp_eventwait(from->qs, "STOP"); } =20 @@ -2062,7 +2058,7 @@ static void test_migrate_auto_converge(void) break; } usleep(20); - g_assert_false(got_src_stop); + g_assert_false(from->got_event); } while (true); /* The first percentage of throttling should be at least init_pct */ g_assert_cmpint(percentage, >=3D, init_pct); @@ -2368,7 +2364,7 @@ static void test_multifd_tcp_cancel(void) =20 do_migrate(from, to); =20 - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); =20 migrate_cancel(from->qs); =20 @@ -2399,9 +2395,9 @@ static void test_multifd_tcp_cancel(void) =20 do_migrate(from, to2); =20 - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); =20 - if (!got_src_stop) { + if (!from->got_event) { qtest_qmp_eventwait(from->qs, "STOP"); } qtest_qmp_eventwait(to2->qs, "RESUME"); --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264709; cv=none; d=zohomail.com; s=zohoarc; b=FR018Z3eZ+Ie2Ysgk997xej6/uxL2J9MtNg4IcG0dBGw1Gw7pPaOTg5FCtFi2bqdG57/MdWXKwMopoFOqaEqcF1djm/BazhEN0rJhwd2Iy8gkqwH+2uCpFRGQ+RdXQo3R+ppmSLYEr6f4goTpJwuFTqLXkQ3cZg1rFij6MvSLbc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264709; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AjCaYmA+5Dzqw8dhZRmkI4HmuIl1PjkQQdmd4vUZDhE=; b=Xe5AXfq+4RznovOvmO4qh1NL+r27ShxVrnkJK8DerQx7rpE6SJk9FljPxj9LstNOsmFIbm8q38c2uOIHTSAFPXfRBAXWtQHe73a89q3IvQR8xOzVcBSTmV238dnpvC1ZlA0dSjq0H9Gww//YGd0JkUwtIXTIqH5MxOxVeA3MPjE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264709731486.39198626977; Thu, 8 Jun 2023 15:51:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTR-0006CT-Dp; Thu, 08 Jun 2023 18:51:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTP-0005ur-Fx for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTN-0005PK-8e for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:19 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-612-R-qqbPaKNpq1sfu9sq4d_g-1; Thu, 08 Jun 2023 18:51:13 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DDF7D85A5B5; Thu, 8 Jun 2023 22:51:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B67448205E; Thu, 8 Jun 2023 22:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AjCaYmA+5Dzqw8dhZRmkI4HmuIl1PjkQQdmd4vUZDhE=; b=VxeWeEkQSlVzjM04CZYLiXVJY239PshX9huc/lmDq8gY9SWDzQSqfy/qWkupthcQ+CyZEz qO6zT/1LiS9bNj1PWNQCj27p3FQtx65LD+mbRNU2FqMK/UUpH5Se5zY3Ejyw8C3zQmACXw 5G0vnqQuHVVe1dfJbzLSzrB+LPpwW8o= X-MC-Unique: R-qqbPaKNpq1sfu9sq4d_g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 38/42] migration-test: Create guest_realize() Date: Fri, 9 Jun 2023 00:49:39 +0200 Message-Id: <20230608224943.3877-39-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264710124100001 Content-Type: text/plain; charset="utf-8" So we can get rid of the duplication in test_migrate_start(). - unfold test_migrate_start() because it is just two calls to guest_realize(). - make dirty_limit test use guest_realize() - get rid of MigrateStart as now it is empty. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 147 +++++++++++++---------------------- 1 file changed, 54 insertions(+), 93 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index a96eb3eec7..29147b2be3 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -233,6 +233,39 @@ static void guest_destroy(GuestState *vm) g_free(vm); } =20 +static void guest_realize(GuestState *who) +{ + bool target =3D false; + if (strncmp(who->name, "target", strlen("target")) =3D=3D 0) { + target =3D true; + } + gchar * + cmd =3D g_strdup_printf("-accel kvm%s -accel tcg " + "-name %s,debug-threads=3Don " + "-m %s " + "-serial file:%s " + "%s %s " + "%s %s %s %s %s", + who->kvm_opts ? who->kvm_opts : "", + who->name, + who->memory_size, + who->serial_path, + target ? "-incoming" : "", + target ? who->uri ? who->uri : "defer" + : "", + who->arch_opts ? who->arch_opts : "", + target ? who->arch_target ? who->arch_target : "" + : who->arch_source ? who->arch_source : "= ", + who->shmem_opts ? who->shmem_opts : "", + who->extra_opts ? who->extra_opts : "", + who->hide_stderr ? who->hide_stderr : ""); + who->qs =3D qtest_init(cmd); + qtest_qmp_set_event_callback(who->qs, + target ? migrate_watch_for_resume + : migrate_watch_for_stop, + &who->got_event); +} + static void guest_use_dirty_ring(GuestState *vm) { g_assert(vm->kvm_opts =3D=3D NULL); @@ -674,11 +707,6 @@ static void do_migrate(GuestState *from, GuestState *t= o) } } =20 -typedef struct { - /* only launch the target process */ - bool only_target; -} MigrateStart; - /* * A hook that runs after the src and dst QEMUs have been * created, but before the migration is started. This can @@ -702,9 +730,6 @@ typedef void (*TestMigrateFinishHook)(GuestState *from,= GuestState *to, void *opaque); =20 typedef struct { - /* Optional: fine tune start parameters */ - MigrateStart start; - /* Optional: callback to run at start to set migration parameters */ TestMigrateStartHook start_hook; /* Optional: callback to run at finish to cleanup */ @@ -752,56 +777,6 @@ typedef struct { bool postcopy_preempt; } MigrateCommon; =20 -static void test_migrate_start(GuestState *from, GuestState *to, - MigrateStart *args) -{ - g_autofree gchar *cmd_source =3D NULL; - g_autofree gchar *cmd_target =3D NULL; - - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " - "-name %s,debug-threads=3Don " - "-m %s " - "-serial file:%s " - "%s %s %s %s %s", - from->kvm_opts ? from->kvm_opts : "", - from->name, - from->memory_size, - from->serial_path, - from->arch_opts ? from->arch_opts : "", - from->arch_source ? from->arch_source : "= ", - from->shmem_opts ? from->shmem_opts : "", - from->extra_opts ? from->extra_opts : "", - from->hide_stderr ? from->hide_stderr : "= "); - - if (!args->only_target) { - from->qs =3D qtest_init(cmd_source); - qtest_qmp_set_event_callback(from->qs, - migrate_watch_for_stop, - &from->got_event); - } - - cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " - "-name %s,debug-threads=3Don " - "-m %s " - "-serial file:%s " - "-incoming %s " - "%s %s %s %s %s", - to->kvm_opts ? to->kvm_opts : "", - to->name, - to->memory_size, - to->serial_path, - to->uri ? to->uri : "defer", - to->arch_opts ? to->arch_opts : "", - to->arch_target ? to->arch_target : "", - to->shmem_opts ? to->shmem_opts : "", - to->extra_opts ? to->extra_opts : "", - to->hide_stderr ? to->hide_stderr : ""); - to->qs =3D qtest_init(cmd_target); - qtest_qmp_set_event_callback(to->qs, - migrate_watch_for_resume, - &to->got_event); -} - static void test_migrate_end(GuestState *from, GuestState *to, bool test_d= est) { unsigned char dest_byte_a, dest_byte_b, dest_byte_c, dest_byte_d; @@ -1185,7 +1160,8 @@ static void migrate_postcopy_prepare(GuestState *from, MigrateCommon *args) { guest_listen_unix_socket(to); - test_migrate_start(from, to, &args->start); + guest_realize(from); + guest_realize(to); =20 if (args->start_hook) { args->postcopy_data =3D args->start_hook(from, to); @@ -1410,14 +1386,14 @@ static void test_postcopy_preempt_all(void) =20 static void test_baddest(void) { - MigrateStart args =3D { }; GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); =20 guest_hide_stderr(from); guest_hide_stderr(to); guest_set_uri(to, "tcp:127.0.0.1:0"); - test_migrate_start(from, to, &args); + guest_realize(from); + guest_realize(to); /* * Don't change to do_migrate(). We are using a wrong uri on purpose. */ @@ -1431,7 +1407,8 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, { void *data_hook =3D NULL; =20 - test_migrate_start(from, to, &args->start); + guest_realize(from); + guest_realize(to); =20 if (args->start_hook) { data_hook =3D args->start_hook(from, to); @@ -1608,12 +1585,12 @@ static void test_ignore_shared(void) { GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { }; =20 guest_use_shmem(from); guest_use_shmem(to); guest_listen_unix_socket(to); - test_migrate_start(from, to, &args); + guest_realize(from); + guest_realize(to); =20 migrate_set_capability(from->qs, "x-ignore-shared", true); migrate_set_capability(to->qs, "x-ignore-shared", true); @@ -1922,10 +1899,11 @@ static void test_migrate_fd_proto(void) #endif /* _WIN32 */ =20 static void do_test_validate_uuid(GuestState *from, GuestState *to, - MigrateStart *args, bool should_fail) + bool should_fail) { guest_listen_unix_socket(to); - test_migrate_start(from, to, args); + guest_realize(from); + guest_realize(to); =20 /* * UUID validation is at the begin of migration. So, the main process = of @@ -1954,48 +1932,44 @@ static void test_validate_uuid(void) { GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { }; =20 guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111"); guest_extra_opts(to, "-uuid 11111111-1111-1111-1111-111111111111"); - do_test_validate_uuid(from, to, &args, false); + do_test_validate_uuid(from, to, false); } =20 static void test_validate_uuid_error(void) { GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { }; =20 guest_hide_stderr(from); guest_hide_stderr(to); guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111"); guest_extra_opts(to, "-uuid 22222222-2222-2222-2222-222222222222"); - do_test_validate_uuid(from, to, &args, true); + do_test_validate_uuid(from, to, true); } =20 static void test_validate_uuid_src_not_set(void) { GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { }; =20 guest_hide_stderr(from); guest_hide_stderr(to); guest_extra_opts(to, "-uuid 22222222-2222-2222-2222-222222222222"); - do_test_validate_uuid(from, to, &args, false); + do_test_validate_uuid(from, to, false); } =20 static void test_validate_uuid_dst_not_set(void) { GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { }; =20 guest_hide_stderr(from); guest_hide_stderr(to); guest_extra_opts(from, "-uuid 11111111-1111-1111-1111-111111111111"); - do_test_validate_uuid(from, to, &args, false); + do_test_validate_uuid(from, to, false); } =20 /* @@ -2015,7 +1989,6 @@ static void test_validate_uuid_dst_not_set(void) */ static void test_migrate_auto_converge(void) { - MigrateStart args =3D {}; GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); int64_t percentage; @@ -2028,7 +2001,8 @@ static void test_migrate_auto_converge(void) const int64_t init_pct =3D 5, inc_pct =3D 25, max_pct =3D 95; =20 guest_listen_unix_socket(to); - test_migrate_start(from, to, &args); + guest_realize(from); + guest_realize(to); =20 migrate_set_capability(from->qs, "auto-converge", true); migrate_set_parameter_int(from->qs, "cpu-throttle-initial", init_pct); @@ -2336,7 +2310,6 @@ static void test_multifd_tcp_tls_x509_reject_anon_cli= ent(void) */ static void test_multifd_tcp_cancel(void) { - MigrateStart args =3D { }; GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); GuestState *to2 =3D guest_create("target2"); @@ -2344,7 +2317,8 @@ static void test_multifd_tcp_cancel(void) guest_hide_stderr(from); guest_hide_stderr(to); =20 - test_migrate_start(from, to, &args); + guest_realize(from); + guest_realize(to); =20 migrate_ensure_non_converge(from->qs); =20 @@ -2374,11 +2348,7 @@ static void test_multifd_tcp_cancel(void) =20 guest_destroy(to); =20 - args =3D (MigrateStart){ - .only_target =3D true, - }; - - test_migrate_start(from, to2, &args); + guest_realize(to2); =20 migrate_set_parameter_int(to2->qs, "multifd-channels", 16); =20 @@ -2542,17 +2512,8 @@ static GuestState *dirtylimit_start_vm(void) GuestState *vm =3D guest_create("dirtylimit-test"); =20 guest_use_dirty_ring(vm); + guest_realize(vm); =20 - g_autofree gchar * - cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " - "-name dirtylimit-test,debug-threads=3Don " - "-m 150M -smp 1 " - "-serial file:%s " - "-drive file=3D%s,format=3Draw ", - vm->serial_path, - bootpath); - - vm->qs =3D qtest_init(cmd); return vm; } =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264804; cv=none; d=zohomail.com; s=zohoarc; b=aUbIW+Cvb6ahdz7cJWRziuLKa2mbrPghel0gVlV9BLcwpwhQdmv4UfQkfFYXxLVBJacbpXkLeaJqg7xeVQmijf2wKhZTMT35E0bGkkVnnucbTTTSHLIh3PIO93lZeRaLRlliB4HYwj3GjtJw+eRfnccsDBKcfVd+kGjWOo7piWA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264804; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=avOz0bY4F3dSc+e/kGAWCAFrVyjMLSrlTsZ50TMKA3k=; b=c7jAK20Jx6/tUIRsUar04xoaBZVs49dYyZU8hF/MKAzUSE+HiTw+3PNDwd++k/L4A/LNWu4LG6j76eIgh677tauPw7znITpJcldzqqxc0eqVLz6AXGUmSvpdR8Pbh4U583MRliDfG+D44kfa5T0TrhtumX3IajrC8ncWUUPuQ4w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264804932155.5020312909345; Thu, 8 Jun 2023 15:53:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTT-0006L9-Lx; Thu, 08 Jun 2023 18:51:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTR-0006BV-97 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTO-0005Q5-Tp for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:20 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-446-W3MlQwrxOsWOa594OD6irQ-1; Thu, 08 Jun 2023 18:51:15 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5BB78007D9; Thu, 8 Jun 2023 22:51:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31E69492B00; Thu, 8 Jun 2023 22:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264678; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=avOz0bY4F3dSc+e/kGAWCAFrVyjMLSrlTsZ50TMKA3k=; b=MDeafryHMFtIzaqOeMKhxTlDLFmOeK1OBrAV0vowZeT9f6i3h+EoyQPIRl6dwJN/rRX4ZW g8RXa7Cm0LAveXATyBva7AxH6D+IZzrpsgbsDVgEoZq9gm5/aLdVVF6LACP9BG3z071M4k JACQzmlpfUND7YG8m6dmYPZlg6MD/Ns= X-MC-Unique: W3MlQwrxOsWOa594OD6irQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 39/42] migration-test: Unfold test_migrate_end() into three functions Date: Fri, 9 Jun 2023 00:49:40 +0200 Message-Id: <20230608224943.3877-40-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264806554100009 Content-Type: text/plain; charset="utf-8" guest_destroy(from) test_migrate_check(from, to): depending of test value guest_destroy(to); This mimics previous change that split test_migrate_start() Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 63 ++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 29147b2be3..1a03077166 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -777,33 +777,26 @@ typedef struct { bool postcopy_preempt; } MigrateCommon; =20 -static void test_migrate_end(GuestState *from, GuestState *to, bool test_d= est) +static void test_migrate_check(GuestState *from, GuestState *to) { unsigned char dest_byte_a, dest_byte_b, dest_byte_c, dest_byte_d; =20 - guest_destroy(from); + qtest_memread(to->qs, to->start_address, &dest_byte_a, 1); =20 - if (test_dest) { - qtest_memread(to->qs, to->start_address, &dest_byte_a, 1); + /* Destination still running, wait for a byte to change */ + do { + qtest_memread(to->qs, to->start_address, &dest_byte_b, 1); + usleep(1000 * 10); + } while (dest_byte_a =3D=3D dest_byte_b); =20 - /* Destination still running, wait for a byte to change */ - do { - qtest_memread(to->qs, to->start_address, &dest_byte_b, 1); - usleep(1000 * 10); - } while (dest_byte_a =3D=3D dest_byte_b); + qtest_qmp_assert_success(to->qs, "{ 'execute' : 'stop'}"); =20 - qtest_qmp_assert_success(to->qs, "{ 'execute' : 'stop'}"); - - /* With it stopped, check nothing changes */ - qtest_memread(to->qs, to->start_address, &dest_byte_c, 1); - usleep(1000 * 200); - qtest_memread(to->qs, to->start_address, &dest_byte_d, 1); - g_assert_cmpint(dest_byte_c, =3D=3D, dest_byte_d); - - check_guests_ram(to); - } - - guest_destroy(to); + /* With it stopped, check nothing changes */ + qtest_memread(to->qs, to->start_address, &dest_byte_c, 1); + usleep(1000 * 200); + qtest_memread(to->qs, to->start_address, &dest_byte_d, 1); + g_assert_cmpint(dest_byte_c, =3D=3D, dest_byte_d); + check_guests_ram(to); } =20 #ifdef CONFIG_GNUTLS @@ -1203,7 +1196,9 @@ static void migrate_postcopy_complete(GuestState *fro= m, GuestState *to, args->postcopy_data =3D NULL; } =20 - test_migrate_end(from, to, true); + guest_destroy(from); + test_migrate_check(from, to); + guest_destroy(to); } =20 static void test_postcopy_common(GuestState *from, GuestState *to, @@ -1399,7 +1394,8 @@ static void test_baddest(void) */ migrate_qmp(from->qs, "tcp:127.0.0.1:0", "{}"); wait_for_migration_fail(from->qs, false); - test_migrate_end(from, to, false); + guest_destroy(from); + guest_destroy(to); } =20 static void test_precopy_common(GuestState *from, GuestState *to, @@ -1497,7 +1493,11 @@ static void test_precopy_common(GuestState *from, Gu= estState *to, args->finish_hook(from, to, data_hook); } =20 - test_migrate_end(from, to, args->result =3D=3D MIG_TEST_SUCCEED); + guest_destroy(from); + if (args->result =3D=3D MIG_TEST_SUCCEED) { + test_migrate_check(from, to); + } + guest_destroy(to); } =20 static void test_precopy_unix_plain(void) @@ -1615,7 +1615,9 @@ static void test_ignore_shared(void) g_assert_cmpint( read_ram_property_int(from->qs, "transferred"), <, 1024 * 1024); =20 - test_migrate_end(from, to, true); + guest_destroy(from); + test_migrate_check(from, to); + guest_destroy(to); } =20 static void * @@ -1925,7 +1927,8 @@ static void do_test_validate_uuid(GuestState *from, G= uestState *to, wait_for_migration_complete(from->qs); } =20 - test_migrate_end(from, to, false); + guest_destroy(from); + guest_destroy(to); } =20 static void test_validate_uuid(void) @@ -2055,7 +2058,9 @@ static void test_migrate_auto_converge(void) wait_for_serial(to); wait_for_migration_complete(from->qs); =20 - test_migrate_end(from, to, true); + guest_destroy(from); + test_migrate_check(from, to); + guest_destroy(to); } =20 static void * @@ -2374,7 +2379,9 @@ static void test_multifd_tcp_cancel(void) =20 wait_for_serial(to2); wait_for_migration_complete(from->qs); - test_migrate_end(from, to2, true); + guest_destroy(from); + test_migrate_check(from, to2); + guest_destroy(to2); } =20 static void calc_dirty_rate(QTestState *who, uint64_t calc_time) --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264839; cv=none; d=zohomail.com; s=zohoarc; b=LrQkCtFlDiuF9922B1Ziu3qlLUbBhykZBMx9yArcsE4d/yq4iqsUq7LAcOD5MdYzeEfZiiGYeswdgqtMZO40FChExwbVjLmYDBJU+EOKd2RnCu1RPRj91hNDu0M0RtBSeJoU9WtOZtbFE5Fv67VnGWwgh+LcHC+rt+dJvj+sIns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264839; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gS+7Kp6/30cV/JTgNGb4o3ipG6V7VBAHBd4BKS+QWTQ=; b=XTJxC+n8TvfSpwu1xynjtHaF1qo4X2V49U2UVW+GKNx1u9wts3pkPv3qtcP34scZefUMzLIwwqXi66ZFTpK3IkRBjAeRkYfCR/uZ7zZRapzxVPLZQL7HRfEpI4Lb0XeRTywKWZVXfiZybU4pKi/bfB1YXz459VL4BE6QjDFDg2E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264839166794.0303907730056; Thu, 8 Jun 2023 15:53:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTT-0006LS-TS; Thu, 08 Jun 2023 18:51:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTS-0006Ht-N3 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTR-0005Qk-3M for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:22 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-124-e-UmFcl3OkSfD9uzsnQazQ-1; Thu, 08 Jun 2023 18:51:17 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CD1E82A59548; Thu, 8 Jun 2023 22:51:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A071492B00; Thu, 8 Jun 2023 22:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gS+7Kp6/30cV/JTgNGb4o3ipG6V7VBAHBd4BKS+QWTQ=; b=aFunP3BjZfVSr78Yix6o0KCdT9hka6MfGvSr9lQyOxWPKRmUdBMY9PMHprxO0sYiMyHeMF lcLOseMjSYKINaqqhSSy7CycRPQPmYmLztvuM327oEDULXeASdgh4nw2efyIAhrJolDZZB e8Cf5aCZY5/U50x/NwjiW4ulLLahiqg= X-MC-Unique: e-UmFcl3OkSfD9uzsnQazQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 40/42] migration-test: Create migrate_incoming() function Date: Fri, 9 Jun 2023 00:49:41 +0200 Message-Id: <20230608224943.3877-41-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264839768100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 1a03077166..d8479abb4a 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -684,6 +684,13 @@ static void migrate_set_capability(QTestState *who, co= nst char *capability, capability, value); } =20 +static void migrate_incoming(GuestState *who, const char *uri) +{ + qtest_qmp_assert_success(who->qs, "{ 'execute': 'migrate-incoming'," + " 'arguments': { 'uri': %s }}", uri); + guest_set_uri(who, uri); +} + static void migrate_postcopy_start(GuestState *from, GuestState *to) { qtest_qmp_assert_success(from->qs, @@ -1851,9 +1858,7 @@ static void *test_migrate_fd_start_hook(GuestState *f= rom, GuestState *to) close(pair[0]); =20 /* Start incoming migration from the 1st socket */ - qtest_qmp_assert_success(to->qs, "{ 'execute': 'migrate-incoming'," - " 'arguments': { 'uri': 'fd:fd-mig' }}"); - guest_set_uri(to, "fd:fd-mig"); + migrate_incoming(to, "fd:fd-mig"); =20 /* Send the 2nd socket to the target */ qtest_qmp_fds_assert_success(from->qs, &pair[1], 1, @@ -2077,9 +2082,7 @@ test_migrate_precopy_tcp_multifd_start_common(GuestSt= ate *from, GuestState *to, migrate_set_capability(to->qs, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - qtest_qmp_assert_success(to->qs, "{ 'execute': 'migrate-incoming'," - " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); - guest_set_uri(to, "tcp:127.0.0.1:0"); + migrate_incoming(to, "tcp:127.0.0.1:0"); =20 return NULL; } @@ -2334,9 +2337,7 @@ static void test_multifd_tcp_cancel(void) migrate_set_capability(to->qs, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - qtest_qmp_assert_success(to->qs, "{ 'execute': 'migrate-incoming'," - " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); - guest_set_uri(to, "tcp:127.0.0.1:0"); + migrate_incoming(to, "tcp:127.0.0.1:0"); =20 /* Wait for the first serial output from the source */ wait_for_serial(from); @@ -2360,9 +2361,7 @@ static void test_multifd_tcp_cancel(void) migrate_set_capability(to2->qs, "multifd", true); =20 /* Start incoming migration from the 1st socket */ - qtest_qmp_assert_success(to2->qs, "{ 'execute': 'migrate-incoming'," - " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); - guest_set_uri(to2, "tcp:127.0.0.1:0"); + migrate_incoming(to2, "tcp:127.0.0.1:0"); =20 wait_for_migration_status(from->qs, "cancelled", NULL); =20 --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264863; cv=none; d=zohomail.com; s=zohoarc; b=TnjQ29t/jG0tsXA/Lbvwiwmy7uTnpJkmowzXIB2NuLzI23YeOi+O6JGQpPIoKkLbybvmcXIpczv5BvgNbNGfSMwS5o5stD/OMuUcLU0ldnpvjRuWWLppYG5MpfGjH8ex2q25rsgcdTDekHhuV2HGIT5bw8noyDWh++XvclIMemg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264863; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Onx7hzdOZamKcksqH2V8dm73ESIZxV7rvSGJ9zpS7p4=; b=HkD/qTfvdG+PfGAmxLBcuiITbCnjEDep22Vv25Be061F4tzhJmbeDALvDzgLmPiFOdmZmILUspLJR88lvOdZ9F6E+yJV/ACPBBSMrxG/nmvTVrFsRcEtSqSPOJIpzp2jHxKJ7dcfoURk4mSUkiJUOSn9fRHS6ecpAn085EeRiaY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264863061535.9395395920196; Thu, 8 Jun 2023 15:54:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTf-0006S4-89; Thu, 08 Jun 2023 18:51:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTW-0006PS-8n for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTT-0005RM-98 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:25 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-Kc1SHNGwNB2VoRpyvP-Zqg-1; Thu, 08 Jun 2023 18:51:19 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E77DD802355; Thu, 8 Jun 2023 22:51:18 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2258E492B00; Thu, 8 Jun 2023 22:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264682; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Onx7hzdOZamKcksqH2V8dm73ESIZxV7rvSGJ9zpS7p4=; b=dDeyaryKODFAmqNT2CX/yj25un6ucKj2Jhn6Vyos53/TbqaDF7A/qTWeHxdNFjVQ5m4qki TOvihBCVqe7wDc1eA90coOGBYx9k+YjpH3H/H4z4AqYfDwO6z0wIiUjwhMhQwL2lhjsME8 TCm8XwHyc4I0h0b1VMTZ5ciShL6P7Vs= X-MC-Unique: Kc1SHNGwNB2VoRpyvP-Zqg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 41/42] migration-test: Move functions to migration-helpers.c Date: Fri, 9 Jun 2023 00:49:42 +0200 Message-Id: <20230608224943.3877-42-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264864598100003 Content-Type: text/plain; charset="utf-8" This will help on next patch to split vcpu-dirty-limit-test.c Signed-off-by: Juan Quintela --- tests/qtest/migration-helpers.h | 39 +++++ tests/qtest/migration-helpers.c | 242 +++++++++++++++++++++++++++++ tests/qtest/migration-test.c | 260 -------------------------------- 3 files changed, 281 insertions(+), 260 deletions(-) diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helper= s.h index 009e250e90..6096ffd82a 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -15,6 +15,8 @@ =20 #include "libqtest.h" =20 +extern char *tmpfs; + bool migrate_watch_for_stop(QTestState *who, const char *name, QDict *event, void *opaque); bool migrate_watch_for_resume(QTestState *who, const char *name, @@ -33,4 +35,41 @@ void wait_for_migration_complete(QTestState *who); =20 void wait_for_migration_fail(QTestState *from, bool allow_active); =20 +typedef struct { + QTestState *qs; + /* options for source and target */ + gchar *arch_opts; + gchar *arch_source; + gchar *arch_target; + const gchar *extra_opts; + const gchar *hide_stderr; + gchar *kvm_opts; + const gchar *memory_size; + /* + * name must *not* contain "target" if it is the target of a + * migration. + */ + const gchar *name; + gchar *serial_path; + gchar *shmem_opts; + gchar *shmem_path; + gchar *unix_socket; + gchar *uri; + unsigned start_address; + unsigned end_address; + bool got_event; +} GuestState; + +GuestState *guest_create(const char *name); +void guest_destroy(GuestState *vm); +void guest_realize(GuestState *who); +void guest_use_dirty_ring(GuestState *vm); + +void wait_for_serial(GuestState *vm); + +void bootfile_create(char *dir); +void bootfile_delete(void); + +bool kvm_dirty_ring_supported(void); + #endif /* MIGRATION_HELPERS_H */ diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index be00c52d00..ffdc689a88 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -13,8 +13,23 @@ #include "qemu/osdep.h" #include "qapi/qmp/qjson.h" =20 +#include "tests/migration/migration-test.h" #include "migration-helpers.h" =20 +#if defined(__linux__) +#include +#include +#include +#endif + +/* For dirty ring test; so far only x86_64 is supported */ +#if defined(__linux__) && defined(HOST_X86_64) +#include "linux/kvm.h" +#endif + +char *tmpfs; +static char *bootpath; + /* * Number of seconds we wait when looking for migration * status changes, to avoid test suite hanging forever @@ -180,3 +195,230 @@ void wait_for_migration_fail(QTestState *from, bool a= llow_active) g_assert(qdict_get_bool(rsp_return, "running")); qobject_unref(rsp_return); } + +/* The boot file modifies memory area in [start_address, end_address) + * repeatedly. It outputs a 'B' at a fixed rate while it's still running. + */ +#include "tests/migration/i386/a-b-bootblock.h" +#include "tests/migration/aarch64/a-b-kernel.h" +#include "tests/migration/s390x/a-b-bios.h" + +void bootfile_create(char *dir) +{ + const char *arch =3D qtest_get_arch(); + unsigned char *content; + size_t len; + + bootpath =3D g_strdup_printf("%s/bootsect", dir); + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + /* the assembled x86 boot sector should be exactly one sector larg= e */ + g_assert(sizeof(x86_bootsect) =3D=3D 512); + content =3D x86_bootsect; + len =3D sizeof(x86_bootsect); + } else if (g_str_equal(arch, "s390x")) { + content =3D s390x_elf; + len =3D sizeof(s390x_elf); + } else if (strcmp(arch, "ppc64") =3D=3D 0) { + /* + * sane architectures can be programmed at the boot prompt + */ + return; + } else if (strcmp(arch, "aarch64") =3D=3D 0) { + content =3D aarch64_kernel; + len =3D sizeof(aarch64_kernel); + g_assert(sizeof(aarch64_kernel) <=3D ARM_TEST_MAX_KERNEL_SIZE); + } else { + g_assert_not_reached(); + } + + FILE *bootfile =3D fopen(bootpath, "wb"); + + g_assert_cmpint(fwrite(content, len, 1, bootfile), =3D=3D, 1); + fclose(bootfile); +} + +void bootfile_delete(void) +{ + unlink(bootpath); + g_free(bootpath); + bootpath =3D NULL; +} + +GuestState *guest_create(const char *name) +{ + GuestState *vm =3D g_new0(GuestState, 1); + const char *arch =3D qtest_get_arch(); + + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + vm->memory_size =3D "150M"; + vm->arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw",= bootpath); + vm->start_address =3D X86_TEST_MEM_START; + vm->end_address =3D X86_TEST_MEM_END; + } else if (g_str_equal(arch, "s390x")) { + vm->memory_size =3D "128M"; + vm->arch_opts =3D g_strdup_printf("-bios %s", bootpath); + vm->start_address =3D S390_TEST_MEM_START; + vm->end_address =3D S390_TEST_MEM_END; + } else if (strcmp(arch, "ppc64") =3D=3D 0) { + vm->memory_size =3D "256M"; + vm->start_address =3D PPC_TEST_MEM_START; + vm->end_address =3D PPC_TEST_MEM_END; + vm->arch_source =3D g_strdup_printf( + "-prom-env 'use-nvramrc?=3Dtrue' -prom-env " + "'nvramrc=3Dhex .\" _\" begin %x %x " + "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " + "until'", vm->end_address, vm->start_address); + vm->arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); + } else if (strcmp(arch, "aarch64") =3D=3D 0) { + vm->memory_size =3D "150M"; + vm->arch_opts =3D g_strdup_printf( + "-machine virt,gic-version=3Dmax -cpu max -kernel %s", bootpat= h); + vm->start_address =3D ARM_TEST_MEM_START; + vm->end_address =3D ARM_TEST_MEM_END; + } else { + g_assert_not_reached(); + } + + vm->name =3D name; + vm->serial_path =3D g_strdup_printf("%s/%s", tmpfs, vm->name); + return vm; +} + +void guest_destroy(GuestState *vm) +{ + qtest_quit(vm->qs); + g_free(vm->arch_opts); + g_free(vm->arch_source); + g_free(vm->arch_target); + g_free(vm->kvm_opts); + unlink(vm->serial_path); + g_free(vm->serial_path); + g_free(vm->shmem_opts); + unlink(vm->shmem_path); + g_free(vm->shmem_path); + if (vm->unix_socket) { + unlink(vm->unix_socket); + g_free(vm->unix_socket); + } + g_free(vm->uri); + g_free(vm); +} + +void guest_realize(GuestState *who) +{ + bool target =3D false; + if (strncmp(who->name, "target", strlen("target")) =3D=3D 0) { + target =3D true; + } + gchar * + cmd =3D g_strdup_printf("-accel kvm%s -accel tcg " + "-name %s,debug-threads=3Don " + "-m %s " + "-serial file:%s " + "%s %s " + "%s %s %s %s %s", + who->kvm_opts ? who->kvm_opts : "", + who->name, + who->memory_size, + who->serial_path, + target ? "-incoming" : "", + target ? who->uri ? who->uri : "defer" + : "", + who->arch_opts ? who->arch_opts : "", + target ? who->arch_target ? who->arch_target : "" + : who->arch_source ? who->arch_source : "= ", + who->shmem_opts ? who->shmem_opts : "", + who->extra_opts ? who->extra_opts : "", + who->hide_stderr ? who->hide_stderr : ""); + who->qs =3D qtest_init(cmd); + qtest_qmp_set_event_callback(who->qs, + target ? migrate_watch_for_resume + : migrate_watch_for_stop, + &who->got_event); +} + +void guest_use_dirty_ring(GuestState *vm) +{ + g_assert(vm->kvm_opts =3D=3D NULL); + vm->kvm_opts =3D g_strdup(",dirty-ring-size=3D4096"); +} + +/* + * Wait for some output in the serial output file, + * we get an 'A' followed by an endless string of 'B's + * but on the destination we won't have the A. + */ +void wait_for_serial(GuestState *vm) +{ + FILE *serialfile =3D fopen(vm->serial_path, "r"); + const char *arch =3D qtest_get_arch(); + /* see serial_path comment on GuestState definition */ + int started =3D (strstr(vm->serial_path, "target") =3D=3D NULL && + strcmp(arch, "ppc64") =3D=3D 0) ? 0 : 1; + + do { + int readvalue =3D fgetc(serialfile); + + if (!started) { + /* SLOF prints its banner before starting test, + * to ignore it, mark the start of the test with '_', + * ignore all characters until this marker + */ + switch (readvalue) { + case '_': + started =3D 1; + break; + case EOF: + fseek(serialfile, 0, SEEK_SET); + usleep(1000); + break; + } + continue; + } + switch (readvalue) { + case 'A': + /* Fine */ + break; + + case 'B': + /* It's alive! */ + fclose(serialfile); + return; + + case EOF: + started =3D (strstr(vm->serial_path, "target") =3D=3D NULL && + strcmp(arch, "ppc64") =3D=3D 0) ? 0 : 1; + fseek(serialfile, 0, SEEK_SET); + usleep(1000); + break; + + default: + fprintf(stderr, "Unexpected %d on %s serial\n", readvalue, + vm->serial_path); + g_assert_not_reached(); + } + } while (true); +} + +bool kvm_dirty_ring_supported(void) +{ +#if defined(__linux__) && defined(HOST_X86_64) + int ret, kvm_fd =3D open("/dev/kvm", O_RDONLY); + + if (kvm_fd < 0) { + return false; + } + + ret =3D ioctl(kvm_fd, KVM_CHECK_EXTENSION, KVM_CAP_DIRTY_LOG_RING); + close(kvm_fd); + + /* We test with 4096 slots */ + if (ret < 4096) { + return false; + } + + return true; +#else + return false; +#endif +} diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index d8479abb4a..4d3321b7b3 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -35,11 +35,6 @@ # endif /* CONFIG_TASN1 */ #endif /* CONFIG_GNUTLS */ =20 -/* For dirty ring test; so far only x86_64 is supported */ -#if defined(__linux__) && defined(HOST_X86_64) -#include "linux/kvm.h" -#endif - static bool uffd_feature_thread_id; =20 /* @@ -97,181 +92,6 @@ static bool ufd_version_check(void) =20 #endif =20 -static char *tmpfs; -static char *bootpath; - -/* The boot file modifies memory area in [start_address, end_address) - * repeatedly. It outputs a 'B' at a fixed rate while it's still running. - */ -#include "tests/migration/i386/a-b-bootblock.h" -#include "tests/migration/aarch64/a-b-kernel.h" -#include "tests/migration/s390x/a-b-bios.h" - -static void bootfile_create(char *dir) -{ - const char *arch =3D qtest_get_arch(); - unsigned char *content; - size_t len; - - bootpath =3D g_strdup_printf("%s/bootsect", dir); - if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - /* the assembled x86 boot sector should be exactly one sector larg= e */ - g_assert(sizeof(x86_bootsect) =3D=3D 512); - content =3D x86_bootsect; - len =3D sizeof(x86_bootsect); - } else if (g_str_equal(arch, "s390x")) { - content =3D s390x_elf; - len =3D sizeof(s390x_elf); - } else if (strcmp(arch, "ppc64") =3D=3D 0) { - /* - * sane architectures can be programmed at the boot prompt - */ - return; - } else if (strcmp(arch, "aarch64") =3D=3D 0) { - content =3D aarch64_kernel; - len =3D sizeof(aarch64_kernel); - g_assert(sizeof(aarch64_kernel) <=3D ARM_TEST_MAX_KERNEL_SIZE); - } else { - g_assert_not_reached(); - } - - FILE *bootfile =3D fopen(bootpath, "wb"); - - g_assert_cmpint(fwrite(content, len, 1, bootfile), =3D=3D, 1); - fclose(bootfile); -} - -static void bootfile_delete(void) -{ - unlink(bootpath); - g_free(bootpath); - bootpath =3D NULL; -} - -typedef struct { - QTestState *qs; - /* options for source and target */ - gchar *arch_opts; - gchar *arch_source; - gchar *arch_target; - const gchar *extra_opts; - const gchar *hide_stderr; - gchar *kvm_opts; - const gchar *memory_size; - /* - * name must *not* contain "target" if it is the target of a - * migration. - */ - const gchar *name; - gchar *serial_path; - gchar *shmem_opts; - gchar *shmem_path; - gchar *unix_socket; - gchar *uri; - unsigned start_address; - unsigned end_address; - bool got_event; -} GuestState; - -static GuestState *guest_create(const char *name) -{ - GuestState *vm =3D g_new0(GuestState, 1); - const char *arch =3D qtest_get_arch(); - - if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - vm->memory_size =3D "150M"; - vm->arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw",= bootpath); - vm->start_address =3D X86_TEST_MEM_START; - vm->end_address =3D X86_TEST_MEM_END; - } else if (g_str_equal(arch, "s390x")) { - vm->memory_size =3D "128M"; - vm->arch_opts =3D g_strdup_printf("-bios %s", bootpath); - vm->start_address =3D S390_TEST_MEM_START; - vm->end_address =3D S390_TEST_MEM_END; - } else if (strcmp(arch, "ppc64") =3D=3D 0) { - vm->memory_size =3D "256M"; - vm->start_address =3D PPC_TEST_MEM_START; - vm->end_address =3D PPC_TEST_MEM_END; - vm->arch_source =3D g_strdup_printf( - "-prom-env 'use-nvramrc?=3Dtrue' -prom-env " - "'nvramrc=3Dhex .\" _\" begin %x %x " - "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " - "until'", vm->end_address, vm->start_address); - vm->arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); - } else if (strcmp(arch, "aarch64") =3D=3D 0) { - vm->memory_size =3D "150M"; - vm->arch_opts =3D g_strdup_printf( - "-machine virt,gic-version=3Dmax -cpu max -kernel %s", bootpat= h); - vm->start_address =3D ARM_TEST_MEM_START; - vm->end_address =3D ARM_TEST_MEM_END; - } else { - g_assert_not_reached(); - } - - vm->name =3D name; - vm->serial_path =3D g_strdup_printf("%s/%s", tmpfs, vm->name); - return vm; -} - -static void guest_destroy(GuestState *vm) -{ - qtest_quit(vm->qs); - g_free(vm->arch_opts); - g_free(vm->arch_source); - g_free(vm->arch_target); - g_free(vm->kvm_opts); - unlink(vm->serial_path); - g_free(vm->serial_path); - g_free(vm->shmem_opts); - unlink(vm->shmem_path); - g_free(vm->shmem_path); - if (vm->unix_socket) { - unlink(vm->unix_socket); - g_free(vm->unix_socket); - } - g_free(vm->uri); - g_free(vm); -} - -static void guest_realize(GuestState *who) -{ - bool target =3D false; - if (strncmp(who->name, "target", strlen("target")) =3D=3D 0) { - target =3D true; - } - gchar * - cmd =3D g_strdup_printf("-accel kvm%s -accel tcg " - "-name %s,debug-threads=3Don " - "-m %s " - "-serial file:%s " - "%s %s " - "%s %s %s %s %s", - who->kvm_opts ? who->kvm_opts : "", - who->name, - who->memory_size, - who->serial_path, - target ? "-incoming" : "", - target ? who->uri ? who->uri : "defer" - : "", - who->arch_opts ? who->arch_opts : "", - target ? who->arch_target ? who->arch_target : "" - : who->arch_source ? who->arch_source : "= ", - who->shmem_opts ? who->shmem_opts : "", - who->extra_opts ? who->extra_opts : "", - who->hide_stderr ? who->hide_stderr : ""); - who->qs =3D qtest_init(cmd); - qtest_qmp_set_event_callback(who->qs, - target ? migrate_watch_for_resume - : migrate_watch_for_stop, - &who->got_event); -} - -static void guest_use_dirty_ring(GuestState *vm) -{ - g_assert(vm->kvm_opts =3D=3D NULL); - vm->kvm_opts =3D g_strdup(",dirty-ring-size=3D4096"); -} - static void guest_use_shmem(GuestState *vm) { g_assert(vm->shmem_opts =3D=3D NULL); @@ -324,63 +144,6 @@ static void guest_set_uri(GuestState *vm, const gchar = *uri) vm->uri =3D g_strdup(uri); } =20 -/* - * Wait for some output in the serial output file, - * we get an 'A' followed by an endless string of 'B's - * but on the destination we won't have the A. - */ -static void wait_for_serial(GuestState *vm) -{ - FILE *serialfile =3D fopen(vm->serial_path, "r"); - const char *arch =3D qtest_get_arch(); - /* see serial_path comment on GuestState definition */ - int started =3D (strstr(vm->serial_path, "target") =3D=3D NULL && - strcmp(arch, "ppc64") =3D=3D 0) ? 0 : 1; - - do { - int readvalue =3D fgetc(serialfile); - - if (!started) { - /* SLOF prints its banner before starting test, - * to ignore it, mark the start of the test with '_', - * ignore all characters until this marker - */ - switch (readvalue) { - case '_': - started =3D 1; - break; - case EOF: - fseek(serialfile, 0, SEEK_SET); - usleep(1000); - break; - } - continue; - } - switch (readvalue) { - case 'A': - /* Fine */ - break; - - case 'B': - /* It's alive! */ - fclose(serialfile); - return; - - case EOF: - started =3D (strstr(vm->serial_path, "target") =3D=3D NULL && - strcmp(arch, "ppc64") =3D=3D 0) ? 0 : 1; - fseek(serialfile, 0, SEEK_SET); - usleep(1000); - break; - - default: - fprintf(stderr, "Unexpected %d on %s serial\n", readvalue, - vm->serial_path); - g_assert_not_reached(); - } - } while (true); -} - /* * It's tricky to use qemu's migration event capability with qtest, * events suddenly appearing confuse the qmp()/hmp() responses. @@ -2615,29 +2378,6 @@ static void test_vcpu_dirty_limit(void) dirtylimit_stop_vm(vm); } =20 -static bool kvm_dirty_ring_supported(void) -{ -#if defined(__linux__) && defined(HOST_X86_64) - int ret, kvm_fd =3D open("/dev/kvm", O_RDONLY); - - if (kvm_fd < 0) { - return false; - } - - ret =3D ioctl(kvm_fd, KVM_CHECK_EXTENSION, KVM_CAP_DIRTY_LOG_RING); - close(kvm_fd); - - /* We test with 4096 slots */ - if (ret < 4096) { - return false; - } - - return true; -#else - return false; -#endif -} - static bool shm_supported(void) { if (g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { --=20 2.40.1 From nobody Sat May 18 17:34:34 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686264872; cv=none; d=zohomail.com; s=zohoarc; b=TE+AwPg19++e71SghHFSjUg1vvkxq0SMD0ON2JmSnNNK/ENSkT7PCdbiTRoTm2LW8a48UHJ3rcnAOL5Csxj5gr1GBSTX0ee9/ymHrUEuzkocXkidOvZRb48Dd4Q8ip9j7HfgFWw/gEw2xg8hezED/3ivscdFcmf6t58v5rBb8ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686264872; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I49yc+YxU5BPDO2hrTM16dVAH3Ex2ds9hLfWn4wzWSU=; b=dUMtFH9CEkMcEJL3LXyWQtEerFk6oVWBuL8Xnn/0siiJ443naCdMWdbdQ2ZvVDz1Sx0ggvwVYPW5WTpN8mlu65W+kKbj7QKnhwNAh/eSD85A795s1JAxl+VnWG3iQKgwqs5k6+Sk+l5e7uRE0Q+9zFO8l17rGisdaSd+vniNIMA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1686264872158734.3211742288122; Thu, 8 Jun 2023 15:54:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTv-0006tb-3y; Thu, 08 Jun 2023 18:51:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTe-0006Xh-R5 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTa-0005Sr-Cp for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:32 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-615-v6sCr4EGPpuZglW8_Q90_g-1; Thu, 08 Jun 2023 18:51:28 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A8ECB1C05122; Thu, 8 Jun 2023 22:51:27 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 395E848205E; Thu, 8 Jun 2023 22:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I49yc+YxU5BPDO2hrTM16dVAH3Ex2ds9hLfWn4wzWSU=; b=iD8ooKdPZODd9Gn3NHQawU7Uv7VPJWce/QjYM8EHkAHu9CNWpBge4uZGWg6jRhe+WqgMjw oHMnDwCWKMmPNpha4khnidSpnE/uPHc9tqcKvmma9YAhPz92cWcZf5qsLdpNfKUi1fNhJc 4IfqQ0v70LvBPbxSn1TFknjqxky8GIA= X-MC-Unique: v6sCr4EGPpuZglW8_Q90_g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 42/42] migration-test: Split vcpu-dirty-limit-test Date: Fri, 9 Jun 2023 00:49:43 +0200 Message-Id: <20230608224943.3877-43-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686264874311100005 Content-Type: text/plain; charset="utf-8" It is not really a migration test, it just happens that migration infrastructure is useful to it. Once there, put migration-helpers.* as maintained. Signed-off-by: Juan Quintela --- MAINTAINERS | 3 +- tests/qtest/migration-test.c | 246 ---------------------- tests/qtest/vcpu-dirty-limit-test.c | 310 ++++++++++++++++++++++++++++ tests/qtest/meson.build | 5 +- 4 files changed, 316 insertions(+), 248 deletions(-) create mode 100644 tests/qtest/vcpu-dirty-limit-test.c diff --git a/MAINTAINERS b/MAINTAINERS index 436b3f0afe..20de5ae8b5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3176,7 +3176,8 @@ F: include/qemu/userfaultfd.h F: migration/ F: scripts/vmstate-static-checker.py F: tests/vmstate-static-checker-data/ -F: tests/qtest/migration-test.c +F: tests/qtest/migration-* +F: tests/qtest/vcpu-dirty-limit-test.c F: docs/devel/migration.rst F: qapi/migration.json F: tests/migration/ diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 4d3321b7b3..58bb829dcf 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -14,17 +14,11 @@ =20 #include "libqtest.h" #include "qapi/error.h" -#include "qapi/qmp/qdict.h" -#include "qemu/module.h" #include "qemu/option.h" -#include "qemu/range.h" #include "qemu/sockets.h" -#include "chardev/char.h" #include "qapi/qapi-visit-sockets.h" #include "qapi/qobject-input-visitor.h" -#include "qapi/qobject-output-visitor.h" #include "crypto/tlscredspsk.h" -#include "qapi/qmp/qlist.h" =20 #include "migration-helpers.h" #include "tests/migration/migration-test.h" @@ -37,12 +31,6 @@ =20 static bool uffd_feature_thread_id; =20 -/* - * Dirtylimit stop working if dirty page rate error - * value less than DIRTYLIMIT_TOLERANCE_RANGE - */ -#define DIRTYLIMIT_TOLERANCE_RANGE 25 /* MB/s */ - #if defined(__linux__) #include #include @@ -2146,238 +2134,6 @@ static void test_multifd_tcp_cancel(void) guest_destroy(to2); } =20 -static void calc_dirty_rate(QTestState *who, uint64_t calc_time) -{ - qtest_qmp_assert_success(who, - "{ 'execute': 'calc-dirty-rate'," - "'arguments': { " - "'calc-time': %" PRIu64 "," - "'mode': 'dirty-ring' }}", - calc_time); -} - -static QDict *query_dirty_rate(QTestState *who) -{ - return qtest_qmp_assert_success_ref(who, - "{ 'execute': 'query-dirty-rate' }= "); -} - -static void dirtylimit_set_all(QTestState *who, uint64_t dirtyrate) -{ - qtest_qmp_assert_success(who, - "{ 'execute': 'set-vcpu-dirty-limit'," - "'arguments': { " - "'dirty-rate': %" PRIu64 " } }", - dirtyrate); -} - -static void cancel_vcpu_dirty_limit(QTestState *who) -{ - qtest_qmp_assert_success(who, - "{ 'execute': 'cancel-vcpu-dirty-limit' }"); -} - -static QDict *query_vcpu_dirty_limit(QTestState *who) -{ - QDict *rsp; - - rsp =3D qtest_qmp(who, "{ 'execute': 'query-vcpu-dirty-limit' }"); - g_assert(!qdict_haskey(rsp, "error")); - g_assert(qdict_haskey(rsp, "return")); - - return rsp; -} - -static bool calc_dirtyrate_ready(QTestState *who) -{ - QDict *rsp_return; - gchar *status; - - rsp_return =3D query_dirty_rate(who); - g_assert(rsp_return); - - status =3D g_strdup(qdict_get_str(rsp_return, "status")); - g_assert(status); - - return g_strcmp0(status, "measuring"); -} - -static void wait_for_calc_dirtyrate_complete(QTestState *who, - int64_t time_s) -{ - int max_try_count =3D 10000; - usleep(time_s * 1000000); - - while (!calc_dirtyrate_ready(who) && max_try_count--) { - usleep(1000); - } - - /* - * Set the timeout with 10 s(max_try_count * 1000us), - * if dirtyrate measurement not complete, fail test. - */ - g_assert_cmpint(max_try_count, !=3D, 0); -} - -static int64_t get_dirty_rate(QTestState *who) -{ - QDict *rsp_return; - gchar *status; - QList *rates; - const QListEntry *entry; - QDict *rate; - int64_t dirtyrate; - - rsp_return =3D query_dirty_rate(who); - g_assert(rsp_return); - - status =3D g_strdup(qdict_get_str(rsp_return, "status")); - g_assert(status); - g_assert_cmpstr(status, =3D=3D, "measured"); - - rates =3D qdict_get_qlist(rsp_return, "vcpu-dirty-rate"); - g_assert(rates && !qlist_empty(rates)); - - entry =3D qlist_first(rates); - g_assert(entry); - - rate =3D qobject_to(QDict, qlist_entry_obj(entry)); - g_assert(rate); - - dirtyrate =3D qdict_get_try_int(rate, "dirty-rate", -1); - - qobject_unref(rsp_return); - return dirtyrate; -} - -static int64_t get_limit_rate(QTestState *who) -{ - QDict *rsp_return; - QList *rates; - const QListEntry *entry; - QDict *rate; - int64_t dirtyrate; - - rsp_return =3D query_vcpu_dirty_limit(who); - g_assert(rsp_return); - - rates =3D qdict_get_qlist(rsp_return, "return"); - g_assert(rates && !qlist_empty(rates)); - - entry =3D qlist_first(rates); - g_assert(entry); - - rate =3D qobject_to(QDict, qlist_entry_obj(entry)); - g_assert(rate); - - dirtyrate =3D qdict_get_try_int(rate, "limit-rate", -1); - - qobject_unref(rsp_return); - return dirtyrate; -} - -static GuestState *dirtylimit_start_vm(void) -{ - GuestState *vm =3D guest_create("dirtylimit-test"); - - guest_use_dirty_ring(vm); - guest_realize(vm); - - return vm; -} - -static void dirtylimit_stop_vm(GuestState *vm) -{ - guest_destroy(vm); -} - -static void test_vcpu_dirty_limit(void) -{ - int64_t origin_rate; - int64_t quota_rate; - int64_t rate ; - int max_try_count =3D 20; - int hit =3D 0; - - /* Start vm for vcpu dirtylimit test */ - GuestState *vm =3D dirtylimit_start_vm(); - - /* Wait for the first serial output from the vm*/ - wait_for_serial(vm); - - /* Do dirtyrate measurement with calc time equals 1s */ - calc_dirty_rate(vm->qs, 1); - - /* Sleep calc time and wait for calc dirtyrate complete */ - wait_for_calc_dirtyrate_complete(vm->qs, 1); - - /* Query original dirty page rate */ - origin_rate =3D get_dirty_rate(vm->qs); - - /* VM booted from bootsect should dirty memory steadily */ - assert(origin_rate !=3D 0); - - /* Setup quota dirty page rate at half of origin */ - quota_rate =3D origin_rate / 2; - - /* Set dirtylimit */ - dirtylimit_set_all(vm->qs, quota_rate); - - /* - * Check if set-vcpu-dirty-limit and query-vcpu-dirty-limit - * works literally - */ - g_assert_cmpint(quota_rate, =3D=3D, get_limit_rate(vm->qs)); - - /* Sleep a bit to check if it take effect */ - usleep(2000000); - - /* - * Check if dirtylimit take effect realistically, set the - * timeout with 20 s(max_try_count * 1s), if dirtylimit - * doesn't take effect, fail test. - */ - while (--max_try_count) { - calc_dirty_rate(vm->qs, 1); - wait_for_calc_dirtyrate_complete(vm->qs, 1); - rate =3D get_dirty_rate(vm->qs); - - /* - * Assume hitting if current rate is less - * than quota rate (within accepting error) - */ - if (rate < (quota_rate + DIRTYLIMIT_TOLERANCE_RANGE)) { - hit =3D 1; - break; - } - } - - g_assert_cmpint(hit, =3D=3D, 1); - - hit =3D 0; - max_try_count =3D 20; - - /* Check if dirtylimit cancellation take effect */ - cancel_vcpu_dirty_limit(vm->qs); - while (--max_try_count) { - calc_dirty_rate(vm->qs, 1); - wait_for_calc_dirtyrate_complete(vm->qs, 1); - rate =3D get_dirty_rate(vm->qs); - - /* - * Assume dirtylimit be canceled if current rate is - * greater than quota rate (within accepting error) - */ - if (rate > (quota_rate + DIRTYLIMIT_TOLERANCE_RANGE)) { - hit =3D 1; - break; - } - } - - g_assert_cmpint(hit, =3D=3D, 1); - dirtylimit_stop_vm(vm); -} - static bool shm_supported(void) { if (g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { @@ -2566,8 +2322,6 @@ int main(int argc, char **argv) if (g_str_equal(arch, "x86_64") && has_kvm && kvm_dirty_ring_supported= ()) { qtest_add_func("/migration/dirty_ring", test_precopy_unix_dirty_ring); - qtest_add_func("/migration/vcpu_dirty_limit", - test_vcpu_dirty_limit); } =20 ret =3D g_test_run(); diff --git a/tests/qtest/vcpu-dirty-limit-test.c b/tests/qtest/vcpu-dirty-l= imit-test.c new file mode 100644 index 0000000000..eebcf04509 --- /dev/null +++ b/tests/qtest/vcpu-dirty-limit-test.c @@ -0,0 +1,310 @@ +/* + * QTest testcase for vcpu-dirty-limit + * + * Copyright (c) 2016-2018 Red Hat, Inc. and/or its affiliates + * based on the vhost-user-test.c that is: + * Copyright (c) 2014 Virtual Open Systems Sarl. + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" + +#include "qemu/module.h" +#include "qapi/qmp/qlist.h" + +#include "migration-helpers.h" + +/* For dirty ring test */ +#if defined(__linux__) && defined(HOST_X86_64) +#include "linux/kvm.h" +#include +#endif + +/* + * Dirtylimit stop working if dirty page rate error + * value less than DIRTYLIMIT_TOLERANCE_RANGE + */ +#define DIRTYLIMIT_TOLERANCE_RANGE 25 /* MB/s */ + +static void calc_dirty_rate(QTestState *who, uint64_t calc_time) +{ + qtest_qmp_assert_success(who, + "{ 'execute': 'calc-dirty-rate'," + "'arguments': { " + "'calc-time': %" PRIu64 "," + "'mode': 'dirty-ring' }}", + calc_time); +} + +static QDict *query_dirty_rate(QTestState *who) +{ + return qtest_qmp_assert_success_ref(who, + "{ 'execute': 'query-dirty-rate' }= "); +} + +static void dirtylimit_set_all(QTestState *who, uint64_t dirtyrate) +{ + qtest_qmp_assert_success(who, + "{ 'execute': 'set-vcpu-dirty-limit'," + "'arguments': { " + "'dirty-rate': %" PRIu64 " } }", + dirtyrate); +} + +static void cancel_vcpu_dirty_limit(QTestState *who) +{ + qtest_qmp_assert_success(who, + "{ 'execute': 'cancel-vcpu-dirty-limit' }"); +} + +static QDict *query_vcpu_dirty_limit(QTestState *who) +{ + QDict *rsp; + + rsp =3D qtest_qmp(who, "{ 'execute': 'query-vcpu-dirty-limit' }"); + g_assert(!qdict_haskey(rsp, "error")); + g_assert(qdict_haskey(rsp, "return")); + + return rsp; +} + +static bool calc_dirtyrate_ready(QTestState *who) +{ + QDict *rsp_return; + gchar *status; + + rsp_return =3D query_dirty_rate(who); + g_assert(rsp_return); + + status =3D g_strdup(qdict_get_str(rsp_return, "status")); + g_assert(status); + + return g_strcmp0(status, "measuring"); +} + +static void wait_for_calc_dirtyrate_complete(QTestState *who, + int64_t time_s) +{ + int max_try_count =3D 10000; + usleep(time_s * 1000000); + + while (!calc_dirtyrate_ready(who) && max_try_count--) { + usleep(1000); + } + + /* + * Set the timeout with 10 s(max_try_count * 1000us), + * if dirtyrate measurement not complete, fail test. + */ + g_assert_cmpint(max_try_count, !=3D, 0); +} + +static int64_t get_dirty_rate(QTestState *who) +{ + QDict *rsp_return; + gchar *status; + QList *rates; + const QListEntry *entry; + QDict *rate; + int64_t dirtyrate; + + rsp_return =3D query_dirty_rate(who); + g_assert(rsp_return); + + status =3D g_strdup(qdict_get_str(rsp_return, "status")); + g_assert(status); + g_assert_cmpstr(status, =3D=3D, "measured"); + + rates =3D qdict_get_qlist(rsp_return, "vcpu-dirty-rate"); + g_assert(rates && !qlist_empty(rates)); + + entry =3D qlist_first(rates); + g_assert(entry); + + rate =3D qobject_to(QDict, qlist_entry_obj(entry)); + g_assert(rate); + + dirtyrate =3D qdict_get_try_int(rate, "dirty-rate", -1); + + qobject_unref(rsp_return); + return dirtyrate; +} + +static int64_t get_limit_rate(QTestState *who) +{ + QDict *rsp_return; + QList *rates; + const QListEntry *entry; + QDict *rate; + int64_t dirtyrate; + + rsp_return =3D query_vcpu_dirty_limit(who); + g_assert(rsp_return); + + rates =3D qdict_get_qlist(rsp_return, "return"); + g_assert(rates && !qlist_empty(rates)); + + entry =3D qlist_first(rates); + g_assert(entry); + + rate =3D qobject_to(QDict, qlist_entry_obj(entry)); + g_assert(rate); + + dirtyrate =3D qdict_get_try_int(rate, "limit-rate", -1); + + qobject_unref(rsp_return); + return dirtyrate; +} + +static GuestState *dirtylimit_start_vm(void) +{ + GuestState *vm =3D guest_create("dirtylimit-test"); + + guest_use_dirty_ring(vm); + guest_realize(vm); + + return vm; +} + +static void dirtylimit_stop_vm(GuestState *vm) +{ + guest_destroy(vm); +} + +static void test_vcpu_dirty_limit(void) +{ + int64_t origin_rate; + int64_t quota_rate; + int64_t rate ; + int max_try_count =3D 20; + int hit =3D 0; + + /* Start vm for vcpu dirtylimit test */ + GuestState *vm =3D dirtylimit_start_vm(); + + /* Wait for the first serial output from the vm*/ + wait_for_serial(vm); + + /* Do dirtyrate measurement with calc time equals 1s */ + calc_dirty_rate(vm->qs, 1); + + /* Sleep calc time and wait for calc dirtyrate complete */ + wait_for_calc_dirtyrate_complete(vm->qs, 1); + + /* Query original dirty page rate */ + origin_rate =3D get_dirty_rate(vm->qs); + + /* VM booted from bootsect should dirty memory steadily */ + assert(origin_rate !=3D 0); + + /* Setup quota dirty page rate at half of origin */ + quota_rate =3D origin_rate / 2; + + /* Set dirtylimit */ + dirtylimit_set_all(vm->qs, quota_rate); + + /* + * Check if set-vcpu-dirty-limit and query-vcpu-dirty-limit + * works literally + */ + g_assert_cmpint(quota_rate, =3D=3D, get_limit_rate(vm->qs)); + + /* Sleep a bit to check if it take effect */ + usleep(2000000); + + /* + * Check if dirtylimit take effect realistically, set the + * timeout with 20 s(max_try_count * 1s), if dirtylimit + * doesn't take effect, fail test. + */ + while (--max_try_count) { + calc_dirty_rate(vm->qs, 1); + wait_for_calc_dirtyrate_complete(vm->qs, 1); + rate =3D get_dirty_rate(vm->qs); + + /* + * Assume hitting if current rate is less + * than quota rate (within accepting error) + */ + if (rate < (quota_rate + DIRTYLIMIT_TOLERANCE_RANGE)) { + hit =3D 1; + break; + } + } + + g_assert_cmpint(hit, =3D=3D, 1); + + hit =3D 0; + max_try_count =3D 20; + + /* Check if dirtylimit cancellation take effect */ + cancel_vcpu_dirty_limit(vm->qs); + while (--max_try_count) { + calc_dirty_rate(vm->qs, 1); + wait_for_calc_dirtyrate_complete(vm->qs, 1); + rate =3D get_dirty_rate(vm->qs); + + /* + * Assume dirtylimit be canceled if current rate is + * greater than quota rate (within accepting error) + */ + if (rate > (quota_rate + DIRTYLIMIT_TOLERANCE_RANGE)) { + hit =3D 1; + break; + } + } + + g_assert_cmpint(hit, =3D=3D, 1); + dirtylimit_stop_vm(vm); +} + +int main(int argc, char **argv) +{ + g_autoptr(GError) err =3D NULL; + + g_test_init(&argc, &argv, NULL); + + if (!qtest_has_accel("kvm")) { + g_test_skip("No KVM or TCG accelerator available"); + return 0; + } + + if (!g_str_equal(qtest_get_arch(), "x86_64")) { + g_test_skip("Only x86_64 support available"); + return 0; + } + + if (!kvm_dirty_ring_supported()) { + g_test_skip("KVM dirty ring is not supported"); + return 0; + } + + tmpfs =3D g_dir_make_tmp("vcpu-dirty-limit-test-XXXXXX", &err); + if (!tmpfs) { + g_test_message("Can't create temporary directory in %s: %s", + g_get_tmp_dir(), err->message); + } + g_assert(tmpfs); + bootfile_create(tmpfs); + + module_call_init(MODULE_INIT_QOM); + + qtest_add_func("/vcpu_dirty_limit/basic", test_vcpu_dirty_limit); + + int ret =3D g_test_run(); + + g_assert_cmpint(ret, =3D=3D, 0); + + bootfile_delete(); + ret =3D rmdir(tmpfs); + if (ret !=3D 0) { + g_test_message("unable to rmdir: path (%s): %s", + tmpfs, strerror(errno)); + } + g_free(tmpfs); + + return ret; +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 5fa6833ad7..ed0d03e3d3 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -9,6 +9,7 @@ slow_qtests =3D { 'qos-test' : 60, 'qom-test' : 300, 'test-hmp' : 120, + 'vcpu-dirty-limit' : 150, } =20 qtests_generic =3D [ @@ -101,7 +102,8 @@ qtests_i386 =3D \ 'vmgenid-test', 'migration-test', 'test-x86-cpuid-compat', - 'numa-test' + 'numa-test', + 'vcpu-dirty-limit-test', ] =20 if dbus_display and targetos !=3D 'windows' @@ -315,6 +317,7 @@ qtests =3D { 'tpm-tis-device-test': [io, tpmemu_files, 'tpm-tis-util.c'], 'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'), 'netdev-socket': files('netdev-socket.c', '../unit/socket-helpers.c'), + 'vcpu-dirty-limit-test': migration_files, } =20 if vnc.found() --=20 2.40.1