qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2 1/7] tests: Move fake yield_until_fd_readable() t


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH v2 1/7] tests: Move fake yield_until_fd_readable() to coroutine-stub.c
Date: Tue, 30 Sep 2014 15:26:00 -0300

Other test code will use the function.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 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 834279c..3b84e38 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -259,6 +259,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)
 {
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]