diff options
author | Thomas Huth <thuth@redhat.com> | 2021-12-01 11:43:47 +0100 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2021-12-15 08:08:59 +0100 |
commit | 719051ca3fd0ee765d8a80670df1a0292aa566f0 (patch) | |
tree | e51fcebb99953a8c34bbe22bdb85fd8db6479450 /tests/qtest/prom-env-test.c | |
parent | 5516a3b592def4de7fa78153912470f160814e5a (diff) | |
download | qemu-719051ca3fd0ee765d8a80670df1a0292aa566f0.zip qemu-719051ca3fd0ee765d8a80670df1a0292aa566f0.tar.gz qemu-719051ca3fd0ee765d8a80670df1a0292aa566f0.tar.bz2 |
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>
Diffstat (limited to 'tests/qtest/prom-env-test.c')
-rw-r--r-- | tests/qtest/prom-env-test.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/qtest/prom-env-test.c b/tests/qtest/prom-env-test.c index f41d801..bdbb01d 100644 --- a/tests/qtest/prom-env-test.c +++ b/tests/qtest/prom-env-test.c @@ -71,9 +71,11 @@ static void add_tests(const char *machines[]) char *name; for (i = 0; machines[i] != NULL; i++) { - name = g_strdup_printf("prom-env/%s", machines[i]); - qtest_add_data_func(name, machines[i], test_machine); - g_free(name); + if (qtest_has_machine(machines[i])) { + name = g_strdup_printf("prom-env/%s", machines[i]); + qtest_add_data_func(name, machines[i], test_machine); + g_free(name); + } } } |