Re: [libvirt PATCH 08/11] tests: start/stop an event thread for QEMU monitor/agent tests

2020-02-14 Thread Daniel P . Berrangé
On Fri, Feb 14, 2020 at 02:04:48PM +0100, Ján Tomko wrote:
> On Fri, Feb 14, 2020 at 12:52:06PM +, Daniel P. Berrangé wrote:
> > Tests which are using the QEMU monitor / agent need to have an
> > event thread running a private GMainContext.
> > 
> > There is already a thread running the main libvirt event loop
> > but this can't be eliminated yet as it is used for more than
> > just the monitor client I/O.
> > 
> > Signed-off-by: Daniel P. Berrangé 
> > ---
> > tests/qemumonitortestutils.c | 13 +
> > 1 file changed, 13 insertions(+)
> > 
> > diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
> > index b29e5d8cd2..a1641050ea 100644
> > --- a/tests/qemumonitortestutils.c
> > +++ b/tests/qemumonitortestutils.c
> > @@ -1389,12 +1398,16 @@ qemuMonitorTestNewAgent(virDomainXMLOptionPtr 
> > xmlopt)
> > {
> > qemuMonitorTestPtr test = NULL;
> > virDomainChrSourceDef src;
> > +g_autofree char *threadName = NULL;
> > 
> 
> ../../tests/qemumonitortestutils.c:1402:22: error: unused variable 
> 'threadName' [-Werror,-Wunused-variable]
> g_autofree char *threadName = NULL;
>  ^

ANother left over


Regards,
Daniel
-- 
|: https://berrange.com  -o-https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o-https://fstop138.berrange.com :|
|: https://entangle-photo.org-o-https://www.instagram.com/dberrange :|



Re: [libvirt PATCH 08/11] tests: start/stop an event thread for QEMU monitor/agent tests

2020-02-14 Thread Ján Tomko

On Fri, Feb 14, 2020 at 12:52:06PM +, Daniel P. Berrangé wrote:

Tests which are using the QEMU monitor / agent need to have an
event thread running a private GMainContext.

There is already a thread running the main libvirt event loop
but this can't be eliminated yet as it is used for more than
just the monitor client I/O.

Signed-off-by: Daniel P. Berrangé 
---
tests/qemumonitortestutils.c | 13 +
1 file changed, 13 insertions(+)

diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index b29e5d8cd2..a1641050ea 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -1389,12 +1398,16 @@ qemuMonitorTestNewAgent(virDomainXMLOptionPtr xmlopt)
{
qemuMonitorTestPtr test = NULL;
virDomainChrSourceDef src;
+g_autofree char *threadName = NULL;



../../tests/qemumonitortestutils.c:1402:22: error: unused variable 'threadName' 
[-Werror,-Wunused-variable]
g_autofree char *threadName = NULL;
 ^
1 error generated.

Jano


memset(, 0, sizeof(src));

if (!(test = qemuMonitorCommonTestNew(xmlopt, NULL, )))
goto error;

+if (!(test->eventThread = virEventThreadNew("agent-test")))
+goto error;
+
if (!(test->agent = qemuAgentOpen(test->vm,
  ,
  )))
--
2.24.1



signature.asc
Description: PGP signature


[libvirt PATCH 08/11] tests: start/stop an event thread for QEMU monitor/agent tests

2020-02-14 Thread Daniel P . Berrangé
Tests which are using the QEMU monitor / agent need to have an
event thread running a private GMainContext.

There is already a thread running the main libvirt event loop
but this can't be eliminated yet as it is used for more than
just the monitor client I/O.

Signed-off-by: Daniel P. Berrangé 
---
 tests/qemumonitortestutils.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index b29e5d8cd2..a1641050ea 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -36,6 +36,7 @@
 #include "virlog.h"
 #include "virerror.h"
 #include "virstring.h"
+#include "vireventthread.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
@@ -66,6 +67,8 @@ struct _qemuMonitorTest {
 virNetSocketPtr server;
 virNetSocketPtr client;
 
+virEventThread *eventThread;
+
 qemuMonitorPtr mon;
 qemuAgentPtr agent;
 
@@ -389,6 +392,8 @@ qemuMonitorTestFree(qemuMonitorTestPtr test)
 qemuAgentClose(test->agent);
 }
 
+g_object_unref(test->eventThread);
+
 virObjectUnref(test->vm);
 
 if (test->started)
@@ -1142,6 +1147,7 @@ qemuMonitorCommonTestInit(qemuMonitorTestPtr test)
 "}"
 /* We skip the normal handshake reply of "{\"execute\":\"qmp_capabilities\"}" 
*/
 
+
 qemuMonitorTestPtr
 qemuMonitorTestNew(virDomainXMLOptionPtr xmlopt,
virDomainObjPtr vm,
@@ -1157,6 +1163,9 @@ qemuMonitorTestNew(virDomainXMLOptionPtr xmlopt,
 if (!(test = qemuMonitorCommonTestNew(xmlopt, vm, )))
 goto error;
 
+if (!(test->eventThread = virEventThreadNew("mon-test")))
+goto error;
+
 test->qapischema = schema;
 if (!(test->mon = qemuMonitorOpen(test->vm,
   ,
@@ -1389,12 +1398,16 @@ qemuMonitorTestNewAgent(virDomainXMLOptionPtr xmlopt)
 {
 qemuMonitorTestPtr test = NULL;
 virDomainChrSourceDef src;
+g_autofree char *threadName = NULL;
 
 memset(, 0, sizeof(src));
 
 if (!(test = qemuMonitorCommonTestNew(xmlopt, NULL, )))
 goto error;
 
+if (!(test->eventThread = virEventThreadNew("agent-test")))
+goto error;
+
 if (!(test->agent = qemuAgentOpen(test->vm,
   ,
   )))
-- 
2.24.1