From: Markus Armbruster <armbru@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Peter Xu" <peterx@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: -device T,help crashes
Date: Tue, 17 Mar 2026 10:27:41 +0100 [thread overview]
Message-ID: <87jyvakdpu.fsf@pond.sub.org> (raw)
In-Reply-To: <af46754d-5602-41ec-9971-b3a3e3591ba9@redhat.com> (Thomas Huth's message of "Tue, 17 Mar 2026 09:12:50 +0100")
Thomas Huth <thuth@redhat.com> writes:
> On 17/03/2026 08.35, Markus Armbruster wrote:
>> Thomas Huth <thuth@redhat.com> writes:
>>
>>> On 12/03/2026 09.15, Markus Armbruster wrote:
>>>> Markus Armbruster <armbru@redhat.com> writes:
>>> ...
>>>>> These crashes escape tests/qtest/device-introspect-test, because it
>>>>> covers only HMP "device_add T,help", not CLI "-device T,help".
>>>>
>>>> Anyone wants to cook up a patch to cover -device?
>>>
>>> Quick'n'dirty patch:
>>>
>>> diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-introspect-test.c
>>> --- a/tests/qtest/device-introspect-test.c
>>> +++ b/tests/qtest/device-introspect-test.c
>>> @@ -105,6 +105,7 @@ static void test_one_device(QTestState *qts, const char *type)
>>> QDict *resp;
>>> char *help, *escaped;
>>> GRegex *comma;
>>> + int ret;
>>>
>>> g_test_message("Testing device '%s'", type);
>>>
>>> @@ -119,6 +120,17 @@ static void test_one_device(QTestState *qts, const char *type)
>>>
>>> help = qtest_hmp(qts, "device_add \"%s,help\"", escaped);
>>> g_free(help);
>>> +
>>> + if (!g_str_equal(type, "nonexistent") && !g_str_equal(type, "device")) {
>>> + help = g_strdup_printf("%s -device \"%s,help\" > /dev/null", qtest_qemu_binary(NULL), escaped);
>>> + ret = system(help);
>>
>> Not using qtest_init() or similar. Hmm.
>
> I mentioned it's quick-n-dirty ;-)
Fair, fair :)
>>> + g_free(help);
>>> + if (ret) {
>>> + fprintf(stderr, "Running qemu with -device %s,help failed!\n", escaped);
>>> + abort();
>>> + }
>>> + }
>>> +
>>> g_free(escaped);
>>> }
>>>
>>> But I think it needs some more work - we likely don't want to run this for each test run since it slows down the test quite a bit. And the g_test_quick() switch is already used for something else here.
>>
>> It's used to test with every machine type, not just with "none".
>>
>> I think we could also use it to additionally test -device just with
>> "none". Testing it with every machine type would be even slower, and I
>> doubt it's worthwhile.
>
> Agreed.
>
>> Another idea to conserve cycles: use a unit test instead.
>
> Unit tests don't have a way yet to determine which qemu-system-xyz binaries
> are available, do they? ... so that would need some more logic in the
> meson.build file there - not sure whether that's worth the effort, I think
> the device-introspect qtest is likely a better place?
A unit test isn't supposed to run qemu-system-xyz. Instead, it mocks up
the environment and just runs "the unit". In this case,
qdev_device_help().
This is less protection than a qtest, but it can also be a lot faster.
> Or maybe add it to scripts/device-crash-test ?
That's another option.
[...]
next prev parent reply other threads:[~2026-03-17 9:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 14:09 -device T,help crashes Markus Armbruster
2026-03-11 14:55 ` Peter Maydell
2026-03-11 15:14 ` Thomas Huth
2026-03-12 8:05 ` Markus Armbruster
2026-03-11 15:16 ` BALATON Zoltan
2026-03-12 8:15 ` Markus Armbruster
2026-03-17 6:24 ` Thomas Huth
2026-03-17 7:35 ` Markus Armbruster
2026-03-17 8:12 ` Thomas Huth
2026-03-17 9:27 ` Markus Armbruster [this message]
2026-03-17 9:37 ` Thomas Huth
2026-03-17 10:30 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87jyvakdpu.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.