[PATCH 22/27] qemuMonitorJSONTestAttachChardev: Add tests for FD passing of file backend

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

 



Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tests/qemumonitorjsontest.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 8fbb199a59..278d7ba765 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -680,6 +680,8 @@ static int
 qemuMonitorJSONTestAttachChardev(virDomainXMLOption *xmlopt,
                                  GHashTable *schema)
 {
+    virDomainChrDef chrdev = { .info = { .alias = (char *) "alias" }};
+    virDomainDeviceDef dev = { .type = VIR_DOMAIN_DEVICE_CHR, .data.chr = &chrdev };
     int ret = 0;

 #define CHECK(label, fail, expectargs) \
@@ -723,6 +725,7 @@ qemuMonitorJSONTestAttachChardev(virDomainXMLOption *xmlopt,

     {
         g_autoptr(virDomainChrSourceDef) chr = virDomainChrSourceDefNew(xmlopt);
+        qemuDomainChrSourcePrivate *charpriv = QEMU_DOMAIN_CHR_SOURCE_PRIVATE(chr);

         chr->data.file.path = g_strdup("/test/path");

@@ -737,6 +740,16 @@ qemuMonitorJSONTestAttachChardev(virDomainXMLOption *xmlopt,
               "{'id':'alias','backend':{'type':'file','data':{'out':'/test/path',"
                                                              "'logfile':'/test/logfile',"
                                                              "'logappend':false}}}");
+
+        chrdev.source = chr;
+        ignore_value(testQemuPrepareHostBackendChardevOne(&dev, chr, NULL));
+        qemuFDPassTransferMonitorFake(charpriv->sourcefd);
+        qemuFDPassTransferMonitorFake(charpriv->logfd);
+        CHECK("file", false,
+              "{'id':'alias','backend':{'type':'file','data':{'out':'/dev/fdset/monitor-fake',"
+                                                             "'append':true,"
+                                                             "'logfile':'/dev/fdset/monitor-fake',"
+                                                             "'logappend':true}}}");
     }

     {
-- 
2.34.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux