aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/pvpanic-test.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-07-03 20:54:17 -0700
committerRichard Henderson <richard.henderson@linaro.org>2024-07-03 20:54:17 -0700
commit1406b7fc4bbaab42133b1ef03270179746e91723 (patch)
tree06417fdecf690ec74b83d1a30a3f7f87fabeaf10 /tests/qtest/pvpanic-test.c
parent7914bda497f07965f15a91905cd7ed9eaf1c1092 (diff)
parent6a67577d8003428bdbeba61d32a9f8158f12624b (diff)
downloadqemu-1406b7fc4bbaab42133b1ef03270179746e91723.zip
qemu-1406b7fc4bbaab42133b1ef03270179746e91723.tar.gz
qemu-1406b7fc4bbaab42133b1ef03270179746e91723.tar.bz2
Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging
virtio: features,fixes A bunch of improvements: - vhost dirty log is now only scanned once, not once per device - virtio and vhost now support VIRTIO_F_NOTIFICATION_DATA - cxl gained DCD emulation support - pvpanic gained shutdown support - beginning of patchset for Generic Port Affinity Structure - s3 support - friendlier error messages when boot fails on some illegal configs - for vhost-user, VHOST_USER_SET_LOG_BASE is now only sent once - part of vhost-user support for any POSIX system - not yet enabled due to qtest failures - sr-iov VF setup code has been reworked significantly - new tests, particularly for risc-v ACPI - bugfixes Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # -----BEGIN PGP SIGNATURE----- # # iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmaF068PHG1zdEByZWRo # YXQuY29tAAoJECgfDbjSjVRp+DMIAMC//mBXIZlPprfhb5cuZklxYi31Acgu5TUr # njqjCkN+mFhXXZuc3B67xmrQ066IEPtsbzCjSnzuU41YK4tjvO1g+LgYJBv41G16 # va2k8vFM5pdvRA+UC9li1CCIPxiEcszxOdzZemj3szWLVLLUmwsc5OZLWWeFA5m8 # vXrrT9miODUz3z8/Xn/TVpxnmD6glKYIRK/IJRzzC4Qqqwb5H3ji/BJV27cDUtdC # w6ns5RYIj5j4uAiG8wQNDggA1bMsTxFxThRDUwxlxaIwAcexrf1oRnxGRePA7PVG # BXrt5yodrZYR2sR6svmOOIF3wPMUDKdlAItTcEgYyxaVo5rAdpc= # =p9h4 # -----END PGP SIGNATURE----- # gpg: Signature made Wed 03 Jul 2024 03:41:51 PM PDT # gpg: using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469 # gpg: issuer "mst@redhat.com" # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [undefined] # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" [undefined] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 0270 606B 6F3C DF3D 0B17 0970 C350 3912 AFBE 8E67 # Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA 8A0D 281F 0DB8 D28D 5469 * tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu: (85 commits) hw/pci: Replace -1 with UINT32_MAX for romsize pcie_sriov: Register VFs after migration pcie_sriov: Remove num_vfs from PCIESriovPF pcie_sriov: Release VFs failed to realize pcie_sriov: Reuse SR-IOV VF device instances pcie_sriov: Ensure VF function number does not overflow pcie_sriov: Do not manually unrealize hw/ppc/spapr_pci: Do not reject VFs created after a PF hw/ppc/spapr_pci: Do not create DT for disabled PCI device hw/pci: Rename has_power to enabled virtio-iommu: Clear IOMMUDevice when VFIO device is unplugged virtio: remove virtio_tswap16s() call in vring_packed_event_read() hw/cxl/events: Mark cxl-add-dynamic-capacity and cxl-release-dynamic-capcity unstable hw/cxl/events: Improve QMP interfaces and documentation for add/release dynamic capacity. tests/data/acpi/rebuild-expected-aml.sh: Add RISC-V pc-bios/meson.build: Add support for RISC-V in unpack_edk2_blobs meson.build: Add RISC-V to the edk2-target list tests/data/acpi/virt: Move ARM64 ACPI tables under aarch64/${machine} path tests/data/acpi: Move x86 ACPI tables under x86/${machine} path tests/qtest/bios-tables-test.c: Set "arch" for x86 tests ... Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests/qtest/pvpanic-test.c')
-rw-r--r--tests/qtest/pvpanic-test.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c
index 78f1cf8..d49d2ba 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);
@@ -57,11 +58,40 @@ static void test_panic(void)
qtest_quit(qts);
}
+static void test_pvshutdown(void)
+{
+ uint8_t val;
+ QDict *response, *data;
+ QTestState *qts;
+
+ qts = qtest_init("-device pvpanic");
+
+ val = qtest_inb(qts, 0x505);
+ g_assert_cmpuint(val, ==, PVPANIC_EVENTS);
+
+ qtest_outb(qts, 0x505, PVPANIC_SHUTDOWN);
+
+ response = qtest_qmp_eventwait_ref(qts, "GUEST_PVSHUTDOWN");
+ qobject_unref(response);
+
+ response = qtest_qmp_eventwait_ref(qts, "SHUTDOWN");
+ g_assert(qdict_haskey(response, "data"));
+ data = qdict_get_qdict(response, "data");
+ g_assert(qdict_haskey(data, "guest"));
+ g_assert(qdict_get_bool(data, "guest"));
+ g_assert(qdict_haskey(data, "reason"));
+ g_assert_cmpstr(qdict_get_str(data, "reason"), ==, "guest-shutdown");
+ qobject_unref(response);
+
+ qtest_quit(qts);
+}
+
int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
qtest_add_func("/pvpanic/panic", test_panic);
qtest_add_func("/pvpanic/panic-nopause", test_panic_nopause);
+ qtest_add_func("/pvpanic/pvshutdown", test_pvshutdown);
return g_test_run();
}