qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PULL 21/46] tests/qtest: add a test case for pvpanic-pci


From: Peter Maydell
Subject: Re: [PULL 21/46] tests/qtest: add a test case for pvpanic-pci
Date: Fri, 29 Jan 2021 15:57:08 +0000

On Fri, 29 Jan 2021 at 11:00, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> From: Mihai Carabas <mihai.carabas@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.carabas@oracle.com>
> Acked-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Mihai Carabas <mihai.carabas@oracle.com>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

This turns out to trigger the oss-fuzz build's leak-sanitizer:
https://gitlab.com/qemu-project/qemu/-/jobs/995177788

> +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.

> +    qtest_quit(qts);
> + }

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]