Received: by 2002:a17:906:cf90:b0:9bd:85f7:2662 with SMTP id um16csp1027591ejb; Thu, 19 Oct 2023 23:59:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJRF87J1Wyvdyu/i9rBn4Ky8HPwqIrqqSFxeWoVhRktz3fMX4A14I54Xf9WyspRLvAfzG4 X-Received: by 2002:a05:622a:1701:b0:41c:c85e:a4ac with SMTP id h1-20020a05622a170100b0041cc85ea4acmr1224605qtk.61.1697785191161; Thu, 19 Oct 2023 23:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697785191; cv=none; d=google.com; s=arc-20160816; b=HHzZOYJu549n84gNfOiKQ+KSBDZM/zawz9k+ItLjeGXUWru8LGrA9CMVk5LqROkckl 4NeM2zgJ72YDPn/27o75kCigv0rYQd5kNtqyCHWYiwpNOpYPPSnmLhe5BOkwkWj1524q I3KE6hW17TUWeI8Vti6Gou+dCGUmcBGPD8PjSHoTxgn7PM90dQDoK0OSh7lPXVcqVgb9 YiLhmt0L0rzD4JmjpXtGar42R3qOWlXsE8fgFxEyQTIciEru3+Tf8Mtcblb/yyunZmc4 Fuy1mkj7imBhzgXkUT8Io5+GZNM7eWVR1fqiiuamowdvOUIUtkfq0bIWGwIZvFvMLdpQ w+VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=s8q34WPeVwwWmtWZXJNkr41CpA/2YBdbzKgCn8LRZ9E=; fh=fTjRJWWf32rfQWm8ROIsswmsB54Y1g6a+adPg1wBxPA=; b=YB74z/LGaqn/+qndSP71oQrdGtFYGDceBF+vxmFlawP+nSwZZ9sW8CNJZpVmj6mJaN 0uv/Y+TU7MKGdAUFvodCefUyKCe3F4C7sNnPS+lHfyaDjkauo/XaQCgr7ERF8QilTpTa Brp7dvPFxUEM5q3W3IWtPvghzHNTQ8T+Wpadx6/hh3djTV1ZMvrK9Q5KJdbE+CNuYpN6 xkbOz8bNpWDPTjeycvYeFjLCkSSag5OCmn3cPlZ6h2kiOJ2oz4zoBm7zNefUb9honxo3 6e3NDtuqMR+zD1miV8kmKwZgFYG9KLMn7qRKztexyIZtGA9Ut3KudYMPg3ola8CA58qe ls1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PzuxPmA5; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g16-20020ac85810000000b0041964cad786si852598qtg.141.2023.10.19.23.59.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Oct 2023 23:59:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PzuxPmA5; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtjTs-0004oe-5z; Fri, 20 Oct 2023 02:59:37 -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 1qtjTn-0004eM-B6 for qemu-arm@nongnu.org; Fri, 20 Oct 2023 02:59:31 -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 1qtjTi-0003oX-25 for qemu-arm@nongnu.org; Fri, 20 Oct 2023 02:59:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697785165; 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=s8q34WPeVwwWmtWZXJNkr41CpA/2YBdbzKgCn8LRZ9E=; b=PzuxPmA5yct9tdlAoJorKWI7ZJ4rCxoagjl3WNxtuNsMdVWp7bRaRLi4i/WvhlZw70DwqX JkwZdZC2id6A2rHpeyy4yCq5N4wqmRdaemU+eHzgrjI6wXyfYl6wI3DxShlt4GpyCxpcl0 pmi82GfNHV4vXiS6FQZ4kWWaEAWoh+A= Received: from mimecast-mx02.redhat.com (mx-ext.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-78-GTfhQzdOOVuShxXLwSW9xA-1; Fri, 20 Oct 2023 02:59:20 -0400 X-MC-Unique: GTfhQzdOOVuShxXLwSW9xA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 82BB238116F3; Fri, 20 Oct 2023 06:59:18 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5C8625C0; Fri, 20 Oct 2023 06:59:11 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-s390x@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Halil Pasic , "Denis V. Lunev" , Juan Quintela , Fam Zheng , kvm@vger.kernel.org, Harsh Prateek Bora , Nicholas Piggin , Christian Borntraeger , Eric Farman , Kevin Wolf , David Hildenbrand , Jason Wang , Sunil Muthuswamy , David Gibson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Stefan Hajnoczi , Jagannathan Raman , qemu-arm@nongnu.org, Alex Williamson , Reinoud Zandijk , Thomas Huth , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Paolo Bonzini , "Michael S. Tsirkin" , Elena Ufimtseva , qemu-ppc@nongnu.org, Ilya Leoshkevich , Stefan Berger , Stefan Weil , Peter Xu , Christian Schoenebeck , Peter Maydell , Gerd Hoffmann , Richard Henderson , Jeff Cody , Laurent Vivier , Hanna Reitz , Marcelo Tosatti , Leonardo Bras , Fabiano Rosas , Daniel Henrique Barboza , Greg Kurz , qemu-block@nongnu.org Subject: [PULL 11/17] tests/qtest/migration: Introduce find_common_machine_version Date: Fri, 20 Oct 2023 08:57:45 +0200 Message-ID: <20231020065751.26047-12-quintela@redhat.com> In-Reply-To: <20231020065751.26047-1-quintela@redhat.com> References: <20231020065751.26047-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@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-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org X-TUID: BN0Jn1yzuZqt From: Fabiano Rosas When using two different QEMU binaries for migration testing, we'll need to find what is the machine version that will work with both binaries. Add a helper for that. Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth Signed-off-by: Fabiano Rosas Signed-off-by: Juan Quintela Message-ID: <20231018192741.25885-7-farosas@suse.de> --- tests/qtest/migration-helpers.h | 2 ++ tests/qtest/migration-helpers.c | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h index 4f51d0f8bc..d1c2351d33 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -43,4 +43,6 @@ void wait_for_migration_complete(QTestState *who); void wait_for_migration_fail(QTestState *from, bool allow_active); +char *find_common_machine_version(const char *mtype, const char *var1, + const char *var2); #endif /* MIGRATION_HELPERS_H */ diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c index 0c185db450..13449c1fe1 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -240,3 +240,29 @@ void wait_for_migration_fail(QTestState *from, bool allow_active) g_assert(qdict_get_bool(rsp_return, "running")); qobject_unref(rsp_return); } + +char *find_common_machine_version(const char *mtype, const char *var1, + const char *var2) +{ + g_autofree char *type1 = qtest_resolve_machine_alias(var1, mtype); + g_autofree char *type2 = qtest_resolve_machine_alias(var2, mtype); + + g_assert(type1 && type2); + + if (g_str_equal(type1, type2)) { + /* either can be used */ + return g_strdup(type1); + } + + if (qtest_has_machine_with_env(var2, type1)) { + return g_strdup(type1); + } + + if (qtest_has_machine_with_env(var1, type2)) { + return g_strdup(type2); + } + + g_test_message("No common machine version for machine type '%s' between " + "binaries %s and %s", mtype, getenv(var1), getenv(var2)); + g_assert_not_reached(); +} -- 2.41.0