From patchwork Thu Dec 12 15:09:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fabiano Rosas X-Patchwork-Id: 849732 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp980473wry; Thu, 12 Dec 2024 07:11:06 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUBQK5ZRZBwxaD4FFb2mEjKtRWjZsIhWOYep9GHaeGjPn80pnbHy28oygytF2YEEgocvE2JBg==@linaro.org X-Google-Smtp-Source: AGHT+IGm+GyG7KgWUii8tnjzWqVlSD0/67E+1BXobTXeIJNK7N65xwpu5g/Pjuvs9bMJ1hYktXVF X-Received: by 2002:a05:6902:260d:b0:e38:b512:2c1e with SMTP id 3f1490d57ef6-e41c8bb606dmr557641276.46.1734016264775; Thu, 12 Dec 2024 07:11:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734016264; cv=none; d=google.com; s=arc-20240605; b=FwkPMo0Yy0C+84AO3kumdHj/eXNzThiAJteCT09j7py+wRd9SQHC9V/CNngov8NegJ NpkzVY6DDeMWJiAxaeYSki+ikzkTciZc/ZaP0mzQiQ/VSfW2U15S3uLoP7n46LsO9mVy BRjsTx4XU75HKun+eHDlI39Oc68Y4yvQHS0twBcLQEqGz71J7z7aofnfiXAdQlpp7IR8 5RuvgFt68FdmQXP0dC+uSW+the7pZ+oSxZ/ZAPv0S04F9JcAGOT1fe3v1MiO7JoEhdjx VooOCW+P6KuRInIsc+LrMUmtFe70My4nn1kLrO9YwV0tTv/ANUZhpdXZWYtkJnyWCgOx x7gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=eMITvGvnkQ4fUF7q8QeCtQkCpLe7rgnLWFPrq2/x6XA=; fh=alZCUczDNtN4yFLy44SM1yTUliPrh8AgZa0GP8izqo4=; b=HWobgaWsP++NxVUdXoqAj3t3tDUQNORix0IVxjdgCuglwfW0vV8gKhtlgclN+LwmEi ur2IG5palv1wPRcVy5bGIbu+9JydFwRYq1GjJ8tU4HSDxUwtMLuRw6UEcpuPOfKMV1RW L0WtFcisEGkWI/ChjfcqE2zSG5BPOFzL96fB+PpYbRkFrBh9I7OChuOXwTEwIMTobnzJ 4/HmT9xmL0g4YgOCe61PaAR8dzU1voC8JYjMbrOlg1r9bSntkGK/FJHHrSJL8X6ygN7r 0G4P8/tpWZ80T4BFMEi5c0815iivT7K0eoExetexIKFeqjaMCxpIQlSjJgGzd2IxYjiX THNQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="B6Ejzk/5"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="B6Ejzk/5"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=a6q84oSf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 3f1490d57ef6-e3c9509e731si2331008276.451.2024.12.12.07.11.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Dec 2024 07:11:04 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="B6Ejzk/5"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="B6Ejzk/5"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=a6q84oSf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLkpF-0003pL-0g; Thu, 12 Dec 2024 10:10:01 -0500 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 1tLkpE-0003p6-4V for qemu-devel@nongnu.org; Thu, 12 Dec 2024 10:10:00 -0500 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLkpC-0002yf-CX for qemu-devel@nongnu.org; Thu, 12 Dec 2024 10:09:59 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 72CD41F394; Thu, 12 Dec 2024 15:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1734016196; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eMITvGvnkQ4fUF7q8QeCtQkCpLe7rgnLWFPrq2/x6XA=; b=B6Ejzk/5aXrkP9AyiajX+FLWSs+4CrULrDVovh3b7zE5olm6bcb0WSKw1riWW0aH7JxdPw HrbWLrg0AelsY819+/UBFaFZAq+FFEY22d5P6pAuGkyH9Ek/zinABUb1b4dLFeSq9tW7K9 yQV16dVpsGUBWspitYCvAYQWL89a2Io= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1734016196; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eMITvGvnkQ4fUF7q8QeCtQkCpLe7rgnLWFPrq2/x6XA=; b=a6q84oSfoi1WXqZ5MAMUF5Rt7w4YLxTMY22NxlxUUl3ZF/tFaQwBBYlOcxjmNJANJy0fNC /YewTS/ZCmErrHAA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1734016196; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eMITvGvnkQ4fUF7q8QeCtQkCpLe7rgnLWFPrq2/x6XA=; b=B6Ejzk/5aXrkP9AyiajX+FLWSs+4CrULrDVovh3b7zE5olm6bcb0WSKw1riWW0aH7JxdPw HrbWLrg0AelsY819+/UBFaFZAq+FFEY22d5P6pAuGkyH9Ek/zinABUb1b4dLFeSq9tW7K9 yQV16dVpsGUBWspitYCvAYQWL89a2Io= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1734016196; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eMITvGvnkQ4fUF7q8QeCtQkCpLe7rgnLWFPrq2/x6XA=; b=a6q84oSfoi1WXqZ5MAMUF5Rt7w4YLxTMY22NxlxUUl3ZF/tFaQwBBYlOcxjmNJANJy0fNC /YewTS/ZCmErrHAA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 46ACE13508; Thu, 12 Dec 2024 15:09:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id qGx+A8P8WmcTfQAAD6G6ig (envelope-from ); Thu, 12 Dec 2024 15:09:55 +0000 From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Subject: [PULL 02/22] tests/qtest: Add qtest_system_reset() utility function Date: Thu, 12 Dec 2024 12:09:29 -0300 Message-Id: <20241212150949.16806-3-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241212150949.16806-1-farosas@suse.de> References: <20241212150949.16806-1-farosas@suse.de> MIME-Version: 1.0 X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email, suse.de:mid, linaro.org:email, imap1.dmz-prg2.suse.org:helo] X-Spam-Score: -3.30 Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:2; envelope-from=farosas@suse.de; helo=smtp-out2.suse.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell We have several qtest tests which want to reset the QEMU under test during the course of testing something. They currently generally have their own functions to do this, which work by sending a "system_reset" QMP command. However, "system_reset" only requests a reset, and many of the tests which send the QMP command forget the "and then wait for the QMP RESET event" part which is needed to ensure that the reset has completed. Provide a qtest_system_reset() function in libqtest so that we don't need to reimplement this in multiple different tests. A few tests (for example device hotplug related tests) want to perform the reset command and then wait for some other event that is produced during the reset sequence. For them we provide qtest_system_reset_nowait() so they can clearly indicate that they are deliberately not waiting for the RESET event. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Fabiano Rosas --- tests/qtest/libqtest.c | 16 ++++++++++++++++ tests/qtest/libqtest.h | 25 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 817fd7aac5..8de5f1fde3 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -215,6 +215,22 @@ static void qtest_check_status(QTestState *s) #endif } +void qtest_system_reset_nowait(QTestState *s) +{ + /* Request the system reset, but do not wait for it to complete */ + qtest_qmp_assert_success(s, "{'execute': 'system_reset' }"); +} + +void qtest_system_reset(QTestState *s) +{ + qtest_system_reset_nowait(s); + /* + * Wait for the RESET event, which is sent once the system reset + * has actually completed. + */ + qtest_qmp_eventwait(s, "RESET"); +} + void qtest_wait_qemu(QTestState *s) { if (s->qemu_pid != -1) { diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index beb96b18eb..f23d80e9e5 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -88,6 +88,31 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args); */ QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd); +/** + * qtest_system_reset: + * @s: #QTestState instance to operate on. + * + * Send a "system_reset" command to the QEMU under test, and wait for + * the reset to complete before returning. + */ +void qtest_system_reset(QTestState *s); + +/** + * qtest_system_reset_nowait: + * @s: #QTestState instance to operate on. + * + * Send a "system_reset" command to the QEMU under test, but do not + * wait for the reset to complete before returning. The caller is + * responsible for waiting for either the RESET event or some other + * event of interest to them before proceeding. + * + * This function should only be used if you're specifically testing + * for some other event; in that case you can't use qtest_system_reset() + * because it will read and discard any other QMP events that arrive + * before the RESET event. + */ +void qtest_system_reset_nowait(QTestState *s); + /** * qtest_wait_qemu: * @s: #QTestState instance to operate on. From patchwork Thu Dec 12 15:09:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fabiano Rosas X-Patchwork-Id: 849733 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp980826wry; Thu, 12 Dec 2024 07:11:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU7JG2BHthwqyligf0iLx/9Numlu22dMtaS+Crf61N59riCylzCVze6XX6CfrhA89nJLFUYVg==@linaro.org X-Google-Smtp-Source: AGHT+IG2sb78DLhj5RIuhG1Rm04SzoEX4thimftVAHSzaf1q971hooegi/ZH6COEnWTbmrGlLSRD X-Received: by 2002:a05:6102:14a3:b0:4af:fc14:f138 with SMTP id ada2fe7eead31-4b257f66b1fmr1008420137.7.1734016295765; Thu, 12 Dec 2024 07:11:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734016295; cv=none; d=google.com; s=arc-20240605; b=TvJMFOhHwwRelC30SkEEdJtB3jkAe62etXO7CtEDtgmW4D9muK8XXT3RFMNMyFvwdA mJOdp+XVrykw/kZukErLcJ0NZv5A9SKnVG7I8tiiBRHAfe6noXYVSpQ9rJ+p9YLdf0tS NljbUYC7QsRu0ol/NrQ/gNrP7iAZsOpQSBfXI0Rt8A5ioyEDdr+VuGeCuHZHKfDO6j8k YH2TxQR+ce/OCJuwBwOT4sLVzH4Z9V35OoJ32aAc3aHSM/ZbESjKcOYYTKw9EkTZ/hW9 t83TLf+eASnP3rPvn4+MacKdM9j88FZi0hBv3Igha7c/dQIz/+qJoNKEq3uR6093CwNX ODFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=EQndaw5sHoonjIqRW2sm/7RzQQ38owA3RD7Nq7q/xWI=; fh=alZCUczDNtN4yFLy44SM1yTUliPrh8AgZa0GP8izqo4=; b=YDTJmSU8KTR8IdncuX4hae5NYws0bsmrtIYLgXv9J4f3n9FuTg3zO5leSlHf1qFMka Y8QQPNH66X4K88iu+svMJxSYiTP7AX1jQE04mTCIR+T3d1+larrjod3lciAl4xHi1a3J dj50fxrU56nEerVQmvF2h5NcBhe8UOorFp2zA+TrYL/gSDaU9ppzDiUqXZjWKHvwc7JF TWjK+VhutaXCwSI+5DtP6dwX4S91+jBURtAExcx88AMCktBPaXO2IEtI83QZ7BksRe1D JOop6XsPDNFruGeDhwIEZxPk9F+YuwCuBYl9gjQHUKNUHSQyAOyZP8yZTZ9DMcXZf+V4 9aYw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=o8QFwR47; dkim=neutral (no key) header.i=@nongnu.org header.s=susede2_ed25519 header.b=o0qXIl+z; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=o8QFwR47; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4aff01210fcsi1742456137.226.2024.12.12.07.11.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Dec 2024 07:11:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=o8QFwR47; dkim=neutral (no key) header.i=@nongnu.org header.s=susede2_ed25519 header.b=o0qXIl+z; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=o8QFwR47; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLkpH-0003qu-T4; Thu, 12 Dec 2024 10:10:03 -0500 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 1tLkpF-0003pc-Ry for qemu-devel@nongnu.org; Thu, 12 Dec 2024 10:10:01 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLkpD-0002ys-Os for qemu-devel@nongnu.org; Thu, 12 Dec 2024 10:10:01 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 196AB2110B; Thu, 12 Dec 2024 15:09:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1734016198; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EQndaw5sHoonjIqRW2sm/7RzQQ38owA3RD7Nq7q/xWI=; b=o8QFwR47RVGwBazFWT9fernsAY1jrAkWGmd5W8CUIyBGqBO4BSM5SvSGe8hFOWhWrtpWcY FclOBbDZHZDLqSO2x3ixf4yQUpqbYZ8PmDwC+gAD22M5i6sbe5OOJSw2G/0WZ/PBwIwL6m Mlva8N/DPS8816OivJIS8xZ1qqGJyeo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1734016198; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EQndaw5sHoonjIqRW2sm/7RzQQ38owA3RD7Nq7q/xWI=; b=o0qXIl+zjQVZiqi+AlhByq7p57mLHuJ6T6qgykeQBiIYWLypZNlYRSsoOu/eXzXxXlsORG T3rJi8haO8v/DhDg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1734016198; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EQndaw5sHoonjIqRW2sm/7RzQQ38owA3RD7Nq7q/xWI=; b=o8QFwR47RVGwBazFWT9fernsAY1jrAkWGmd5W8CUIyBGqBO4BSM5SvSGe8hFOWhWrtpWcY FclOBbDZHZDLqSO2x3ixf4yQUpqbYZ8PmDwC+gAD22M5i6sbe5OOJSw2G/0WZ/PBwIwL6m Mlva8N/DPS8816OivJIS8xZ1qqGJyeo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1734016198; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EQndaw5sHoonjIqRW2sm/7RzQQ38owA3RD7Nq7q/xWI=; b=o0qXIl+zjQVZiqi+AlhByq7p57mLHuJ6T6qgykeQBiIYWLypZNlYRSsoOu/eXzXxXlsORG T3rJi8haO8v/DhDg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E02F213508; Thu, 12 Dec 2024 15:09:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id gEzYKMT8WmcTfQAAD6G6ig (envelope-from ); Thu, 12 Dec 2024 15:09:56 +0000 From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= Subject: [PULL 03/22] tests/qtest: Use qtest_system_reset() instead of open-coded versions Date: Thu, 12 Dec 2024 12:09:30 -0300 Message-Id: <20241212150949.16806-4-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241212150949.16806-1-farosas@suse.de> References: <20241212150949.16806-1-farosas@suse.de> MIME-Version: 1.0 X-Spam-Score: -3.30 X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, linaro.org:email, suse.de:mid, suse.de:email] Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell Use the qtest_system_reset() function in various tests that were previously open-coding the system-reset. Note that in several cases this fixes a bug where the test did not wait for the RESET QMP event before continuing. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Fabiano Rosas --- tests/qtest/bios-tables-test.c | 4 ++-- tests/qtest/boot-order-test.c | 7 +------ tests/qtest/hd-geo-test.c | 9 +-------- tests/qtest/q35-test.c | 12 ++---------- tests/qtest/qos-test.c | 3 +-- tests/qtest/stm32l4x5_gpio-test.c | 10 +--------- tests/qtest/stm32l4x5_syscfg-test.c | 12 ++---------- 7 files changed, 10 insertions(+), 47 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 16d0ffbdf6..6035ec2c61 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -959,7 +959,7 @@ static void test_acpi_piix4_tcg_bridge(void) free_test_data(&data); /* check that reboot/reset doesn't change any ACPI tables */ - qtest_qmp_send(data.qts, "{'execute':'system_reset' }"); + qtest_system_reset(data.qts); process_acpi_tables(&data); free_test_data(&data); } @@ -1216,7 +1216,7 @@ static void test_acpi_q35_multif_bridge(void) free_test_data(&data); /* check that reboot/reset doesn't change any ACPI tables */ - qtest_qmp_send(data.qts, "{'execute':'system_reset' }"); + qtest_system_reset(data.qts); process_acpi_tables(&data); free_test_data(&data); } diff --git a/tests/qtest/boot-order-test.c b/tests/qtest/boot-order-test.c index c67b8cfe16..4c851c2cdb 100644 --- a/tests/qtest/boot-order-test.c +++ b/tests/qtest/boot-order-test.c @@ -40,12 +40,7 @@ static void test_a_boot_order(const char *machine, machine ?: "", test_args); actual = read_boot_order(qts); g_assert_cmphex(actual, ==, expected_boot); - qtest_qmp_assert_success(qts, "{ 'execute': 'system_reset' }"); - /* - * system_reset only requests reset. We get a RESET event after - * the actual reset completes. Need to wait for that. - */ - qtest_qmp_eventwait(qts, "RESET"); + qtest_system_reset(qts); actual = read_boot_order(qts); g_assert_cmphex(actual, ==, expected_reboot); qtest_quit(qts); diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index 85eb8d7668..1c73dea8f7 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -900,7 +900,6 @@ static void test_override_hot_unplug(TestArgs *args, const char *devid, QTestState *qts; char *joined_args; QFWCFG *fw_cfg; - QDict *response; int i; joined_args = g_strjoinv(" ", args->argv); @@ -913,13 +912,7 @@ static void test_override_hot_unplug(TestArgs *args, const char *devid, /* unplug device an restart */ qtest_qmp_device_del_send(qts, devid); - response = qtest_qmp(qts, - "{ 'execute': 'system_reset', 'arguments': { }}"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); - - qtest_qmp_eventwait(qts, "RESET"); + qtest_system_reset(qts); read_bootdevices(fw_cfg, expected2); diff --git a/tests/qtest/q35-test.c b/tests/qtest/q35-test.c index c922d81bc0..7f58fc3746 100644 --- a/tests/qtest/q35-test.c +++ b/tests/qtest/q35-test.c @@ -83,7 +83,6 @@ static void test_smram_lock(void) { QPCIBus *pcibus; QPCIDevice *pcidev; - QDict *response; QTestState *qts; qts = qtest_init("-M q35"); @@ -107,10 +106,7 @@ static void test_smram_lock(void) g_assert(smram_test_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN) == false); /* reset */ - response = qtest_qmp(qts, "{'execute': 'system_reset', 'arguments': {} }"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); + qtest_system_reset(qts); /* check open is settable again */ smram_set_bit(pcidev, MCH_HOST_BRIDGE_SMRAM_D_OPEN, false); @@ -194,7 +190,6 @@ static void test_smram_smbase_lock(void) { QPCIBus *pcibus; QPCIDevice *pcidev; - QDict *response; QTestState *qts; int i; @@ -237,10 +232,7 @@ static void test_smram_smbase_lock(void) } /* reset */ - response = qtest_qmp(qts, "{'execute': 'system_reset', 'arguments': {} }"); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - qobject_unref(response); + qtest_system_reset(qts); /* check RAM at SMBASE is available after reset */ g_assert_cmpint(qtest_readb(qts, SMBASE), ==, SMRAM_TEST_PATTERN); diff --git a/tests/qtest/qos-test.c b/tests/qtest/qos-test.c index 114f6bef27..2f7e75a339 100644 --- a/tests/qtest/qos-test.c +++ b/tests/qtest/qos-test.c @@ -103,8 +103,7 @@ static void restart_qemu_or_continue(char *path) old_path = g_strdup(path); qtest_start(path); } else { /* if cmd line is the same, reset the guest */ - qobject_unref(qmp("{ 'execute': 'system_reset' }")); - qmp_eventwait("RESET"); + qtest_system_reset(global_qtest); } } diff --git a/tests/qtest/stm32l4x5_gpio-test.c b/tests/qtest/stm32l4x5_gpio-test.c index c0686c7b30..3c6ea71feb 100644 --- a/tests/qtest/stm32l4x5_gpio-test.c +++ b/tests/qtest/stm32l4x5_gpio-test.c @@ -169,14 +169,6 @@ static uint32_t reset(uint32_t gpio, unsigned int offset) return 0x0; } -static void system_reset(void) -{ - QDict *r; - r = qtest_qmp(global_qtest, "{'execute': 'system_reset'}"); - g_assert_false(qdict_haskey(r, "error")); - qobject_unref(r); -} - static void test_idr_reset_value(void) { /* @@ -214,7 +206,7 @@ static void test_idr_reset_value(void) gpio_writel(GPIO_H, OTYPER, 0xDEADBEEF); gpio_writel(GPIO_H, PUPDR, 0xDEADBEEF); - system_reset(); + qtest_system_reset(global_qtest); uint32_t moder = gpio_readl(GPIO_A, MODER); uint32_t odr = gpio_readl(GPIO_A, ODR); diff --git a/tests/qtest/stm32l4x5_syscfg-test.c b/tests/qtest/stm32l4x5_syscfg-test.c index d5c71e2c0e..376c80e31c 100644 --- a/tests/qtest/stm32l4x5_syscfg-test.c +++ b/tests/qtest/stm32l4x5_syscfg-test.c @@ -47,14 +47,6 @@ static void syscfg_set_irq(int num, int level) qtest_set_irq_in(global_qtest, SOC, NULL, num, level); } -static void system_reset(void) -{ - QDict *response; - response = qtest_qmp(global_qtest, "{'execute': 'system_reset'}"); - g_assert(qdict_haskey(response, "return")); - qobject_unref(response); -} - static void test_reset(void) { /* @@ -182,7 +174,7 @@ static void test_set_only_bits(void) syscfg_writel(SYSCFG_SWPR2, 0x00000000); g_assert_cmphex(syscfg_readl(SYSCFG_SWPR2), ==, 0xFFFFFFFF); - system_reset(); + qtest_system_reset(global_qtest); } static void test_clear_only_bits(void) @@ -194,7 +186,7 @@ static void test_clear_only_bits(void) syscfg_writel(SYSCFG_CFGR1, 0x00000001); g_assert_cmphex(syscfg_readl(SYSCFG_CFGR1), ==, 0x00000000); - system_reset(); + qtest_system_reset(global_qtest); } static void test_interrupt(void) From patchwork Thu Dec 12 15:09:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabiano Rosas X-Patchwork-Id: 849734 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:2c4:b0:385:e875:8a9e with SMTP id o4csp981846wry; Thu, 12 Dec 2024 07:13:07 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWhNgtzT/0PP/2IM86Fy9JkT+J5Fm38dOSj/QsI02/ny9C9R8Bgaci63Bp/zfA/SbNvdfhuug==@linaro.org X-Google-Smtp-Source: AGHT+IE8ORN8lL4ejpp060Eb+cReDAGNWm5NgIQR9bPIGimvDWFBzk7kZ22AEg28pwRUzLo5VNPY X-Received: by 2002:ad4:4ee4:0:b0:6d8:8a7b:66a4 with SMTP id 6a1803df08f44-6db0f73375amr9018486d6.14.1734016387778; Thu, 12 Dec 2024 07:13:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1734016387; cv=none; d=google.com; s=arc-20240605; b=dc8u1tvsznk1cVGJDVlnbIKc5KFJIj1O8eaZ0PuRzU7vB5TBHKSi5Te7DFiSxm+tsN NWLGmzPLb3P5uYy6rLxgQ1F0CK5uSpmRrR2aYOXS2eBV8APavEzoBV4T27cfBvf/LOPL uYBQt229rfBKVgrFuPMkWm5L/s1IE52CavCIVMgejn6kW5K4hKPWPZpehBGvk9K8KmZA PRbciW5g79UATm4Sq4Fpu0PMPCbKx4rB1Yz/fEyxmNWQqATEIgUDO9DrASIUdbO6AXjZ BpZokpYzd1a05QfF5WaLZd8Xg/DVKnHv7lsBmxAIU+/d2PkUoTvFf308C+Dsf8T1yTW3 TfJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=ZyY8AA8dfYgg8xgEH5Ccjm5JgvsAKqt9DjcNW2EPL/g=; fh=tOREyZHlK9Diwyw/7bj5IUyLT4I5EVkj5DE8XDtMiTs=; b=LCIW9pcSmW3Oe/FoQb335OwxB72jUv4UtAzAUKWjRDhB5Goql/QicQi8ZThp4Tew8l QSaZ9Y5+W0HajyVVmB3PyZ8N6SzcBLFTJ41pRTK9q2XEiWPchYOCl/oWE1H2C84HkWTd dol5iVTbF8dG8+0sBJ1/9+QnBZOv8V8o5++G232gHrkyuQc/2FOmec5GedXx3IarkFmd eWdK/bGXEe+Z6mtMJWaouseM5tNyK2+wLeNpqYkkDN3KAhPHKgP6l//4KSU+LezjUsLW 1jpeAdRdJdY5tB9fO6wJ1AbaFIZQ0uUjB4bCWZJb93ZnudhPdlSNtNtD74lQoKorcqfc Ovaw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1xpeuBMS; dkim=neutral (no key) header.i=@nongnu.org header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1xpeuBMS; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51896715846si1498688e0c.289.2024.12.12.07.13.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Dec 2024 07:13:07 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1xpeuBMS; dkim=neutral (no key) header.i=@nongnu.org header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1xpeuBMS; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLkpI-0003sW-Rb; Thu, 12 Dec 2024 10:10:04 -0500 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 1tLkpG-0003pw-HL for qemu-devel@nongnu.org; Thu, 12 Dec 2024 10:10:02 -0500 Received: from smtp-out1.suse.de ([2a07:de40:b251:101:10:150:64:1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tLkpE-0002z4-Je for qemu-devel@nongnu.org; Thu, 12 Dec 2024 10:10:02 -0500 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7A87221137; Thu, 12 Dec 2024 15:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1734016199; 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=ZyY8AA8dfYgg8xgEH5Ccjm5JgvsAKqt9DjcNW2EPL/g=; b=1xpeuBMSJLec34SUTyRKGzJkvbIS9jIpcC5UknIIrt07MzmohNnrMed5ag37FSLqQwnwd6 7IF8TTdZjOvSgLwwu7vdQsqy9ESb6ihIYj6zfV82pRjk6J2aekDZ+DYoOC2sP5VUx9bl8B 8AK+0jkYhEQMXOtfmtlCzXk53niDMvc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1734016199; 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=ZyY8AA8dfYgg8xgEH5Ccjm5JgvsAKqt9DjcNW2EPL/g=; b=UEM8APgO/nARzWzYZfM7CwyERLdt15YGly79N5sQUzS9zwNwC48L0NYfUQXVJ7XPUKkPe6 Eanb9lPmzGqV7hBQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1734016199; 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=ZyY8AA8dfYgg8xgEH5Ccjm5JgvsAKqt9DjcNW2EPL/g=; b=1xpeuBMSJLec34SUTyRKGzJkvbIS9jIpcC5UknIIrt07MzmohNnrMed5ag37FSLqQwnwd6 7IF8TTdZjOvSgLwwu7vdQsqy9ESb6ihIYj6zfV82pRjk6J2aekDZ+DYoOC2sP5VUx9bl8B 8AK+0jkYhEQMXOtfmtlCzXk53niDMvc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1734016199; 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=ZyY8AA8dfYgg8xgEH5Ccjm5JgvsAKqt9DjcNW2EPL/g=; b=UEM8APgO/nARzWzYZfM7CwyERLdt15YGly79N5sQUzS9zwNwC48L0NYfUQXVJ7XPUKkPe6 Eanb9lPmzGqV7hBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8663C13508; Thu, 12 Dec 2024 15:09:58 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id QAcPE8b8WmcTfQAAD6G6ig (envelope-from ); Thu, 12 Dec 2024 15:09:58 +0000 From: Fabiano Rosas To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 04/22] tests/qtest: Use qtest_system_reset_nowait() where appropriate Date: Thu, 12 Dec 2024 12:09:31 -0300 Message-Id: <20241212150949.16806-5-farosas@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20241212150949.16806-1-farosas@suse.de> References: <20241212150949.16806-1-farosas@suse.de> MIME-Version: 1.0 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo,linaro.org:email]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -2.80 Received-SPF: pass client-ip=2a07:de40:b251:101:10:150:64:1; envelope-from=farosas@suse.de; helo=smtp-out1.suse.de X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell In the device and drive plug/unplug tests we want to trigger a system reset and then see if we get the appropriate DEVICE_DELETED event. Use qtest_system_reset_nowait() here. Signed-off-by: Peter Maydell Reviewed-by: Fabiano Rosas Signed-off-by: Fabiano Rosas --- tests/qtest/device-plug-test.c | 11 +---------- tests/qtest/drive_del-test.c | 7 +------ 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index c6f33153eb..127a7f9efe 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -15,15 +15,6 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" -static void system_reset(QTestState *qtest) -{ - QDict *resp; - - resp = qtest_qmp(qtest, "{'execute': 'system_reset'}"); - g_assert(qdict_haskey(resp, "return")); - qobject_unref(resp); -} - static void wait_device_deleted_event(QTestState *qtest, const char *id) { QDict *resp, *data; @@ -58,7 +49,7 @@ static void process_device_remove(QTestState *qtest, const char *id) * handled, removing the device. */ qtest_qmp_device_del_send(qtest, id); - system_reset(qtest); + qtest_system_reset_nowait(qtest); wait_device_deleted_event(qtest, id); } diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 7b67a4bbee..99f6fc2de1 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -154,15 +154,10 @@ static void device_add(QTestState *qts) static void device_del(QTestState *qts, bool and_reset) { - QDict *response; - qtest_qmp_device_del_send(qts, "dev0"); if (and_reset) { - response = qtest_qmp(qts, "{'execute': 'system_reset' }"); - g_assert(response); - g_assert(qdict_haskey(response, "return")); - qobject_unref(response); + qtest_system_reset_nowait(qts); } qtest_qmp_eventwait(qts, "DEVICE_DELETED");