aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/libqtest.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/qtest/libqtest.c')
-rw-r--r--tests/qtest/libqtest.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 7ae2dc4e1d..65ed949685 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -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.
*/