From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIEBQ-00071z-1C for qemu-devel@nongnu.org; Wed, 29 Jun 2016 08:01:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bIEBL-0005md-Sa for qemu-devel@nongnu.org; Wed, 29 Jun 2016 08:01:31 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34149) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bIEBL-0005mY-L4 for qemu-devel@nongnu.org; Wed, 29 Jun 2016 08:01:27 -0400 Received: by mail-wm0-x241.google.com with SMTP id 187so13785251wmz.1 for ; Wed, 29 Jun 2016 05:01:27 -0700 (PDT) Sender: Paolo Bonzini References: <1467134569-32294-1-git-send-email-pbonzini@redhat.com> From: Paolo Bonzini Message-ID: Date: Wed, 29 Jun 2016 14:01:24 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFH PATCH] vhost-user-test: fix g_cond_wait_until compat implementation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= Cc: QEMU On 29/06/2016 13:48, Marc-André Lureau wrote: > Hi > > On Tue, Jun 28, 2016 at 7:22 PM, Paolo Bonzini wrote: >> This fixes compilation with glib versions up to 2.30, such >> as the one in CentOS 6. >> > > What's RFH in title? :) (not sure this applies here: > http://www.urbandictionary.com/define.php?term=rfh) Request for help with the other bug. :) Paolo >> Even with this patch the test fails though: >> >> ERROR:/tmp/qemu-test/src/tests/vhost-user-test.c:165:wait_for_fds: assertion failed: (s->fds_num) >> > > That's a regression from Cornelia's series "virtio-bus: have callers > tolerate new host notifier api". > >> Signed-off-by: Paolo Bonzini >> --- >> tests/vhost-user-test.c | 11 +++++++---- >> 1 file changed, 7 insertions(+), 4 deletions(-) >> >> diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c >> index 8b2164b..4de64df 100644 >> --- a/tests/vhost-user-test.c >> +++ b/tests/vhost-user-test.c >> @@ -127,21 +127,24 @@ typedef struct TestServer { >> int fds_num; >> int fds[VHOST_MEMORY_MAX_NREGIONS]; >> VhostUserMemory memory; >> - GMutex data_mutex; >> - GCond data_cond; >> + CompatGMutex data_mutex; >> + CompatGCond data_cond; >> int log_fd; >> uint64_t rings; >> } TestServer; >> >> #if !GLIB_CHECK_VERSION(2, 32, 0) >> -static gboolean g_cond_wait_until(CompatGCond cond, CompatGMutex mutex, >> +static gboolean g_cond_wait_until(CompatGCond *cond, CompatGMutex *mutex, >> gint64 end_time) >> { >> gboolean ret = FALSE; >> end_time -= g_get_monotonic_time(); >> GTimeVal time = { end_time / G_TIME_SPAN_SECOND, >> end_time % G_TIME_SPAN_SECOND }; >> - ret = g_cond_timed_wait(cond, mutex, &time); >> + g_assert(mutex->once.status != G_ONCE_STATUS_PROGRESS); >> + g_once(&cond->once, do_g_cond_new, NULL); >> + ret = g_cond_timed_wait((GCond *) cond->once.retval, >> + (GMutex *) mutex->once.retval, &time); >> return ret; >> } >> #endif >> -- >> 2.7.4 >> >> > > > Reviewed-by: Marc-André Lureau > > >