Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / qtest / display-vga-test.c
blob75b341a9c69aff7ec5960db61f87ba07e253dc8d
1 /*
2 * QTest testcase for vga cards
4 * Copyright (c) 2014 Red Hat, Inc
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #include "qemu/osdep.h"
11 #include "libqtest.h"
13 static void pci_multihead(void)
15 QTestState *qts;
17 qts = qtest_init("-vga none -device VGA -device secondary-vga");
18 qtest_quit(qts);
21 static void test_vga(gconstpointer data)
23 QTestState *qts;
25 qts = qtest_initf("-vga none -device %s", (const char *)data);
26 qtest_quit(qts);
29 int main(int argc, char **argv)
31 static const char *devices[] = {
32 "cirrus-vga",
33 "VGA",
34 "secondary-vga",
35 "virtio-gpu-pci",
36 "virtio-vga"
39 g_test_init(&argc, &argv, NULL);
41 for (int i = 0; i < ARRAY_SIZE(devices); i++) {
42 if (qtest_has_device(devices[i])) {
43 char *testpath = g_strdup_printf("/display/pci/%s", devices[i]);
44 qtest_add_data_func(testpath, devices[i], test_vga);
45 g_free(testpath);
49 if (qtest_has_device("secondary-vga")) {
50 qtest_add_func("/display/pci/multihead", pci_multihead);
53 return g_test_run();