From patchwork Mon May 27 06:27:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13674598 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B3DC17BA9 for ; Mon, 27 May 2024 06:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716791288; cv=none; b=Q/jAcogoFuSBA0NWBB0lovh+J8VzRPnzRc6ng4JNKLyrxxkPxEW617p/PnxhpXUkfSFIIfhnQrlIyYwLNWymiw1PhUVJDiLrSDNJlbMxuoxaXPwF8uveVY/EHJIcKjxPYJawPVZbnp74tTm/FLf4I645o3LnZ/dD+O587K5d3vM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716791288; c=relaxed/simple; bh=MKkiWNtUHtqwAlYS3tCoUMqli/hyolEiaj3niH9CQzQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qwD6WqQ/xPuioWeVP/Czz604JWohVXzmf1mWAzZxcCpf5yuzJOAT49F9WBdiqXuLetjW4wAoH07NWWppOVVZZ2wPEq2ge41GQwKceZO/8SDuABZIz2f2Ir3u8RiJQCgcGGoL7g/dQE7iLsl690o3qkYZdiVx8PdGAu9p+KDpWhI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=t-8ch.de; spf=pass smtp.mailfrom=t-8ch.de; dkim=pass (1024-bit key) header.d=t-8ch.de header.i=@t-8ch.de header.b=auny1w3Q; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=t-8ch.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=t-8ch.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=t-8ch.de header.i=@t-8ch.de header.b="auny1w3Q" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=t-8ch.de; s=mail; t=1716791283; bh=MKkiWNtUHtqwAlYS3tCoUMqli/hyolEiaj3niH9CQzQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=auny1w3QYet07BgnB6NGh2mZvKDQ40Bt6EF5dDC0tvp5wScBMq6n2dWZZ1Dr9p5QB nfBl+XMMkVXZCY0lFyMQAfHDsQ1seZYHizXyG3WsC4xlNxlxJP4dfRhsxL2ALBT1zV mkvln7YDT2n+ldV/jGyRnbWi9U2+AQq69sx2vhDU= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 27 May 2024 08:27:50 +0200 Subject: [PATCH v8 4/8] tests/qtest/pvpanic: use centralized definition of supported events Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240527-pvpanic-shutdown-v8-4-5a28ec02558b@t-8ch.de> References: <20240527-pvpanic-shutdown-v8-0-5a28ec02558b@t-8ch.de> In-Reply-To: <20240527-pvpanic-shutdown-v8-0-5a28ec02558b@t-8ch.de> To: "Michael S. Tsirkin" , Cornelia Huck , Paolo Bonzini , Thomas Huth , Laurent Vivier , Eric Blake , Markus Armbruster Cc: qemu-devel@nongnu.org, Alejandro Jimenez , kvm@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1716791282; l=2303; i=thomas@t-8ch.de; s=20221212; h=from:subject:message-id; bh=MKkiWNtUHtqwAlYS3tCoUMqli/hyolEiaj3niH9CQzQ=; b=BIUC2v+NvtNxb2Q5ESQdfDcjaWm0JsaLZwK+P8mC/vMA/+bhQAa4x0WTDGGZVNondmSXoYeOb jjGJ6xI4f/MC3+5uS0Lgg7wEZ/ARWSdhGrjgtBHIspDcG/R4mrntNeQ X-Developer-Key: i=thomas@t-8ch.de; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Avoid the necessity to update all tests when new events are added to the device. Acked-by: Thomas Huth Reviewed-by: Cornelia Huck Signed-off-by: Thomas Weißschuh --- tests/qtest/pvpanic-pci-test.c | 5 +++-- tests/qtest/pvpanic-test.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/qtest/pvpanic-pci-test.c b/tests/qtest/pvpanic-pci-test.c index 2c05b376ba72..b372caf41dc0 100644 --- a/tests/qtest/pvpanic-pci-test.c +++ b/tests/qtest/pvpanic-pci-test.c @@ -16,6 +16,7 @@ #include "qapi/qmp/qdict.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" +#include "hw/misc/pvpanic.h" #include "hw/pci/pci_regs.h" static void test_panic_nopause(void) @@ -34,7 +35,7 @@ static void test_panic_nopause(void) bar = qpci_iomap(dev, 0, NULL); qpci_memread(dev, bar, 0, &val, sizeof(val)); - g_assert_cmpuint(val, ==, 3); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); val = 1; qpci_memwrite(dev, bar, 0, &val, sizeof(val)); @@ -67,7 +68,7 @@ static void test_panic(void) bar = qpci_iomap(dev, 0, NULL); qpci_memread(dev, bar, 0, &val, sizeof(val)); - g_assert_cmpuint(val, ==, 3); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); val = 1; qpci_memwrite(dev, bar, 0, &val, sizeof(val)); diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c index 78f1cf8186b0..ccc603472f5d 100644 --- a/tests/qtest/pvpanic-test.c +++ b/tests/qtest/pvpanic-test.c @@ -10,6 +10,7 @@ #include "qemu/osdep.h" #include "libqtest.h" #include "qapi/qmp/qdict.h" +#include "hw/misc/pvpanic.h" static void test_panic_nopause(void) { @@ -20,7 +21,7 @@ static void test_panic_nopause(void) qts = qtest_init("-device pvpanic -action panic=none"); val = qtest_inb(qts, 0x505); - g_assert_cmpuint(val, ==, 3); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); qtest_outb(qts, 0x505, 0x1); @@ -43,7 +44,7 @@ static void test_panic(void) qts = qtest_init("-device pvpanic -action panic=pause"); val = qtest_inb(qts, 0x505); - g_assert_cmpuint(val, ==, 3); + g_assert_cmpuint(val, ==, PVPANIC_EVENTS); qtest_outb(qts, 0x505, 0x1);