From patchwork Thu Sep 25 20:18:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 393468 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 B5F07140080 for ; Fri, 26 Sep 2014 06:23:48 +1000 (EST) Received: from localhost ([::1]:42608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXFZq-0007PN-QM for incoming@patchwork.ozlabs.org; Thu, 25 Sep 2014 16:23:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXFVM-000081-OM for qemu-devel@nongnu.org; Thu, 25 Sep 2014 16:19:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXFVF-0004tg-8Q for qemu-devel@nongnu.org; Thu, 25 Sep 2014 16:19:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXFVF-0004t6-0L for qemu-devel@nongnu.org; Thu, 25 Sep 2014 16:19:01 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8PKItEd031018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 25 Sep 2014 16:18:55 -0400 Received: from localhost (ovpn-113-54.phx2.redhat.com [10.3.113.54]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8PKIsBj030028; Thu, 25 Sep 2014 16:18:54 -0400 From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 25 Sep 2014 17:18:23 -0300 Message-Id: <1411676309-20218-5-git-send-email-ehabkost@redhat.com> In-Reply-To: <1411676309-20218-1-git-send-email-ehabkost@redhat.com> References: <1411676309-20218-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paolo Bonzini Subject: [Qemu-devel] [RFC 04/10] tests: Move fake yield_until_fd_readable() to coroutine-stub.c 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 Other test code will use the function. Signed-off-by: Eduardo Habkost --- tests/Makefile | 1 + tests/coroutine-stub.c | 13 +++++++++++++ tests/test-vmstate.c | 11 ----------- 3 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 tests/coroutine-stub.c diff --git a/tests/Makefile b/tests/Makefile index f5de29c..483ba61 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -258,6 +258,7 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ $(test-qapi-obj-y) \ libqemuutil.a libqemustub.a tests/test-vmstate$(EXESUF): tests/test-vmstate.o \ + tests/coroutine-stub.o \ vmstate.o qemu-file.o \ libqemuutil.a diff --git a/tests/coroutine-stub.c b/tests/coroutine-stub.c new file mode 100644 index 0000000..8af58dd --- /dev/null +++ b/tests/coroutine-stub.c @@ -0,0 +1,13 @@ +#include "qemu-common.h" +#include "block/coroutine.h" + +/* Fake yield_until_fd_readable() implementation so we don't have to pull the + * coroutine code as dependency. + */ +void yield_until_fd_readable(int fd) +{ + fd_set fds; + FD_ZERO(&fds); + FD_SET(fd, &fds); + select(fd + 1, &fds, NULL, NULL, NULL); +} diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index d72c64c..412634f 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -32,17 +32,6 @@ static char temp_file[] = "/tmp/vmst.test.XXXXXX"; static int temp_fd; -/* Fake yield_until_fd_readable() implementation so we don't have to pull the - * coroutine code as dependency. - */ -void yield_until_fd_readable(int fd) -{ - fd_set fds; - FD_ZERO(&fds); - FD_SET(fd, &fds); - select(fd + 1, &fds, NULL, NULL, NULL); -} - /* Duplicate temp_fd and seek to the beginning of the file */ static QEMUFile *open_test_file(bool write) {