Gerd Hoffmann | 0850fd5 | 2014-04-28 11:01:13 +0200 | [diff] [blame] | 1 | /* |
| 2 | * QTest testcase for vga cards |
| 3 | * |
| 4 | * Copyright (c) 2014 Red Hat, Inc |
| 5 | * |
| 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 | */ |
| 9 | |
Gerd Hoffmann | 0850fd5 | 2014-04-28 11:01:13 +0200 | [diff] [blame] | 10 | #include "qemu/osdep.h" |
Peter Maydell | 681c28a | 2016-02-08 18:08:51 +0000 | [diff] [blame] | 11 | #include "libqtest.h" |
Gerd Hoffmann | 0850fd5 | 2014-04-28 11:01:13 +0200 | [diff] [blame] | 12 | |
| 13 | static void pci_cirrus(void) |
| 14 | { |
| 15 | qtest_start("-vga none -device cirrus-vga"); |
| 16 | qtest_end(); |
| 17 | } |
| 18 | |
| 19 | static void pci_stdvga(void) |
| 20 | { |
| 21 | qtest_start("-vga none -device VGA"); |
| 22 | qtest_end(); |
| 23 | } |
| 24 | |
Gerd Hoffmann | a889bc2 | 2014-04-28 11:02:58 +0200 | [diff] [blame] | 25 | static void pci_secondary(void) |
| 26 | { |
| 27 | qtest_start("-vga none -device secondary-vga"); |
| 28 | qtest_end(); |
| 29 | } |
| 30 | |
| 31 | static void pci_multihead(void) |
| 32 | { |
| 33 | qtest_start("-vga none -device VGA -device secondary-vga"); |
| 34 | qtest_end(); |
| 35 | } |
| 36 | |
Gerd Hoffmann | 501eea4 | 2014-04-28 11:10:12 +0200 | [diff] [blame] | 37 | static void pci_virtio_gpu(void) |
| 38 | { |
| 39 | qtest_start("-vga none -device virtio-gpu-pci"); |
| 40 | qtest_end(); |
| 41 | } |
| 42 | |
| 43 | #ifdef CONFIG_VIRTIO_VGA |
| 44 | static void pci_virtio_vga(void) |
| 45 | { |
| 46 | qtest_start("-vga none -device virtio-vga"); |
| 47 | qtest_end(); |
| 48 | } |
| 49 | #endif |
| 50 | |
Gerd Hoffmann | 0850fd5 | 2014-04-28 11:01:13 +0200 | [diff] [blame] | 51 | int main(int argc, char **argv) |
| 52 | { |
Laurent Vivier | f38a0b2 | 2017-01-05 16:29:45 +0100 | [diff] [blame] | 53 | const char *arch = qtest_get_arch(); |
| 54 | |
Gerd Hoffmann | 0850fd5 | 2014-04-28 11:01:13 +0200 | [diff] [blame] | 55 | g_test_init(&argc, &argv, NULL); |
| 56 | |
Laurent Vivier | f38a0b2 | 2017-01-05 16:29:45 +0100 | [diff] [blame] | 57 | if (strcmp(arch, "alpha") == 0 || strcmp(arch, "i386") == 0 || |
| 58 | strcmp(arch, "mips") == 0 || strcmp(arch, "x86_64") == 0) { |
| 59 | qtest_add_func("/display/pci/cirrus", pci_cirrus); |
| 60 | } |
Gerd Hoffmann | 0850fd5 | 2014-04-28 11:01:13 +0200 | [diff] [blame] | 61 | qtest_add_func("/display/pci/stdvga", pci_stdvga); |
Gerd Hoffmann | a889bc2 | 2014-04-28 11:02:58 +0200 | [diff] [blame] | 62 | qtest_add_func("/display/pci/secondary", pci_secondary); |
| 63 | qtest_add_func("/display/pci/multihead", pci_multihead); |
Gerd Hoffmann | 501eea4 | 2014-04-28 11:10:12 +0200 | [diff] [blame] | 64 | qtest_add_func("/display/pci/virtio-gpu", pci_virtio_gpu); |
| 65 | #ifdef CONFIG_VIRTIO_VGA |
| 66 | qtest_add_func("/display/pci/virtio-vga", pci_virtio_vga); |
| 67 | #endif |
Eduardo Habkost | 9be3859 | 2016-06-13 18:57:58 -0300 | [diff] [blame] | 68 | return g_test_run(); |
Gerd Hoffmann | 0850fd5 | 2014-04-28 11:01:13 +0200 | [diff] [blame] | 69 | } |