From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657348; cv=none; d=zohomail.com; s=zohoarc; b=ZvHGsvwAIpLIU+Gu/GJC6NTkxu+DrcwtpJC8UK1xu/Q+qoC+EX+2E7ZmVu6zwZga3rvv8Oa7POk7uqBxrmMLnGu/kLYZSJ27F7e2I3+Pm3DPoob+NO58t+T8fa41upcMHqXMkZOmmCbFoMS2HIFfJFa3fDzKwnWfiov42+9gzLE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657348; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SuaAdA4r6gvUGRgqcCXCJsIKiI0xZQxmNEMBPAibCFg=; b=G54AKf48X32JPvCV2UIoeoBHmgR3cdQ1k95TKcrXIU7YnzIIRVZpQVWAK7ZfIc8uPHHLbSNubqOUk0xRAKGgqxnYorajgca79Zqj/nOX9bgqqqxUFFiYEK3GUZCv0tZGbNhBYSfpYusGc3nuDoHScnB6Q8W3w/4XxNwDr2W5Rdo= 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 1697657348692194.32562475065401; Wed, 18 Oct 2023 12:29:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCCw-0003H9-AO; Wed, 18 Oct 2023 15:27:54 -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 1qtCCu-0003GI-FW for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:27:52 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCCs-00053H-Tl for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:27:52 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0E61F1F88B; Wed, 18 Oct 2023 19:27:49 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 75115139E0; Wed, 18 Oct 2023 19:27:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id mKH3D7IxMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:27:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657269; h=from:from:reply-to: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=SuaAdA4r6gvUGRgqcCXCJsIKiI0xZQxmNEMBPAibCFg=; b=0fUW3sMYCcAb+qf8TPPdGAr6KfLH1gIo0Zs3jPA9HWjTch/ztaoE7gQcaDLTpA9EzGYXDI E7sGORj0sWGQd8cwZMZdwWNNK+HlOZdx1J/om7NHNlMeenEUJ/0OqZVIeENn+dOzlzWe6j ClYOJg+sygOtx723jso48q324FCVdKM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657269; h=from:from:reply-to: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=SuaAdA4r6gvUGRgqcCXCJsIKiI0xZQxmNEMBPAibCFg=; b=mopMeytWx+XkZtERxELAN8j1QV1S866WXXhT0Hsr6D9bpWubRS6G/THq8lR3i0Vu1rGoXh ob8sd00w5aPId/DQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 01/12] tests/qtest: Allow qtest_qemu_binary to use a custom environment variable Date: Wed, 18 Oct 2023 16:27:30 -0300 Message-Id: <20231018192741.25885-2-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -1.11 X-Spamd-Result: default: False [-1.11 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.01)[95.13%] 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=195.135.220.29; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657350600100003 Content-Type: text/plain; charset="utf-8" We're adding support for testing migration using two different QEMU binaries. We'll provide the second binary in a new environment variable. Allow qtest_qemu_binary() to receive the name of the new variable. If the new environment variable is not set, that's not an error, we use QTEST_QEMU_BINARY as a fallback. Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth Signed-off-by: Fabiano Rosas --- tests/qtest/libqtest.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index dc7a55634c..03fa644663 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -336,10 +336,17 @@ void qtest_remove_abrt_handler(void *data) } } =20 -static const char *qtest_qemu_binary(void) +static const char *qtest_qemu_binary(const char *var) { const char *qemu_bin; =20 + if (var) { + qemu_bin =3D getenv(var); + if (qemu_bin) { + return qemu_bin; + } + } + qemu_bin =3D getenv("QTEST_QEMU_BINARY"); if (!qemu_bin) { fprintf(stderr, "Environment variable QTEST_QEMU_BINARY required\n= "); @@ -392,7 +399,7 @@ static QTestState *G_GNUC_PRINTF(1, 2) qtest_spawn_qemu= (const char *fmt, ...) =20 va_start(ap, fmt); g_string_append_printf(command, CMD_EXEC "%s %s", - qtest_qemu_binary(), tracearg); + qtest_qemu_binary(NULL), tracearg); g_string_append_vprintf(command, fmt, ap); va_end(ap); =20 @@ -905,7 +912,7 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...) =20 const char *qtest_get_arch(void) { - const char *qemu =3D qtest_qemu_binary(); + const char *qemu =3D qtest_qemu_binary(NULL); const char *end =3D strrchr(qemu, '-'); =20 if (!end) { --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657307; cv=none; d=zohomail.com; s=zohoarc; b=U+2wJy1d1eTXeRGW+vSJ9NJFSQnpMP9vY912yN1O4KXAHbkyMSW6TbWDzhXQoo7r0xUeJBCvJ0GazSBVGAemPCoLErr99yUaR2TSyHkT8Qu9gvyE7u2uUL3lxrTbSmEQxRZl7Zre35RFs00drxgh5NGvIAq4xtg2DadukdikmuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657307; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/su5oRxxCXyKrkU9tRrJPLGJd50wzpve6n0CU3fkfjc=; b=bthcViC8QIeLVyImYAMmQKo8LnDbXAgAofShpsi55h6fXqqTxcdM+M7uxzN+rF+p3GEZCB93LIeFSb2HRnSfCaovWUTkxciqw0xmTKDoKOtHMjZSeZ3N3WLf7hKaJg90+kqTFLxfrYLWihAH/JwT4sU7/V8CX63YTvtIHSuAsZU= 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 1697657307727161.91793958253572; Wed, 18 Oct 2023 12:28:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCCy-0003I0-NX; Wed, 18 Oct 2023 15:27: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 1qtCCx-0003HZ-JV for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:27:55 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCCv-00053j-Ht for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:27:55 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EDE7021B6E; Wed, 18 Oct 2023 19:27:51 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6CCBB13780; Wed, 18 Oct 2023 19:27:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GMnyDbUxMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:27:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657271; h=from:from:reply-to: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=/su5oRxxCXyKrkU9tRrJPLGJd50wzpve6n0CU3fkfjc=; b=qLR7RLYNrRbbqUbOzCxWWHhZEtdT8zLr66ZAykZvNNU9Pkc07Eoa5463tRJRARZVNG7zDb ZPtMXDLTLnjlRJwqmxorWnIJTA2djb7IfUNLGinnPLAw9vM4ULvJwIbAsCU0vcLBMkrzxO WxtAh5HHoYCMqwCPvBPIHjLo98poNPk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657271; h=from:from:reply-to: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=/su5oRxxCXyKrkU9tRrJPLGJd50wzpve6n0CU3fkfjc=; b=LwQEbjLOjjhSSnEJQcFOrYZ4O2DvRa3ASeJqLIKQUM2nlxHVKjbUTX/2Q6UIdCwWbROGQa k1DoW6mC7/xa2VDw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 02/12] tests/qtest: Introduce qtest_init_with_env Date: Wed, 18 Oct 2023 16:27:31 -0300 Message-Id: <20231018192741.25885-3-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -2.10 X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] 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=195.135.220.28; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657308805100002 Content-Type: text/plain; charset="utf-8" Add a version of qtest_init() that takes an environment variable containing the path of the QEMU binary. This allows tests to use more than one QEMU binary. If no variable is provided or the environment variable does not exist, that is not an error. Fallback to using QTEST_QEMU_BINARY. Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth --- tests/qtest/libqtest.c | 26 +++++++++++++++++++------- tests/qtest/libqtest.h | 13 +++++++++++++ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 03fa644663..9eebba8767 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -388,7 +388,8 @@ static pid_t qtest_create_process(char *cmd) } #endif /* _WIN32 */ =20 -static QTestState *G_GNUC_PRINTF(1, 2) qtest_spawn_qemu(const char *fmt, .= ..) +static QTestState *G_GNUC_PRINTF(2, 3) qtest_spawn_qemu(const char *qemu_b= in, + const char *fmt, .= ..) { va_list ap; QTestState *s =3D g_new0(QTestState, 1); @@ -398,8 +399,7 @@ static QTestState *G_GNUC_PRINTF(1, 2) qtest_spawn_qemu= (const char *fmt, ...) g_autoptr(GString) command =3D g_string_new(""); =20 va_start(ap, fmt); - g_string_append_printf(command, CMD_EXEC "%s %s", - qtest_qemu_binary(NULL), tracearg); + g_string_append_printf(command, CMD_EXEC "%s %s", qemu_bin, tracearg); g_string_append_vprintf(command, fmt, ap); va_end(ap); =20 @@ -438,7 +438,8 @@ static QTestState *G_GNUC_PRINTF(1, 2) qtest_spawn_qemu= (const char *fmt, ...) return s; } =20 -QTestState *qtest_init_without_qmp_handshake(const char *extra_args) +static QTestState *qtest_init_internal(const char *qemu_bin, + const char *extra_args) { QTestState *s; int sock, qmpsock, i; @@ -463,7 +464,8 @@ QTestState *qtest_init_without_qmp_handshake(const char= *extra_args) sock =3D init_socket(socket_path); qmpsock =3D init_socket(qmp_socket_path); =20 - s =3D qtest_spawn_qemu("-qtest unix:%s " + s =3D qtest_spawn_qemu(qemu_bin, + "-qtest unix:%s " "-qtest-log %s " "-chardev socket,path=3D%s,id=3Dchar0 " "-mon chardev=3Dchar0,mode=3Dcontrol " @@ -516,9 +518,14 @@ QTestState *qtest_init_without_qmp_handshake(const cha= r *extra_args) return s; } =20 -QTestState *qtest_init(const char *extra_args) +QTestState *qtest_init_without_qmp_handshake(const char *extra_args) { - QTestState *s =3D qtest_init_without_qmp_handshake(extra_args); + return qtest_init_internal(qtest_qemu_binary(NULL), extra_args); +} + +QTestState *qtest_init_with_env(const char *var, const char *extra_args) +{ + QTestState *s =3D qtest_init_internal(qtest_qemu_binary(var), extra_ar= gs); QDict *greeting; =20 /* Read the QMP greeting and then do the handshake */ @@ -529,6 +536,11 @@ QTestState *qtest_init(const char *extra_args) return s; } =20 +QTestState *qtest_init(const char *extra_args) +{ + return qtest_init_with_env(NULL, extra_args); +} + QTestState *qtest_vinitf(const char *fmt, va_list ap) { char *args =3D g_strdup_vprintf(fmt, ap); diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index 5fe3d13466..76fc195f1c 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -55,6 +55,19 @@ QTestState *qtest_vinitf(const char *fmt, va_list ap) G_= GNUC_PRINTF(1, 0); */ QTestState *qtest_init(const char *extra_args); =20 +/** + * qtest_init_with_env: + * @var: Environment variable from where to take the QEMU binary + * @extra_args: Other arguments to pass to QEMU. CAUTION: these + * arguments are subject to word splitting and shell evaluation. + * + * Like qtest_init(), but use a different environment variable for the + * QEMU binary. + * + * Returns: #QTestState instance. + */ +QTestState *qtest_init_with_env(const char *var, const char *extra_args); + /** * qtest_init_without_qmp_handshake: * @extra_args: other arguments to pass to QEMU. CAUTION: these --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657388; cv=none; d=zohomail.com; s=zohoarc; b=HSOSL1rJJMq6WSQR27LHmtGrKZt6nVRhhUuIvIIXXEGnNEeT41TRZMzxvlyv0JYKCQ2eAKwxUVmdEMZRVTBqC+7xt8UOVODDKkvxhgJGk4ZXEycCxJ3uyt0TUTpEbelI/3FJKRJ7HfOH/gAWIhL4tEXmg5+29m5GcHL2csoFHiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657388; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LTkMFah9Q0ALD9A1kKvXuweVQgAvBfi4eSpOb8dEb5Q=; b=GEsD7QSTSRGqOjnO3cZY1sYP67n3baAe5b63CleCGZ9Hqm9MIGkG3rfzWdHdBpEKhpCiY4xhAEKG2Marh6OeEESlJeADNyeV+A2njZ7UJV1/iGuV7UeR/ozXu8LswVxz0v2EFv1i1HIYAIdxzou6q7ggUwIC7qBnKxGSbqeqDhk= 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 1697657388152205.59773933365761; Wed, 18 Oct 2023 12:29:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCD2-0003It-BK; Wed, 18 Oct 2023 15:28:00 -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 1qtCD0-0003IJ-JN for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:27:58 -0400 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCCz-00053u-3K for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:27:58 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DE1D821BB1; Wed, 18 Oct 2023 19:27:54 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6050813780; Wed, 18 Oct 2023 19:27:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gAhEC7gxMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:27:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657274; h=from:from:reply-to: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=LTkMFah9Q0ALD9A1kKvXuweVQgAvBfi4eSpOb8dEb5Q=; b=Ojvp9s8lJAGlwMcmkiRFh8kNpjrZHm5CbHbbJUkmEFUydMXCF9DYsCijclafk2GT+2e4mt 42Xvc5+ko5EVJnwDbBjnwXRD5XLnhpuA+k7B/nLIG4xGVWaJ3psq+BYVYhgIQn7EcceSMp 27Yiop4YBIpBJ+8ay0/SegNIdrFpAt0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657274; h=from:from:reply-to: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=LTkMFah9Q0ALD9A1kKvXuweVQgAvBfi4eSpOb8dEb5Q=; b=a5p1ee0g011J1l+6cjJ/gapcCHsQW+c2LNdyxZ5+3ZGRCSnFK8GA3syFDBOhLYI5mcpjXH Zs1xlHY8xOn7YvAw== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 03/12] tests/qtest: Allow qtest_get_machines to use an alternate QEMU binary Date: Wed, 18 Oct 2023 16:27:32 -0300 Message-Id: <20231018192741.25885-4-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -1.13 X-Spamd-Result: default: False [-1.13 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.03)[95.25%] 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=2001:67c:2178:6::1c; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657388845100009 Content-Type: text/plain; charset="utf-8" We're adding support for using more than one QEMU binary in tests. Modify qtest_get_machines() to take an environment variable that contains the QEMU binary path. Since the function keeps a cache of the machines list in the form of a static variable, refresh it any time the environment variable changes. Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth Signed-off-by: Fabiano Rosas --- tests/qtest/libqtest.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 9eebba8767..3cc7bf3076 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1468,13 +1468,26 @@ struct MachInfo { char *alias; }; =20 +static void qtest_free_machine_list(struct MachInfo *machines) +{ + if (machines) { + for (int i =3D 0; machines[i].name !=3D NULL; i++) { + g_free(machines[i].name); + g_free(machines[i].alias); + } + + g_free(machines); + } +} + /* * Returns an array with pointers to the available machine names. * The terminating entry has the name set to NULL. */ -static struct MachInfo *qtest_get_machines(void) +static struct MachInfo *qtest_get_machines(const char *var) { static struct MachInfo *machines; + static char *qemu_var; QDict *response, *minfo; QList *list; const QListEntry *p; @@ -1483,11 +1496,19 @@ static struct MachInfo *qtest_get_machines(void) QTestState *qts; int idx; =20 + if (g_strcmp0(qemu_var, var)) { + qemu_var =3D g_strdup(var); + + /* new qemu, clear the cache */ + qtest_free_machine_list(machines); + machines =3D NULL; + } + if (machines) { return machines; } =20 - qts =3D qtest_init("-machine none"); + qts =3D qtest_init_with_env(qemu_var, "-machine none"); response =3D qtest_qmp(qts, "{ 'execute': 'query-machines' }"); g_assert(response); list =3D qdict_get_qlist(response, "return"); @@ -1528,7 +1549,7 @@ void qtest_cb_for_every_machine(void (*cb)(const char= *machine), struct MachInfo *machines; int i; =20 - machines =3D qtest_get_machines(); + machines =3D qtest_get_machines(NULL); =20 for (i =3D 0; machines[i].name !=3D NULL; i++) { /* Ignore machines that cannot be used for qtests */ @@ -1549,7 +1570,7 @@ bool qtest_has_machine(const char *machine) struct MachInfo *machines; int i; =20 - machines =3D qtest_get_machines(); + machines =3D qtest_get_machines(NULL); =20 for (i =3D 0; machines[i].name !=3D NULL; i++) { if (g_str_equal(machine, machines[i].name) || --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657308; cv=none; d=zohomail.com; s=zohoarc; b=k2ugdDZVAQqIlfD/HeWZx9zT+wai76gHURgV5ZKPDsc5l9biPXxeH7un/TPAmAy2Du2uZ2VKkEJuTkP3uHetHNagGo6fG7tiTBO6yongD8js9cOb4atZFI+jQxESeThGuNWQlaqm9mTq7tlICMnJ1NUXHb5O7xpKNZAz9VTdBRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657308; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DWUA6/SAgHRK6GW3QBtM99zEGK18eSzoUskHQUgNgP4=; b=cM3rUxYHoPRwHeRZuQmSXkP9CK2ZNOYaB6/eTaRvpBwTJO/In3QhXemw7KyHdrvGnEppU82LV3DkArsx8WI1GsCP8chcchP3cGqyGJEUnTb+1oMAwi84oj4VylL9kxu63X3714xR+CR2icR6gwyBqNjJz3yNcgJkXnrgG5T5DVc= 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 1697657308368641.9972076829646; Wed, 18 Oct 2023 12:28:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCD4-0003JM-1E; Wed, 18 Oct 2023 15:28: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 1qtCD2-0003Ix-OT for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:00 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCD1-00054F-9r for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:00 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D5732218E0; Wed, 18 Oct 2023 19:27:57 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 52DFD13780; Wed, 18 Oct 2023 19:27:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QFayB7sxMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:27:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657277; h=from:from:reply-to: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=DWUA6/SAgHRK6GW3QBtM99zEGK18eSzoUskHQUgNgP4=; b=JkCApC7pX5sUw1LJ7yBqycEHWYH5s/p/j5v8L4EEVpSEFbYxEWDurz1I4QlAX5J556+IUK HhD57Rh9xLql9wKrXnskcwYC/pLwCqVUXpFy1XeqTOvcs0XqncQfxWIA/ylISkqhCQZwVE op2fg7iM77V5uSk1iC48Skr00Od3Brc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657277; h=from:from:reply-to: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=DWUA6/SAgHRK6GW3QBtM99zEGK18eSzoUskHQUgNgP4=; b=cDpDY/+9O7hlyDtySLFmlDT+3TIR5xCBT1tUChytimVSKx2Z21vcGNl1OSrt/ARjfSKnK5 OrW1vAsElkxz2uDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 04/12] tests/qtest: Introduce qtest_has_machine_with_env Date: Wed, 18 Oct 2023 16:27:33 -0300 Message-Id: <20231018192741.25885-5-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -2.03 X-Spamd-Result: default: False [-2.03 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.93)[99.71%] 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=195.135.220.28; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657310440100013 Content-Type: text/plain; charset="utf-8" Add a variant of qtest_has_machine() that receives an environment variable containing an alternate QEMU binary path. Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth Signed-off-by: Fabiano Rosas --- tests/qtest/libqtest.c | 9 +++++++-- tests/qtest/libqtest.h | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 3cc7bf3076..603d900e7d 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1565,12 +1565,12 @@ void qtest_cb_for_every_machine(void (*cb)(const ch= ar *machine), } } =20 -bool qtest_has_machine(const char *machine) +bool qtest_has_machine_with_env(const char *var, const char *machine) { struct MachInfo *machines; int i; =20 - machines =3D qtest_get_machines(NULL); + machines =3D qtest_get_machines(var); =20 for (i =3D 0; machines[i].name !=3D NULL; i++) { if (g_str_equal(machine, machines[i].name) || @@ -1582,6 +1582,11 @@ bool qtest_has_machine(const char *machine) return false; } =20 +bool qtest_has_machine(const char *machine) +{ + return qtest_has_machine_with_env(NULL, machine); +} + bool qtest_has_device(const char *device) { static QList *list; diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index 76fc195f1c..d16deb9891 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -930,6 +930,15 @@ void qtest_cb_for_every_machine(void (*cb)(const char = *machine), */ bool qtest_has_machine(const char *machine); =20 +/** + * qtest_has_machine_with_env: + * @var: Environment variable from where to take the QEMU binary + * @machine: The machine to look for + * + * Returns: true if the machine is available in the specified binary. + */ +bool qtest_has_machine_with_env(const char *var, const char *machine); + /** * qtest_has_device: * @device: The device to look for --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657308; cv=none; d=zohomail.com; s=zohoarc; b=UGe/O3V4tSCkR2Kaj/TkKtTO7p7v2YOgsSEPzo5SPfc72+/veFQXcl1Uao/Amb3LQOefrySkJEBxyBXVsHpxL4LtH/cBCd5Q+ACOv1ZDy99dnsasU74GYIPu0f1WCL3A5HecM2q/BbBFQO0sdrjs+mkoEWmoKq3cgrvQYGzW6RI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657308; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bYa0IQUZGDm9SL2hTF0Su6TQuukiky4rEkN3gffskvE=; b=hW6szWd6IL1Sc7F2G5M/fsDgIShkSlzW/MwyiDoUUImN9lOtdOiq382Cd2kUqX/1+XTlU6iL3RscEZjrD+vFoWRLa2JA/oa2Vvm0WKzKHK19BDD87zgPVJDMrS298GqRasts/DOJ2h9nvGTEvOqydSI6ajb5aiffkPcjcDIk3LA= 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 1697657308450393.44036501605297; Wed, 18 Oct 2023 12:28:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCDA-0003K9-4r; Wed, 18 Oct 2023 15:28: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 1qtCD7-0003Jl-F9 for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:05 -0400 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCD4-00054k-Fx for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:03 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id CCD961FD7E; Wed, 18 Oct 2023 19:28:00 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4A4B313780; Wed, 18 Oct 2023 19:27:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CAy+Bb4xMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:27:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657280; h=from:from:reply-to: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=bYa0IQUZGDm9SL2hTF0Su6TQuukiky4rEkN3gffskvE=; b=MjFzwthJVZ5mzswUnkTfGgKRNQEsZzLJwzXrtTnMVA9bMWK2JJ1V+dnUetw4Tlebi/RB4D KuKNel8ZI8Ydpzu98p/zsH1r5yJmtcxW2zQr+XSWoZ+ofwKpwM/oReZxpbaUeQA+j74PEC oyW2zNT3Z9WLAsqq+Lj5OQo66j7aVts= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657280; h=from:from:reply-to: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=bYa0IQUZGDm9SL2hTF0Su6TQuukiky4rEkN3gffskvE=; b=gcN3Abxg4O8Q/4ur0izBMZJFqbf7eLJExMcFapl19/bIhVZ9D1dcGU3RStbfrXsAUK1o6+ 8T8xxhBnpwLOErDg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 05/12] tests/qtest: Introduce qtest_resolve_machine_alias Date: Wed, 18 Oct 2023 16:27:34 -0300 Message-Id: <20231018192741.25885-6-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -2.10 X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] 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=2001:67c:2178:6::1d; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657310515100014 Content-Type: text/plain; charset="utf-8" The migration tests are being enhanced to test migration between different QEMU versions. A requirement of migration is that the machine type between source and destination matches, including the version. We cannot hardcode machine types in the tests because those change with each release. QEMU provides a machine type alias that has a fixed name, but points to the latest machine type at each release. Add a helper to resolve the alias into the exact machine type. E.g. "-machine pc" resolves to "pc-i440fx-8.2" Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth Signed-off-by: Fabiano Rosas --- tests/qtest/libqtest.c | 16 ++++++++++++++++ tests/qtest/libqtest.h | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 603d900e7d..c843c41188 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1565,6 +1565,22 @@ void qtest_cb_for_every_machine(void (*cb)(const cha= r *machine), } } =20 +char *qtest_resolve_machine_alias(const char *var, const char *alias) +{ + struct MachInfo *machines; + int i; + + machines =3D qtest_get_machines(var); + + for (i =3D 0; machines[i].name !=3D NULL; i++) { + if (machines[i].alias && g_str_equal(alias, machines[i].alias)) { + return g_strdup(machines[i].name); + } + } + + return NULL; +} + bool qtest_has_machine_with_env(const char *var, const char *machine) { struct MachInfo *machines; diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index d16deb9891..6e3d3525bf 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -922,6 +922,16 @@ void qtest_qmp_fds_assert_success(QTestState *qts, int= *fds, size_t nfds, void qtest_cb_for_every_machine(void (*cb)(const char *machine), bool skip_old_versioned); =20 +/** + * qtest_resolve_machine_alias: + * @var: Environment variable from where to take the QEMU binary + * @alias: The alias to resolve + * + * Returns: the machine type corresponding to the alias if any, + * otherwise NULL. + */ +char *qtest_resolve_machine_alias(const char *var, const char *alias); + /** * qtest_has_machine: * @machine: The machine to look for --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657340; cv=none; d=zohomail.com; s=zohoarc; b=bWy8fjb1NwUBTJGfrOkwb+Q+fNZIQfecLUtTou+GO8mMzXMk7ne+kcZTdSwrjo9SZgJED3W2WY5Tp7OQErNx9GE3upN5SYrc9kxls1v1Xx4UrLpKIcNfvF5zh8ex08Kjc1ucaCrynfjBC2DnhtbjaPMPhzxWeh4Jz1SLU+QxZ8k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657340; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BWvfyNVlzQd5bdqAZJAzom4C9GdQVcpoysZO5J6iKrA=; b=RPoOhrtmZQ8U8dElU2IgNv68MyutBihXrxC+iTzjKxqLyyKDZFmho7iX7ft5vWQ0mg+TpCMxM8iROiUkw1cmMdOh+a+bkeM51PmFDTRwgQqi5yNa6F1SBUTXvCIUm9uE2Ut6ur7HTvFXeohHsAOdXA8srfq6ifslU94BMG8BDig= 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 1697657340107365.49384969578284; Wed, 18 Oct 2023 12:29:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCDB-0003KT-5V; Wed, 18 Oct 2023 15:28:09 -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 1qtCD8-0003Ju-Vo for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:07 -0400 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCD7-00055P-8O for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:06 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C0FDF218E0; Wed, 18 Oct 2023 19:28:03 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4106113780; Wed, 18 Oct 2023 19:28:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uGpwA8ExMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:28:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657283; h=from:from:reply-to: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=BWvfyNVlzQd5bdqAZJAzom4C9GdQVcpoysZO5J6iKrA=; b=SezuT35YbcxSl6kElJTZZxoNwPgMOczy5qgADQCY8Ey8JHczZ+SFLc3HZcEAioL4NBaVuV YEnao6M/SReZBI1UP10Y/SNd+dY0pmQ+9Vb5c4gMdJpQIx86hKg29HzgBvkwfdsho6IjHa F5B9z3l6zPBh3lQSmye4XlUhOh3mZlo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657283; h=from:from:reply-to: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=BWvfyNVlzQd5bdqAZJAzom4C9GdQVcpoysZO5J6iKrA=; b=snOU3iAozGH8rrkhBcKhqiu84ctXTFCzDbPqwpia5r2jcDYxcwFf9k94lH47tL0B1XPRoA fTNrdDSdnbsU1wCg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 06/12] tests/qtest/migration: Introduce find_common_machine_version Date: Wed, 18 Oct 2023 16:27:35 -0300 Message-Id: <20231018192741.25885-7-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -0.27 X-Spamd-Result: default: False [-0.27 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-1.17)[88.88%] 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=2001:67c:2178:6::1c; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657340579100001 Content-Type: text/plain; charset="utf-8" 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 Signed-off-by: Fabiano Rosas Reviewed-by: Thomas Huth --- tests/qtest/migration-helpers.c | 26 ++++++++++++++++++++++++++ tests/qtest/migration-helpers.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.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 al= low_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 =3D qtest_resolve_machine_alias(var1, mtype); + g_autofree char *type2 =3D 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' betwee= n " + "binaries %s and %s", mtype, getenv(var1), getenv(var2)= ); + g_assert_not_reached(); +} diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helper= s.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); =20 void wait_for_migration_fail(QTestState *from, bool allow_active); =20 +char *find_common_machine_version(const char *mtype, const char *var1, + const char *var2); #endif /* MIGRATION_HELPERS_H */ --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657386; cv=none; d=zohomail.com; s=zohoarc; b=jVntaWWr8QQoLkO0pMH103vZgEjButt7ZP+PLRU9sxoZsqZiCN9eIztXgMOWgzlaMHPGpaZhJkeQIz9jhMyxbVYAoK8OKH+iGwiAgHhUQFtWHkQV9RpAY9rKpxatg5bU7PQfcPAgSw+QCnkMsKxKpDlw9zaY2FDxxyUA74E3FK8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657386; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ml3qsqOE/M42yr8/FMnGjUXaUFUKCzD3TurkW8vBD64=; b=cElf0Njn3SrMyv0ChnYujUYBBQG41WA8OIQW6av+uHcYMqd3eWirqm/e66xI4Irytm30l6C4kIHHK/mf+zAMzjzAxs8kRkXGgokX4FwCLTCK0/7pM3QZHnaccrgB6OLbWfxi3z1MJBDm7m7YJOpsttjH0ldfmBT3amiafmcN7J4= 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 1697657386142791.9082424332934; Wed, 18 Oct 2023 12:29:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCDE-0003Kx-NN; Wed, 18 Oct 2023 15:28:12 -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 1qtCDD-0003Kg-9T for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:12 -0400 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCDA-00055m-6J for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:10 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id B8DD31F88B; Wed, 18 Oct 2023 19:28:06 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 35AB3139E0; Wed, 18 Oct 2023 19:28:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ePW5AMQxMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:28:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657286; h=from:from:reply-to: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=ml3qsqOE/M42yr8/FMnGjUXaUFUKCzD3TurkW8vBD64=; b=z3Lk0J5q9ocyXB6o+OESQM6MSCMalRuW/cXZePU+xD1/5ku7RWSuHHcJuYysy7itkAa44B naMrkuaYfmU+DFInRpQ/Q2RH57zJeqdYdopCLJNdOZi+Rn/XkCJg2b17B729fiMgulWojX GbTKJ03L7Jska9Vmb2s4GxLBO9h+1zY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657286; h=from:from:reply-to: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=ml3qsqOE/M42yr8/FMnGjUXaUFUKCzD3TurkW8vBD64=; b=RKPQWGjiWlZX6O5q88eaqle++9EnXWpsVOh8z0USNFOh0C6VyXVAlxSxltr6J5tiZYGm22 0oOwgQDNVKMMXABg== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 07/12] tests/qtest/migration: Define a machine for all architectures Date: Wed, 18 Oct 2023 16:27:36 -0300 Message-Id: <20231018192741.25885-8-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -1.63 X-Spamd-Result: default: False [-1.63 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.53)[97.89%] 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=2001:67c:2178:6::1d; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657386800100003 Content-Type: text/plain; charset="utf-8" Stop relying on defaults and select a machine explicitly for every architecture. This is a prerequisite for being able to select machine types for migration using different QEMU binaries for source and destination. Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth --- tests/qtest/migration-test.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e1c110537b..43d0b83771 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -743,6 +743,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, const char *kvm_opts =3D NULL; const char *arch =3D qtest_get_arch(); const char *memory_size; + const char *machine_alias, *machine_opts =3D ""; =20 if (args->use_shmem) { if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { @@ -755,11 +756,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, got_dst_resume =3D false; if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { memory_size =3D "150M"; + machine_alias =3D "pc"; 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"; + machine_alias =3D "s390-ccw-virtio"; arch_opts =3D g_strdup_printf("-bios %s", bootpath); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; @@ -771,11 +774,14 @@ 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 -machine vsmt=3D8"); + machine_alias =3D "pseries"; + machine_opts =3D "vsmt=3D8"; + arch_opts =3D g_strdup("-nodefaults"); } 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); + machine_alias =3D "virt"; + machine_opts =3D "gic-version=3Dmax"; + 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; } else { @@ -810,11 +816,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, } =20 cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " + "-machine %s,%s " "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s %s", kvm_opts ? kvm_opts : "", + machine_alias, machine_opts, memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", @@ -829,12 +837,14 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, } =20 cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " + "-machine %s,%s " "-name target,debug-threads=3Don " "-m %s " "-serial file:%s/dest_serial " "-incoming %s " "%s %s %s %s %s", kvm_opts ? kvm_opts : "", + machine_alias, machine_opts, memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657395; cv=none; d=zohomail.com; s=zohoarc; b=hUhudWoEfUV10FIKdAGHcoXccK8d123QD8Cy81WLt02rhoSkwRsCW/XSNg/Fhwfqj2otSZZLywwuzYS687pUcMQQoROEFojq08uBXjeQKLnIY1EiVRfUdIYmrVSfcTuCq23BoborwDjRJbLPMMp6bICTUeF/el235Q2Qq+aqgaM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657395; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=chmEN6HEKSwrTLUIVopP47g0GTvAmX4d2zXAEXGGGpQ=; b=mVeBVCsfSdCWad2YCL0QOYyWJN4H7x/8L1kfMTRR3gHfHfT6S6XLyqodtWafFP3/auntAkO4M3Cl9ZxOwTJrZahqp1/R071V4lszRqk9IGklSayh7s2lQs5jcWJO/Pe3roXdVPI6txWfNVyXas7AbPILEoKmmfom6OhLrNRMv1s= 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 1697657395833354.8763424057356; Wed, 18 Oct 2023 12:29:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCDI-0003LO-MM; Wed, 18 Oct 2023 15:28: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 1qtCDE-0003Ky-UR for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:12 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCDD-00055x-2z for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:12 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AC9DC21B6E; Wed, 18 Oct 2023 19:28:09 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2B8FC13780; Wed, 18 Oct 2023 19:28:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4G3SOcYxMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:28:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657289; h=from:from:reply-to: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=chmEN6HEKSwrTLUIVopP47g0GTvAmX4d2zXAEXGGGpQ=; b=h88JzaTpdtoqo9KmmyPeWtqrWF0MHZgjY2NgymXV7cpngq339d/f5/i5pYF43khQ464Mya NMLJtXeUc4IuLrv1/I2FRAyYWb0P02v78rPTtyDgqMO4WUcDstBI/VFiKDH28euu9dRNfU QsFI/wxJ4UJ7AHpQ+Acje1s2fAAGG/E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657289; h=from:from:reply-to: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=chmEN6HEKSwrTLUIVopP47g0GTvAmX4d2zXAEXGGGpQ=; b=OfTdupPpgVAlw+W9SVwZvrg01Fi8xC8PyY3M/4lQQfpqwzt1oSmjeUXX2ix/C8tK7fWsGy IC1FlIsYYdHMSDCQ== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 08/12] tests/qtest/migration: Specify the geometry of the bootsector Date: Wed, 18 Oct 2023 16:27:37 -0300 Message-Id: <20231018192741.25885-9-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -1.15 X-Spamd-Result: default: False [-1.15 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.05)[95.37%] 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=195.135.220.28; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657396877100001 Content-Type: text/plain; charset="utf-8" We're about to enable the x86_64 tests to run with the q35 machine, but that machine does not work with the program we use to dirty the memory for the tests. The issue is that QEMU needs to guess the geometry of the "disk" we give to it and the guessed geometry doesn't pass the sanity checks done by SeaBIOS. This causes SeaBIOS to interpret the geometry as if needing a translation from LBA to CHS and SeaBIOS ends up miscomputing the number of cylinders and aborting due to that. The reason things work with the "pc" machine is that is uses ATA instead of AHCI like q35 and SeaBIOS has an exception for ATA that ends up skipping the sanity checks and ignoring translation altogether. Workaround this situation by specifying a geometry in the command line. Signed-off-by: Fabiano Rosas Acked-by: Thomas Huth Reviewed-by: Juan Quintela --- tests/qtest/migration-test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 43d0b83771..b45a389de8 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -757,7 +757,9 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { memory_size =3D "150M"; machine_alias =3D "pc"; - arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw", boo= tpath); + arch_opts =3D g_strdup_printf( + "-drive if=3Dnone,id=3Dd0,file=3D%s,format=3Draw " + "-device ide-hd,drive=3Dd0,secs=3D1,cyls=3D1,heads=3D1", bootp= ath); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657314; cv=none; d=zohomail.com; s=zohoarc; b=kBPMlkTWMHyDTUnyGCwL7bhF7T3JY7dyVcqEDPxs67kDWBqtZUc0wdDdmS6VGOtBWHKYvd5ecpZ1ovDZZkz2N5hI9qgCp9NXu83MLIYn5xmhpuM/QOizEti165YdAyOOu7qmIqK7ZfMTE3KQyz2C0FJk5S3MbGWzHFWVrR2uh9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657314; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aE4LpAnyC8dLlmEG0txaprLN45Efp23GNzwXRJ1+W8U=; b=ZINLnva0nm8Us3Xjob3UJBWc3Py71YkNExFaq2EylduEvsNO8k04pZCxklyzXDYAZguep1MM20sXvoB+SGBIa5xKUcp7Nu3uCEimDSp2+Tj5C8+jPtzwoLg+FI7agsNAqHEGrHb6P7C5iR/Y43O9AWxW6QJ+goCKCJBXM8NSmKs= 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 1697657314165265.59825017627224; Wed, 18 Oct 2023 12:28:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCDN-0003Ln-Ge; Wed, 18 Oct 2023 15:28:22 -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 1qtCDH-0003LK-GN for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:16 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCDF-00056D-TA for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:15 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A189E1FD7E; Wed, 18 Oct 2023 19:28:12 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 20E5C13780; Wed, 18 Oct 2023 19:28:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EN5NN8kxMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:28:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657292; h=from:from:reply-to: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=aE4LpAnyC8dLlmEG0txaprLN45Efp23GNzwXRJ1+W8U=; b=aKdS+XAOV9X0r1vWw0VcRFFQpKzGPKE0LZR0ZHQjN23xFyOqUNJp0GYjoS0k+0J8YvVnLz +pItz8iFSlkDtNuR2S8zhs83/JyuBB3yy7DNCLOHVG0iZpS0xzs3IuZLP76vFRP+QT44B7 BKTpAAN/npdR7yZC3UhbcuFz7kXCwSE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657292; h=from:from:reply-to: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=aE4LpAnyC8dLlmEG0txaprLN45Efp23GNzwXRJ1+W8U=; b=sfpEHNKFt0p7as/2GWQuBJdVUK8qK8GwCWvNSFPuZriSHvDBaucez47+d+sHapKUdPVWd2 7WCrD8Fr1Z4bVnDA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 09/12] tests/qtest/migration: Set q35 as the default machine for x86_86 Date: Wed, 18 Oct 2023 16:27:38 -0300 Message-Id: <20231018192741.25885-10-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -0.31 X-Spamd-Result: default: False [-0.31 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-1.21)[89.25%] 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=195.135.220.29; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657314640100001 Content-Type: text/plain; charset="utf-8" Change the x86_64 to use the q35 machines in tests from now on. Keep testing the pc macine on 32bit. Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth --- this could affect bisecting, so I put it in separate patch to be easier to revert --- tests/qtest/migration-test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b45a389de8..b718634b1c 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -756,7 +756,12 @@ static int test_migrate_start(QTestState **from, QTest= State **to, got_dst_resume =3D false; if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { memory_size =3D "150M"; - machine_alias =3D "pc"; + + if (g_str_equal(arch, "i386")) { + machine_alias =3D "pc"; + } else { + machine_alias =3D "q35"; + } arch_opts =3D g_strdup_printf( "-drive if=3Dnone,id=3Dd0,file=3D%s,format=3Draw " "-device ide-hd,drive=3Dd0,secs=3D1,cyls=3D1,heads=3D1", bootp= ath); --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657397; cv=none; d=zohomail.com; s=zohoarc; b=CxSAJAG7PaobbvyOgwb13IWQ9vB6XFbDNsH++IPVjWR3ty736A4ToWs6PNjeGvcHH1irY5kQAEXBVF6C+fXN/u7W9HZIlyNSxgs05cI4zIF9y1WJJ3Caz1HAAqiA+QdXAAvIuz3UxJPPpo2BiPxq4SVTS2VQIjucjWcaQ3vh0Y4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657397; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KN+Xldb/hZYy0BPGea5bgIrt4E/Eanf5p8NlS1aGhkc=; b=m6jXt4YO4sdW5dPnLKQtJGG7eb6m/5d4UuXd3Zw5KmezPv5SGNAdcpJlxRchQtPyhuC51Dn8tzHArMsblrqj4Fygcg2LpR5QmPtE2cm5QbbJ054uEYdRJH0Im/wT8hVZB8xUP0dg7ZPSrOA1xh3rhBw64iJ3P+fe3D5JuHH8lMU= 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 1697657397586176.68008825407514; Wed, 18 Oct 2023 12:29:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCDP-0003PT-Dc; Wed, 18 Oct 2023 15:28: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 1qtCDK-0003Lq-Pp for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:18 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCDI-00056N-Oj for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:18 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 98B3B21BB1; Wed, 18 Oct 2023 19:28:15 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 170C013780; Wed, 18 Oct 2023 19:28:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yHSxNMwxMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:28:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657295; h=from:from:reply-to: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=KN+Xldb/hZYy0BPGea5bgIrt4E/Eanf5p8NlS1aGhkc=; b=jcLDOydFqu+hthBI20fZ/tph8ZF5YOrpLBw66eghTGQL3jzY8RsWP3G5Ik9Efw5curff+W KiJDy2TLG8/lRwDPuFUyIOGXa4/6SAowslxW4EdD/Cz+z6jlWWaukkprm9cKmS7pDglKsI y31NTBR/U0GS1FmxvaJJtdLqMg5XOzY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657295; h=from:from:reply-to: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=KN+Xldb/hZYy0BPGea5bgIrt4E/Eanf5p8NlS1aGhkc=; b=PU+5REX2UfrDt3DxYxBlJw/oNKTYhSMvuEVSkhSqqUuLnujGPdqJut5Mmbk7iBM/SIfTHx OtzOwB9HEg5G8sBA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 10/12] tests/qtest/migration: Support more than one QEMU binary Date: Wed, 18 Oct 2023 16:27:39 -0300 Message-Id: <20231018192741.25885-11-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; none X-Spam-Score: -2.10 X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] 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=195.135.220.28; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657398831100005 Content-Type: text/plain; charset="utf-8" We have strict rules around migration compatibility between different QEMU versions but no test to validate the migration state between different binaries. Add infrastructure to allow running the migration tests with two different QEMU binaries as migration source and destination. The code now recognizes two new environment variables QTEST_QEMU_BINARY_SRC and QTEST_QEMU_BINARY_DST. In the absence of either of them, the test will use the QTEST_QEMU_BINARY variable. If both are missing then the tests are run with single binary as previously. The machine type is selected automatically as the latest machine type version that works with both binaries. Usage (only one of SRC|DST is allowed): QTEST_QEMU_BINARY_SRC=3D../build-8.2.0/qemu-system-x86_64 \ QTEST_QEMU_BINARY=3D../build-8.1.0/qemu-system-x86_64 \ ./tests/qtest/migration-test Reviewed-by: Juan Quintela Signed-off-by: Fabiano Rosas Reviewed-by: Thomas Huth --- tests/qtest/migration-test.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b718634b1c..51f5603aac 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -71,6 +71,8 @@ static bool got_dst_resume; #define QEMU_VM_FILE_MAGIC 0x5145564d #define FILE_TEST_FILENAME "migfile" #define FILE_TEST_OFFSET 0x1000 +#define QEMU_ENV_SRC "QTEST_QEMU_BINARY_SRC" +#define QEMU_ENV_DST "QTEST_QEMU_BINARY_DST" =20 #if defined(__linux__) #include @@ -744,6 +746,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, const char *arch =3D qtest_get_arch(); const char *memory_size; const char *machine_alias, *machine_opts =3D ""; + g_autofree char *machine =3D NULL; =20 if (args->use_shmem) { if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { @@ -822,6 +825,10 @@ static int test_migrate_start(QTestState **from, QTest= State **to, kvm_opts =3D ",dirty-ring-size=3D4096"; } =20 + machine =3D find_common_machine_version(machine_alias, QEMU_ENV_SRC, + QEMU_ENV_DST); + g_test_message("Using machine type: %s", machine); + cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-machine %s,%s " "-name source,debug-threads=3Don " @@ -829,7 +836,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "-serial file:%s/src_serial " "%s %s %s %s %s", kvm_opts ? kvm_opts : "", - machine_alias, machine_opts, + machine, machine_opts, memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", @@ -837,7 +844,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, args->opts_source ? args->opts_source : "= ", ignore_stderr); if (!args->only_target) { - *from =3D qtest_init(cmd_source); + *from =3D qtest_init_with_env(QEMU_ENV_SRC, cmd_source); qtest_qmp_set_event_callback(*from, migrate_watch_for_stop, &got_src_stop); @@ -851,14 +858,14 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "-incoming %s " "%s %s %s %s %s", kvm_opts ? kvm_opts : "", - machine_alias, machine_opts, + machine, machine_opts, memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", shmem_opts ? shmem_opts : "", args->opts_target ? args->opts_target : "= ", ignore_stderr); - *to =3D qtest_init(cmd_target); + *to =3D qtest_init_with_env(QEMU_ENV_DST, cmd_target); qtest_qmp_set_event_callback(*to, migrate_watch_for_resume, &got_dst_resume); @@ -2989,10 +2996,23 @@ int main(int argc, char **argv) bool has_uffd; const char *arch; g_autoptr(GError) err =3D NULL; + const char *qemu_src =3D getenv(QEMU_ENV_SRC); + const char *qemu_dst =3D getenv(QEMU_ENV_DST); int ret; =20 g_test_init(&argc, &argv, NULL); =20 + /* + * The default QTEST_QEMU_BINARY must always be provided because + * that is what helpers use to query the accel type and + * architecture. + */ + if (qemu_src && qemu_dst) { + g_test_message("Only one of %s, %s is allowed", + QEMU_ENV_SRC, QEMU_ENV_DST); + exit(1); + } + has_kvm =3D qtest_has_accel("kvm"); has_tcg =3D qtest_has_accel("tcg"); =20 --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657384; cv=none; d=zohomail.com; s=zohoarc; b=C21CeEn4cUHdy99QXp97XOasmgbP2yivN2uk4mNOVvSwGNxFAcIE8L7as98EFhgiJgu0vVxQo7lQGVlU1x+W9c4g/IYBpnXUN1G92E5Eyckz+0fyeoJo/2Qwl2mRL/eXUIxK9hARUIxo4QyGnoH+0q2wZKMA3xGfT1e+XQ9uhOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657384; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EfvZQLzghZRtIl6KJ4zsskowtUAaqfWlM7hlBkvPr1g=; b=Y43vWT7ras2GfqnDCAO+/J8M2zuWDTmj7+Re0Sm8yk6sEn3BMsLkFIF4iE+VpYN3NEproSH40TeMsMTYQaRJXw8qFCUla/J8OoEGQcdG/nnrxvQ8iID9HVFus1EWjWOuLSM3dE3Mp49+DLhJVDclFUehNMDWZwHJmFgcPii5vL0= 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 1697657384947850.188207625889; Wed, 18 Oct 2023 12:29:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCDO-0003Or-Tj; Wed, 18 Oct 2023 15:28:22 -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 1qtCDN-0003M3-AB for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:22 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCDL-00056c-Nu for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:21 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8B0FE1FD7E; Wed, 18 Oct 2023 19:28:18 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 0FCC013780; Wed, 18 Oct 2023 19:28:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +HMkM88xMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:28:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657298; h=from:from:reply-to: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=EfvZQLzghZRtIl6KJ4zsskowtUAaqfWlM7hlBkvPr1g=; b=KXGCOVoCGEHxbk1E6x7j89OGWnqk5SUTRZJh1/Cm+4ThkvN3OEvH3vjfZ0Lg2gE+bu2n2A gh7rNQzrigFN1yMRoLma39x8st67iQCUPBdPIjibNRZgB2C+V6UeDZmS2Jebsxb35W1OY3 tVWRxUg0IYOGkqsia858gZH0h8PfT8Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657298; h=from:from:reply-to: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=EfvZQLzghZRtIl6KJ4zsskowtUAaqfWlM7hlBkvPr1g=; b=ffxRxq+Y16lyJ6Ex1JRE4h8fudeMxijWyyR9GcudAvJoYzS7aR3KtrkMbjwqWhMLW7x5zq 1ZgXyJYJNUa1nqAA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 11/12] tests/qtest/migration: Allow user to specify a machine type Date: Wed, 18 Oct 2023 16:27:40 -0300 Message-Id: <20231018192741.25885-12-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -1.66 X-Spamd-Result: default: False [-1.66 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.56)[98.05%] 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=195.135.220.29; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657386803100004 Content-Type: text/plain; charset="utf-8" Accept the QTEST_QEMU_MACHINE_TYPE environment variable to take a machine type to use in the tests. The full machine type is recognized (e.g. pc-q35-8.2). Aliases (e.g. pc) are also allowed and resolve to the latest machine version for that alias, or, if using two QEMU binaries, to the latest common machine version between the two. Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth --- tests/qtest/migration-helpers.c | 26 ++++++++++++++++++++++++++ tests/qtest/migration-helpers.h | 2 ++ tests/qtest/migration-test.c | 5 +++-- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index 13449c1fe1..24fb7b3525 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -11,6 +11,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/ctype.h" #include "qapi/qmp/qjson.h" =20 #include "migration-helpers.h" @@ -266,3 +267,28 @@ char *find_common_machine_version(const char *mtype, c= onst char *var1, "binaries %s and %s", mtype, getenv(var1), getenv(var2)= ); g_assert_not_reached(); } + +char *resolve_machine_version(const char *alias, const char *var1, + const char *var2) +{ + const char *mname =3D g_getenv("QTEST_QEMU_MACHINE_TYPE"); + g_autofree char *machine_name =3D NULL; + + if (mname) { + const char *dash =3D strrchr(mname, '-'); + const char *dot =3D strrchr(mname, '.'); + + machine_name =3D g_strdup(mname); + + if (dash && dot) { + assert(qtest_has_machine(machine_name)); + return g_steal_pointer(&machine_name); + } + /* else: probably an alias, let it be resolved below */ + } else { + /* use the hardcoded alias */ + machine_name =3D g_strdup(alias); + } + + return find_common_machine_version(machine_name, var1, var2); +} diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helper= s.h index d1c2351d33..e31dc85cc7 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -45,4 +45,6 @@ void wait_for_migration_fail(QTestState *from, bool allow= _active); =20 char *find_common_machine_version(const char *mtype, const char *var1, const char *var2); +char *resolve_machine_version(const char *alias, const char *var1, + const char *var2); #endif /* MIGRATION_HELPERS_H */ diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 51f5603aac..e15ac3b353 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -825,8 +825,9 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, kvm_opts =3D ",dirty-ring-size=3D4096"; } =20 - machine =3D find_common_machine_version(machine_alias, QEMU_ENV_SRC, - QEMU_ENV_DST); + machine =3D resolve_machine_version(machine_alias, QEMU_ENV_SRC, + QEMU_ENV_DST); + g_test_message("Using machine type: %s", machine); =20 cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " --=20 2.35.3 From nobody Sun May 19 11:37:29 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=suse.de ARC-Seal: i=1; a=rsa-sha256; t=1697657371; cv=none; d=zohomail.com; s=zohoarc; b=bzbjyWAM8B2eKxclRMzu87zAhnMEka6zPHBu8ZZ9Kc1fYo1kvgdkBGPK8xIO/L2j3cKa9j5ayiaF9aF6pBX99W/7KE5+hLzdXCxGCzCYLFfMFwJRdXj4G98tWabDsJYOMlc/hqN6uZhFUrFJaD2Z77NRL2i4ca0h7zD2xH8ekQI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697657371; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KYStl8vRzJnCOg4rHZ8OswGoyCqNYq8e3Sulu6Ojj+s=; b=hzymaC7iD0FDs6Rq95IblFPaIQgruwdI6rvzCPlpExRQCSXfJnG4vMzxZK8bQHzvcuwq9w1E/Ue1y60mAb166N3k5u/tU3335S8aSKdgcLjdbbw3EdGTIv7JLy8rzqXRsEc0WyUr8gPl+um+ZomhHFngmcI4b2f5luK80/cFbos= 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 1697657371561762.5923956457636; Wed, 18 Oct 2023 12:29:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtCDS-0003QE-4r; Wed, 18 Oct 2023 15:28: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 1qtCDQ-0003Po-AF for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:24 -0400 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtCDO-000589-Pd for qemu-devel@nongnu.org; Wed, 18 Oct 2023 15:28:24 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8BB7B1FD7F; Wed, 18 Oct 2023 19:28:21 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F410C13780; Wed, 18 Oct 2023 19:28:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UPwVL9IxMGVLaAAAMHmgww (envelope-from ); Wed, 18 Oct 2023 19:28:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697657301; h=from:from:reply-to: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=KYStl8vRzJnCOg4rHZ8OswGoyCqNYq8e3Sulu6Ojj+s=; b=bdE/DXuUoi4rEorazmvzbhjO4LtMuZw7rp6cGn3Eno/QToTZERmwYWSCgsU/3u2JqmOk/a vYspshGnQNpnkiTAGA53xjpzSFG3tm2RmxQzRCvZLlQFsI3Sw3gHWaty2pRESTZo0NW9i1 jTHcRsyeo3oySFaY2Sj7jJ/gcahDyOE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697657301; h=from:from:reply-to: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=KYStl8vRzJnCOg4rHZ8OswGoyCqNYq8e3Sulu6Ojj+s=; b=Zs7huD6pA06X4ojfagW0ZsuivGhvhfQtBLGfFGL+DgL6heF3TFWBEAH636/whsXph/7Q8X z6GepjmN4Cs5R+AA== From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH v4 12/12] tests/qtest: Don't print messages from query instances Date: Wed, 18 Oct 2023 16:27:41 -0300 Message-Id: <20231018192741.25885-13-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20231018192741.25885-1-farosas@suse.de> References: <20231018192741.25885-1-farosas@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -2.10 X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[10]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[99.97%] 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=2001:67c:2178:6::1d; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @suse.de) X-ZM-MESSAGEID: 1697657372722100001 Content-Type: text/plain; charset="utf-8" Now that we can query more than one binary, the "starting QEMU..." message can get a little noisy. Mute those messages unless we're running with --verbose. Only affects qtest_init() calls from within libqtest. The tests continue to output as usual. Reviewed-by: Juan Quintela Reviewed-by: Thomas Huth Signed-off-by: Fabiano Rosas --- tests/qtest/libqtest.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index c843c41188..f33a210861 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -91,6 +91,7 @@ struct QTestState =20 static GHookList abrt_hooks; static void (*sighandler_old)(int); +static bool silence_spawn_log; =20 static int qtest_query_target_endianness(QTestState *s); =20 @@ -405,7 +406,9 @@ static QTestState *G_GNUC_PRINTF(2, 3) qtest_spawn_qemu= (const char *qemu_bin, =20 qtest_add_abrt_handler(kill_qemu_hook_func, s); =20 - g_test_message("starting QEMU: %s", command->str); + if (!silence_spawn_log) { + g_test_message("starting QEMU: %s", command->str); + } =20 #ifndef _WIN32 s->qemu_pid =3D fork(); @@ -1508,6 +1511,8 @@ static struct MachInfo *qtest_get_machines(const char= *var) return machines; } =20 + silence_spawn_log =3D !g_test_verbose(); + qts =3D qtest_init_with_env(qemu_var, "-machine none"); response =3D qtest_qmp(qts, "{ 'execute': 'query-machines' }"); g_assert(response); @@ -1539,6 +1544,8 @@ static struct MachInfo *qtest_get_machines(const char= *var) qtest_quit(qts); qobject_unref(response); =20 + silence_spawn_log =3D false; + memset(&machines[idx], 0, sizeof(struct MachInfo)); /* Terminating ent= ry */ return machines; } --=20 2.35.3