[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 11/12] tests: Add a test case for the egl-headless' rendernode option



We don't need a new input source, hence the symlink, we just need a new
.args output, since the functionality is determined by a QEMU capability.

Signed-off-by: Erik Skultety <eskultet redhat com>
---
 src/util/virutil.h                            |  2 +-
 ...cs-egl-headless-rendernode-autoselect.args | 26 +++++++++++++++++++
 ...ics-egl-headless-rendernode-autoselect.xml |  1 +
 tests/qemuxml2argvmock.c                      |  9 +++++++
 tests/qemuxml2argvtest.c                      |  4 +++
 5 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 tests/qemuxml2argvdata/graphics-egl-headless-rendernode-autoselect.args
 create mode 120000 tests/qemuxml2argvdata/graphics-egl-headless-rendernode-autoselect.xml

diff --git a/src/util/virutil.h b/src/util/virutil.h
index 89bd21b148..588d779d10 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -222,7 +222,7 @@ unsigned long long virMemoryMaxValue(bool ulong) ATTRIBUTE_NOINLINE;
 
 bool virHostHasIOMMU(void);
 
-char *virHostGetDRMRenderNode(void);
+char *virHostGetDRMRenderNode(void) ATTRIBUTE_NOINLINE;
 
 /**
  * VIR_ASSIGN_IS_OVERFLOW:
diff --git a/tests/qemuxml2argvdata/graphics-egl-headless-rendernode-autoselect.args b/tests/qemuxml2argvdata/graphics-egl-headless-rendernode-autoselect.args
new file mode 100644
index 0000000000..84633abca8
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-egl-headless-rendernode-autoselect.args
@@ -0,0 +1,26 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,\
+bootindex=1 \
+-display egl-headless,rendernode=/dev/dri/foo \
+-vga cirrus
diff --git a/tests/qemuxml2argvdata/graphics-egl-headless-rendernode-autoselect.xml b/tests/qemuxml2argvdata/graphics-egl-headless-rendernode-autoselect.xml
new file mode 120000
index 0000000000..065e77919e
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-egl-headless-rendernode-autoselect.xml
@@ -0,0 +1 @@
+graphics-egl-headless.xml
\ No newline at end of file
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index 79152d928e..a64cd955c4 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -184,6 +184,15 @@ virNetDevRunEthernetScript(const char *ifname ATTRIBUTE_UNUSED,
     return 0;
 }
 
+char *
+virHostGetDRMRenderNode(void)
+{
+    char *dst = NULL;
+
+    ignore_value(VIR_STRDUP(dst, "/dev/dri/foo"));
+    return dst;
+}
+
 static void (*real_virCommandPassFD)(virCommandPtr cmd, int fd, unsigned int flags);
 
 static const int testCommandPassSafeFDs[] = { 1730, 1731 };
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 95429b3ae7..856d374902 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1246,6 +1246,10 @@ mymain(void)
     DO_TEST("graphics-egl-headless",
             QEMU_CAPS_EGL_HEADLESS,
             QEMU_CAPS_DEVICE_CIRRUS_VGA);
+    DO_TEST("graphics-egl-headless-rendernode-autoselect",
+            QEMU_CAPS_EGL_HEADLESS,
+            QEMU_CAPS_EGL_HEADLESS_RENDERNODE,
+            QEMU_CAPS_DEVICE_CIRRUS_VGA);
 
     DO_TEST("graphics-vnc", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
     DO_TEST("graphics-vnc-socket", QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_CIRRUS_VGA);
-- 
2.19.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]