mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
tests/qtest: Add a function to check whether a machine is available
It is nowadays possible to build QEMU with a reduced set of machines in each binary. However, the qtests still hard-code the expected machines and fail if the binary does not feature the required machine. Let's get a little bit more flexible here: Add a function that can be used to query whether a certain machine is available or not, and use it in some tests as an example (more work has to be done in other tests which will follow later). Message-Id: <20211201104347.51922-5-thuth@redhat.com> Acked-by: John Snow <jsnow@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
5516a3b592
commit
719051ca3f
5 changed files with 37 additions and 7 deletions
|
@ -1401,6 +1401,23 @@ void qtest_cb_for_every_machine(void (*cb)(const char *machine),
|
|||
}
|
||||
}
|
||||
|
||||
bool qtest_has_machine(const char *machine)
|
||||
{
|
||||
struct MachInfo *machines;
|
||||
int i;
|
||||
|
||||
machines = qtest_get_machines();
|
||||
|
||||
for (i = 0; machines[i].name != NULL; i++) {
|
||||
if (g_str_equal(machine, machines[i].name) ||
|
||||
(machines[i].alias && g_str_equal(machine, machines[i].alias))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic hot-plugging test via the device_add QMP commands.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue