From patchwork Thu Oct 1 17:24:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 525225 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 87E1714076A for ; Fri, 2 Oct 2015 04:16:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=DePE93VH; dkim-atps=neutral Received: from localhost ([::1]:54965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhiOc-0003o8-42 for incoming@patchwork.ozlabs.org; Thu, 01 Oct 2015 14:15:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhhbS-0008Py-GD for qemu-devel@nongnu.org; Thu, 01 Oct 2015 13:25:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhhbR-0000xN-2k for qemu-devel@nongnu.org; Thu, 01 Oct 2015 13:25:10 -0400 Received: from mail-qg0-x232.google.com ([2607:f8b0:400d:c04::232]:34606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhhbQ-0000xF-Uy for qemu-devel@nongnu.org; Thu, 01 Oct 2015 13:25:09 -0400 Received: by qgez77 with SMTP id z77so73355806qge.1 for ; Thu, 01 Oct 2015 10:25:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=eQx3Og6uxqSkUD3wcpEFgYwBjJN0LJNuVfY8cGzFvsc=; b=DePE93VH3ROutNVQkc0uMTfS0v0126NwkuSYNXyarmoXSQmEF3SP10hNfzTr0rc5DX 86wqEtmhgzg/CWhf04vGkTpJRZH+EMavPXD50/9It2hmVCQcc1HgDSnOH+AFtF/qWP1Z FIQiDDq9SYykIdrEVBex8gIGQzH25yrAOE+qy725+klpw24rMHoTG+XAsNn7ExBNFYCz TenKfssxzq0+wk0kbzPdf77OI7w/MjJYQskQSUsA8svDezOohvyZ8BfwllSG/itBCB1T nckKc2V/0SaW1hEp9OInUbGipC/iCE9Li/Fq2T1Zx0kxd0A1L9boFn5JE5a71GfQiGza FF9g== X-Received: by 10.140.232.73 with SMTP id d70mr14365117qhc.72.1443720308732; Thu, 01 Oct 2015 10:25:08 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id o8sm2811853qko.13.2015.10.01.10.25.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2015 10:25:07 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Thu, 1 Oct 2015 19:24:03 +0200 Message-Id: <1443720248-15482-20-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1443720248-15482-1-git-send-email-marcandre.lureau@redhat.com> References: <1443720248-15482-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c04::232 Cc: haifeng.lin@huawei.com, mst@redhat.com, thibaut.collet@6wind.com, jasowang@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [Qemu-devel] [PATCH v7 19/24] vhost-user-test: move wait_for_fds() out X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau This function is a precondition for most vhost-user tests. Signed-off-by: Marc-André Lureau --- tests/vhost-user-test.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 56df5cc..827c0c4 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -126,12 +126,9 @@ static gboolean g_cond_wait_until(CompatGCond cond, CompatGMutex mutex, } #endif -static void read_guest_mem(void) +static void wait_for_fds(void) { - uint32_t *guest_mem; gint64 end_time; - int i, j; - size_t size; g_mutex_lock(&data_mutex); @@ -148,6 +145,19 @@ static void read_guest_mem(void) g_assert_cmpint(fds_num, >, 0); g_assert_cmpint(fds_num, ==, memory.nregions); + g_mutex_unlock(&data_mutex); +} + +static void read_guest_mem(void) +{ + uint32_t *guest_mem; + int i, j; + size_t size; + + wait_for_fds(); + + g_mutex_lock(&data_mutex); + /* iterate all regions */ for (i = 0; i < fds_num; i++) {