2014-04-28 13:01:13 +04:00
|
|
|
/*
|
|
|
|
* QTest testcase for vga cards
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014 Red Hat, Inc
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*/
|
|
|
|
|
2016-02-08 21:08:51 +03:00
|
|
|
#include "qemu/osdep.h"
|
2023-01-30 13:44:43 +03:00
|
|
|
#include "libqtest.h"
|
2014-04-28 13:02:58 +04:00
|
|
|
|
|
|
|
static void pci_multihead(void)
|
|
|
|
{
|
2023-01-30 13:44:43 +03:00
|
|
|
QTestState *qts;
|
2014-04-28 13:02:58 +04:00
|
|
|
|
2023-01-30 13:44:43 +03:00
|
|
|
qts = qtest_init("-vga none -device VGA -device secondary-vga");
|
|
|
|
qtest_quit(qts);
|
2014-04-28 13:10:12 +04:00
|
|
|
}
|
|
|
|
|
2023-01-30 13:44:43 +03:00
|
|
|
static void test_vga(gconstpointer data)
|
2014-04-28 13:10:12 +04:00
|
|
|
{
|
2023-01-30 13:44:43 +03:00
|
|
|
QTestState *qts;
|
|
|
|
|
|
|
|
qts = qtest_initf("-vga none -device %s", (const char *)data);
|
|
|
|
qtest_quit(qts);
|
2014-04-28 13:10:12 +04:00
|
|
|
}
|
|
|
|
|
2014-04-28 13:01:13 +04:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2023-01-30 13:44:43 +03:00
|
|
|
static const char *devices[] = {
|
|
|
|
"cirrus-vga",
|
|
|
|
"VGA",
|
|
|
|
"secondary-vga",
|
|
|
|
"virtio-gpu-pci",
|
|
|
|
"virtio-vga"
|
|
|
|
};
|
2017-01-05 18:29:45 +03:00
|
|
|
|
2014-04-28 13:01:13 +04:00
|
|
|
g_test_init(&argc, &argv, NULL);
|
|
|
|
|
2023-01-30 13:44:43 +03:00
|
|
|
for (int i = 0; i < ARRAY_SIZE(devices); i++) {
|
|
|
|
if (qtest_has_device(devices[i])) {
|
|
|
|
char *testpath = g_strdup_printf("/display/pci/%s", devices[i]);
|
|
|
|
qtest_add_data_func(testpath, devices[i], test_vga);
|
|
|
|
g_free(testpath);
|
|
|
|
}
|
2017-01-05 18:29:45 +03:00
|
|
|
}
|
2023-01-30 13:44:43 +03:00
|
|
|
|
|
|
|
if (qtest_has_device("secondary-vga")) {
|
|
|
|
qtest_add_func("/display/pci/multihead", pci_multihead);
|
2018-11-29 14:50:48 +03:00
|
|
|
}
|
|
|
|
|
2016-06-14 00:57:58 +03:00
|
|
|
return g_test_run();
|
2014-04-28 13:01:13 +04:00
|
|
|
}
|