diff mbox

[2/5] tests: qemuargv2xml: Remove UUID randomness

Message ID 891b0ded6dde1fc31db46632f7ead73d6a2feb2d.1455644471.git.crobinso@redhat.com
State Accepted
Commit b25027ba5da6734603d9b78aaf44ac3aa4a02fe0
Headers show

Commit Message

Cole Robinson Feb. 16, 2016, 5:44 p.m. UTC
Overwrite any randomly generated UUID to use a hardcoded value, so
we don't need to blank it when comparing XML.
---
 .../qemuargv2xml-hostdev-pci-address.xml              |  2 +-
 .../qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml |  2 +-
 .../qemuargv2xml-misc-disable-suspends.xml            |  2 +-
 .../qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml  |  2 +-
 tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml  |  2 +-
 tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml |  2 +-
 tests/qemuargv2xmltest.c                              | 19 +++++++++++++++++--
 7 files changed, 23 insertions(+), 8 deletions(-)

-- 
2.5.0

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

Patch

diff --git a/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml b/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml
index 77b484d..937238a 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-hostdev-pci-address.xml
@@ -1,6 +1,6 @@ 
 <domain type='qemu'>
   <name>QEMUGuest2</name>
-  <uuid>c7a5fdbd-edaf-9466-926a-d65c16db1809</uuid>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
   <currentMemory unit='KiB'>219100</currentMemory>
   <vcpu placement='static'>1</vcpu>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml
index 3619c24..1545064 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-s3.xml
@@ -1,6 +1,6 @@ 
 <domain type='qemu'>
   <name>QEMUGuest1</name>
-  <uuid>8caaa98c-e7bf-5845-126a-1fc316bd1089</uuid>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
   <currentMemory unit='KiB'>219100</currentMemory>
   <vcpu placement='static'>1</vcpu>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml
index 30276e0..f6ebba9 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-disable-suspends.xml
@@ -1,6 +1,6 @@ 
 <domain type='qemu'>
   <name>QEMUGuest1</name>
-  <uuid>8caaa98c-e7bf-5845-126a-1fc316bd1089</uuid>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
   <currentMemory unit='KiB'>219100</currentMemory>
   <vcpu placement='static'>1</vcpu>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml b/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml
index ac8b3f0..089622c 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-misc-enable-s4.xml
@@ -1,6 +1,6 @@ 
 <domain type='qemu'>
   <name>QEMUGuest1</name>
-  <uuid>8caaa98c-e7bf-5845-126a-1fc316bd1089</uuid>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>219100</memory>
   <currentMemory unit='KiB'>219100</currentMemory>
   <vcpu placement='static'>1</vcpu>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml
index 39f4a1f..44c3b1d 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-disk.xml
@@ -1,6 +1,6 @@ 
 <domain type='qemu'>
   <name>QEMUGuest1</name>
-  <uuid>87eedafe-eedc-4336-8130-ed9fe5dc90c8</uuid>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>524288</memory>
   <currentMemory unit='KiB'>524288</currentMemory>
   <vcpu placement='static'>1</vcpu>
diff --git a/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml b/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml
index 2da2832..eafe49d 100644
--- a/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml
+++ b/tests/qemuargv2xmldata/qemuargv2xml-pseries-nvram.xml
@@ -1,6 +1,6 @@ 
 <domain type='qemu'>
   <name>QEMUGuest1</name>
-  <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
   <memory unit='KiB'>524288</memory>
   <currentMemory unit='KiB'>524288</currentMemory>
   <vcpu placement='static'>1</vcpu>
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index f07818a..6650cf0 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -23,8 +23,7 @@  static virQEMUDriver driver;
 
 static int blankProblemElements(char *data)
 {
-    if (virtTestClearLineRegex("<uuid>([[:alnum:]]|-)+</uuid>", data) < 0 ||
-        virtTestClearLineRegex("<memory.*>[[:digit:]]+</memory>", data) < 0 ||
+    if (virtTestClearLineRegex("<memory.*>[[:digit:]]+</memory>", data) < 0 ||
         virtTestClearLineRegex("<secret.*>", data) < 0 ||
         virtTestClearLineRegex("<currentMemory.*>[[:digit:]]+</currentMemory>",
                                data) < 0)
@@ -32,6 +31,19 @@  static int blankProblemElements(char *data)
     return 0;
 }
 
+static int testSanitizeDef(virDomainDefPtr vmdef)
+{
+    int ret = -1;
+
+    /* Remove UUID randomness */
+    if (virUUIDParse("c7a5fdbd-edaf-9455-926a-d65c16db1809", vmdef->uuid) < 0)
+        goto fail;
+
+    ret = 0;
+ fail:
+    return ret;
+}
+
 typedef enum {
     FLAG_EXPECT_WARNING     = 1 << 0,
 } virQemuXML2ArgvTestFlags;
@@ -79,6 +91,9 @@  static int testCompareXMLToArgvFiles(const char *xml,
         }
     }
 
+    if (testSanitizeDef(vmdef) < 0)
+        goto fail;
+
     if (!virDomainDefCheckABIStability(vmdef, vmdef)) {
         VIR_TEST_DEBUG("ABI stability check failed on %s", xml);
         goto fail;