[11/12] tests: qemuxml2xml: Wire up QEMUCaps usage

Message ID d729e68ee8d486d762e49923f272b43fe70f73ec.1452224621.git.crobinso@redhat.com
State Superseded
Headers show

Commit Message

Cole Robinson Jan. 8, 2016, 3:50 a.m.
Future changes will make some of these tests dependent on specific
QEMUCaps flags, so wire up the basic handling.
---
 tests/qemuxml2xmltest.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

-- 
2.5.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Cole Robinson Jan. 9, 2016, 12:16 a.m. | #1
On 01/08/2016 06:39 AM, Peter Krempa wrote:
> On Thu, Jan 07, 2016 at 22:50:05 -0500, Cole Robinson wrote:

>> Future changes will make some of these tests dependent on specific

>> QEMUCaps flags, so wire up the basic handling.

>> ---

>>  tests/qemuxml2xmltest.c | 11 +++++++++++

>>  1 file changed, 11 insertions(+)

>>

>> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c

>> index c0270d4..32c9fed 100644

>> --- a/tests/qemuxml2xmltest.c

>> +++ b/tests/qemuxml2xmltest.c

> 

> [...]

> 

>> @@ -225,6 +229,13 @@ testInfoSet(struct testInfo *info,

>>              bool different,

>>              int when)

>>  {

>> +    if (!(info->qemuCaps = virQEMUCapsNew()))

>> +        goto error;

> 

> This is not necessary, since ...

> 

>> +

>> +    if (qemuTestCapsCacheInsert(driver.qemuCapsCache, name,

>> +                                info->qemuCaps) < 0)

>> +        goto error;

> 

> ... this function allocates the caps if it's called with the third

> argument set to NULL.

> 


I didn't see that. However then we don't have a handle to actually set CAPS
flags on, we would have to look it up, which is roughly the same amount of code.

I reposted this patch unchanged in my latest series

Thanks,
Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Patch

diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index c0270d4..32c9fed 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -37,6 +37,8 @@  struct testInfo {
 
     char *outInactiveName;
     char *outInactiveFile;
+
+    virQEMUCapsPtr qemuCaps;
 };
 
 static int
@@ -216,6 +218,8 @@  testInfoFree(struct testInfo *info)
 
     VIR_FREE(info->outInactiveName);
     VIR_FREE(info->outInactiveFile);
+
+    virObjectUnref(info->qemuCaps);
 }
 
 
@@ -225,6 +229,13 @@  testInfoSet(struct testInfo *info,
             bool different,
             int when)
 {
+    if (!(info->qemuCaps = virQEMUCapsNew()))
+        goto error;
+
+    if (qemuTestCapsCacheInsert(driver.qemuCapsCache, name,
+                                info->qemuCaps) < 0)
+        goto error;
+
     if (virAsprintf(&info->inName, "%s/qemuxml2argvdata/qemuxml2argv-%s.xml",
                     abs_srcdir, name) < 0)
         goto error;