diff mbox

[FOR,2.1,1/5] tests/test-qmp-event: fix for GLib < 2.31

Message ID 1403652840-13449-2-git-send-email-wenchaoqemu@gmail.com
State New
Headers show

Commit Message

Wenchao Xia June 24, 2014, 11:33 p.m. UTC
From: Paolo Bonzini <pbonzini@redhat.com>

On old GLib, the test needs a g_thread_init call.

Reported-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Wenchao Xia <wenchaoqemu@gmail.com>
Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
---
 tests/test-qmp-event.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

Luiz Capitulino June 25, 2014, 1:13 p.m. UTC | #1
On Tue, 24 Jun 2014 16:33:56 -0700
Wenchao Xia <wenchaoqemu@gmail.com> wrote:

> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> On old GLib, the test needs a g_thread_init call.
> 
> Reported-by: Wenchao Xia <wenchaoqemu@gmail.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Tested-by: Wenchao Xia <wenchaoqemu@gmail.com>
> Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
> ---
>  tests/test-qmp-event.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c
> index cb1e441..17c6444 100644
> --- a/tests/test-qmp-event.c
> +++ b/tests/test-qmp-event.c
> @@ -251,6 +251,7 @@ static void test_event_d(TestEventData *data,
>  
>  int main(int argc, char **argv)
>  {
> +    g_thread_init(NULL);
>      qmp_event_set_func_emit(event_test_emit);
>  
>      g_test_init(&argc, &argv, NULL);

This breaks make check on F20:

"""
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c: In function ‘main’:
/home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c:254:5: error: ‘g_thread_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Werror=deprecated-declarations]
     g_thread_init(NULL);
     ^
cc1: all warnings being treated as errors
make: *** [tests/test-qmp-event.o] Error 1
"""

I think the best way to fix this is to make util/osdep.c:thread_init()
public (maybe by moving it to include/glib-compat.h) and use that instead.
Also, note that thread_init()'s body is duplicated in a few other places,
so maybe those places should call it too.

You may want to do this in a different series, then I can skip this patch
and apply the rest of the series.
Paolo Bonzini June 25, 2014, 1:15 p.m. UTC | #2
Il 25/06/2014 15:13, Luiz Capitulino ha scritto:
> On Tue, 24 Jun 2014 16:33:56 -0700
> Wenchao Xia <wenchaoqemu@gmail.com> wrote:
>
>> From: Paolo Bonzini <pbonzini@redhat.com>
>>
>> On old GLib, the test needs a g_thread_init call.
>>
>> Reported-by: Wenchao Xia <wenchaoqemu@gmail.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> Tested-by: Wenchao Xia <wenchaoqemu@gmail.com>
>> Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
>> ---
>>  tests/test-qmp-event.c |    1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c
>> index cb1e441..17c6444 100644
>> --- a/tests/test-qmp-event.c
>> +++ b/tests/test-qmp-event.c
>> @@ -251,6 +251,7 @@ static void test_event_d(TestEventData *data,
>>
>>  int main(int argc, char **argv)
>>  {
>> +    g_thread_init(NULL);
>>      qmp_event_set_func_emit(event_test_emit);
>>
>>      g_test_init(&argc, &argv, NULL);
>
> This breaks make check on F20:
>
> """
> /home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c: In function ‘main’:
> /home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c:254:5: error: ‘g_thread_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Werror=deprecated-declarations]
>      g_thread_init(NULL);
>      ^
> cc1: all warnings being treated as errors
> make: *** [tests/test-qmp-event.o] Error 1
> """
>
> I think the best way to fix this is to make util/osdep.c:thread_init()
> public (maybe by moving it to include/glib-compat.h) and use that instead.
> Also, note that thread_init()'s body is duplicated in a few other places,
> so maybe those places should call it too.
>
> You may want to do this in a different series, then I can skip this patch
> and apply the rest of the series.
>

Thanks Luiz, it's a good suggestion.

Paolo
Luiz Capitulino June 27, 2014, 6:28 p.m. UTC | #3
On Wed, 25 Jun 2014 15:15:35 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> Il 25/06/2014 15:13, Luiz Capitulino ha scritto:
> > On Tue, 24 Jun 2014 16:33:56 -0700
> > Wenchao Xia <wenchaoqemu@gmail.com> wrote:
> >
> >> From: Paolo Bonzini <pbonzini@redhat.com>
> >>
> >> On old GLib, the test needs a g_thread_init call.
> >>
> >> Reported-by: Wenchao Xia <wenchaoqemu@gmail.com>
> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >> Tested-by: Wenchao Xia <wenchaoqemu@gmail.com>
> >> Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com>
> >> ---
> >>  tests/test-qmp-event.c |    1 +
> >>  1 files changed, 1 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c
> >> index cb1e441..17c6444 100644
> >> --- a/tests/test-qmp-event.c
> >> +++ b/tests/test-qmp-event.c
> >> @@ -251,6 +251,7 @@ static void test_event_d(TestEventData *data,
> >>
> >>  int main(int argc, char **argv)
> >>  {
> >> +    g_thread_init(NULL);
> >>      qmp_event_set_func_emit(event_test_emit);
> >>
> >>      g_test_init(&argc, &argv, NULL);
> >
> > This breaks make check on F20:
> >
> > """
> > /home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c: In function ‘main’:
> > /home/lcapitulino/work/src/upstream/qmp-unstable/tests/test-qmp-event.c:254:5: error: ‘g_thread_init’ is deprecated (declared at /usr/include/glib-2.0/glib/deprecated/gthread.h:260) [-Werror=deprecated-declarations]
> >      g_thread_init(NULL);
> >      ^
> > cc1: all warnings being treated as errors
> > make: *** [tests/test-qmp-event.o] Error 1
> > """
> >
> > I think the best way to fix this is to make util/osdep.c:thread_init()
> > public (maybe by moving it to include/glib-compat.h) and use that instead.
> > Also, note that thread_init()'s body is duplicated in a few other places,
> > so maybe those places should call it too.
> >
> > You may want to do this in a different series, then I can skip this patch
> > and apply the rest of the series.
> >
> 
> Thanks Luiz, it's a good suggestion.

Paolo, Wenchao, are one of one going to work on this?
diff mbox

Patch

diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c
index cb1e441..17c6444 100644
--- a/tests/test-qmp-event.c
+++ b/tests/test-qmp-event.c
@@ -251,6 +251,7 @@  static void test_event_d(TestEventData *data,
 
 int main(int argc, char **argv)
 {
+    g_thread_init(NULL);
     qmp_event_set_func_emit(event_test_emit);
 
     g_test_init(&argc, &argv, NULL);