[libvirt] [PATCH] tests: Fix up test numbering in qemuxml2argvtest

Martin Kletzander posted 1 patch 6 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/683a59927eaf9a5f849444c7fa7de28f0bee7f6e.1523958900.git.mkletzan@redhat.com
Test syntax-check failed
tests/qemuxml2argvtest.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
[libvirt] [PATCH] tests: Fix up test numbering in qemuxml2argvtest
Posted by Martin Kletzander 6 years ago
Due to conditional execution of virTestRun(), the testCounter was incremented
only if all the cases were run.  When using VIR_TEST_RANGE=x-y, first x/2 of the
increments were skipped and that made figuring out a precise case a PITA.
Moving the condition into the test function makes it way nicer to find out the
test numbers to use in VIR_TEST_RANGE.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
 tests/qemuxml2argvtest.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 7f1855782442..51adaabe1cc3 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -410,6 +410,9 @@ testCompareXMLToStartupXML(const void *data)
     char *actual = NULL;
     int ret = -1;
 
+    if (!info->vm)
+        return EXIT_AM_SKIP;
+
     if (virAsprintf(&xml, "%s/qemuxml2startupxmloutdata/%s.xml",
                     abs_srcdir, info->name) < 0)
         goto cleanup;
@@ -664,8 +667,8 @@ mymain(void)
         if (virTestRun("QEMU XML-2-ARGV " name, \
                        testCompareXMLToArgv, &info) < 0) \
             ret = -1; \
-        if (info.vm && virTestRun("QEMU XML-2-startup-XML " name, \
-                                  testCompareXMLToStartupXML, &info) < 0) \
+        if (virTestRun("QEMU XML-2-startup-XML " name, \
+                       testCompareXMLToStartupXML, &info) < 0)  \
             ret = -1; \
         virObjectUnref(info.qemuCaps); \
         virObjectUnref(info.vm); \
-- 
2.17.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tests: Fix up test numbering in qemuxml2argvtest
Posted by Peter Krempa 6 years ago
On Tue, Apr 17, 2018 at 11:55:00 +0200, Martin Kletzander wrote:
> Due to conditional execution of virTestRun(), the testCounter was incremented
> only if all the cases were run.  When using VIR_TEST_RANGE=x-y, first x/2 of the
> increments were skipped and that made figuring out a precise case a PITA.
> Moving the condition into the test function makes it way nicer to find out the
> test numbers to use in VIR_TEST_RANGE.
> 
> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
> ---

Oh right. Sorry for that.

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