[libvirt] [PATCH v2 08/10] Use more generic functions in qemuhotplugtest

Martin Kletzander mkletzan at redhat.com
Mon Jul 25 09:40:14 UTC 2016


On Sat, Jul 16, 2016 at 02:42:53AM +0200, Tomasz Flendrich wrote:
>More generic functions, qemuDomainAttachDeviceLiveAndConfig
>and qemuDomainDetachDeviceLiveAndConfig, are now used instead
>of other functions in qemuhotplugtest to attach and detach devices.
>
>---
> tests/qemuhotplugtest.c | 157 +++++++++++++++++++++++++++---------------------
> 1 file changed, 88 insertions(+), 69 deletions(-)
>
>diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
>index d862a0e..da361a2 100644
>--- a/tests/qemuhotplugtest.c
>+++ b/tests/qemuhotplugtest.c
>@@ -23,6 +23,7 @@
> #include "qemu/qemu_conf.h"
> #include "qemu/qemu_hotplug.h"
> #include "qemu/qemu_hotplugpriv.h"
>+#include "qemu/qemu_driver.h"

This will be qemu_domainpriv.h based on previous patches.  Or,
hopefully, just qemu_domain.h ;)

> #include "qemumonitortestutils.h"
> #include "testutils.h"
> #include "testutilsqemu.h"
>@@ -52,6 +53,7 @@ struct qemuHotplugTestData {
>     bool keep;
>     virDomainObjPtr vm;
>     bool deviceDeletedEvent;
>+    unsigned int target;

virDomainModificationImpact would be more suitable here.

>@@ -382,28 +387,30 @@ mymain(void)
>         data.mon = my_mon;                                                  \
>         data.keep = kep;                                                    \
>         data.deviceDeletedEvent = event;                                    \
>+        data.target = targt;                                                \
>         if (virTestRun(name, testQemuHotplug, &data) < 0)                   \
>             ret = -1;                                                       \
>     } while (0)
>
>-#define DO_TEST_ATTACH(file, dev, fial, kep, ...)                           \
>-    DO_TEST(file, ATTACH, dev, false, fial, kep, __VA_ARGS__)
>+#define DO_TEST_ATTACH(file, dev, fial, kep, targt, ...)                           \
>+    DO_TEST(file, ATTACH, dev, false, fial, kep, targt, __VA_ARGS__)
>

Worse readability of the macros, but better readability of the tests
would be if we had DO_TEST_ATTACH, DO_TEST_ATTACH_LIVE and
DO_TEST_ATTACH_CONFIG (the first one would be both live and config).

>@@ -418,77 +425,86 @@ mymain(void)
>     "    }"                                                 \
>     "}\r\n"
>
>-    DO_TEST_UPDATE("graphics-spice", "graphics-spice-nochange", false, false, NULL);
>-    DO_TEST_UPDATE("graphics-spice-timeout", "graphics-spice-timeout-nochange", false, false,
>+    DO_TEST_UPDATE("graphics-spice", "graphics-spice-nochange", false, false, VIR_DOMAIN_AFFECT_LIVE, NULL);
>+    DO_TEST_UPDATE("graphics-spice-timeout", "graphics-spice-timeout-nochange", false, false, VIR_DOMAIN_AFFECT_LIVE,

We would also not have such long lines :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160725/eb0ecc91/attachment-0001.sig>


More information about the libvir-list mailing list