La 29.01.2021 17:57, Peter Maydell a scris:
On Fri, 29 Jan 2021 at 11:00, Peter Maydell <peter.mayd...@linaro.org> wrote:
From: Mihai Carabas <mihai.cara...@oracle.com>
Add a test case for pvpanic-pci device. The scenario is the same as pvpanic
ISA device, but is using the PCI bus.
Signed-off-by: Mihai Carabas <mihai.cara...@oracle.com>
Acked-by: Thomas Huth <th...@redhat.com>
Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>
Signed-off-by: Mihai Carabas <mihai.cara...@oracle.com>
Signed-off-by: Peter Maydell <peter.mayd...@linaro.org>
This turns out to trigger the oss-fuzz build's leak-sanitizer:
https://urldefense.com/v3/__https://gitlab.com/qemu-project/qemu/-/jobs/995177788__;!!GqivPVa7Brio!IGLAgdVRl_78c_PuUhuLJVDG1KFnc1gv3Pf1yTTcSiizygGvYHmq3YQ3YxwmMAwSMQ$
+static void test_panic_nopause(void)
+{
+ uint8_t val;
+ QDict *response, *data;
+ QTestState *qts;
+ QPCIBus *pcibus;
+ QPCIDevice *dev;
+ QPCIBar bar;
+
+ qts = qtest_init("-device pvpanic-pci,addr=04.0 -action panic=none");
+ pcibus = qpci_new_pc(qts, NULL);
+ dev = qpci_device_find(pcibus, QPCI_DEVFN(0x4, 0x0));
+ qpci_device_enable(dev);
+ bar = qpci_iomap(dev, 0, NULL);
+
+ qpci_memread(dev, bar, 0, &val, sizeof(val));
+ g_assert_cmpuint(val, ==, 3);
+
+ val = 1;
+ qpci_memwrite(dev, bar, 0, &val, sizeof(val));
+
+ response = qtest_qmp_eventwait_ref(qts, "GUEST_PANICKED");
+ g_assert(qdict_haskey(response, "data"));
+ data = qdict_get_qdict(response, "data");
+ g_assert(qdict_haskey(data, "action"));
+ g_assert_cmpstr(qdict_get_str(data, "action"), ==, "run");
+ qobject_unref(response);
+
I'm going to squash in the trivial fix, which is to add
g_free(dev);
qpci_free_pc(pcibus);
here and similarly in the test_panic() function.
Thank you! Sorry for missing that trivial leak:(.
Thanks,
Mihai
+ qtest_quit(qts);
+ }
thanks
-- PMM