[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
- [Qemu-devel] [PATCH v2 0/7] Target-specific unit test support, add unit tests for target-i386/cpu.c code, Eduardo Habkost, 2014/09/30
- [Qemu-devel] [PATCH v2 1/7] tests: Move fake yield_until_fd_readable() to coroutine-stub.c,
Eduardo Habkost <=
- [Qemu-devel] [PATCH v2 3/7] tests: Make test-x86-cpuid target-specific, Eduardo Habkost, 2014/09/30
- [Qemu-devel] [PATCH v2 2/7] tests: Support target-specific unit tests, Eduardo Habkost, 2014/09/30
- [Qemu-devel] [PATCH v2 4/7] tests: Add unit test for X86CPU code, Eduardo Habkost, 2014/09/30
- [Qemu-devel] [PATCH v2 5/7] target-i386: Isolate enabled-by-default features to a separate array, Eduardo Habkost, 2014/09/30
- [Qemu-devel] [PATCH v2 6/7] tests: test-x86-cpu: Add TCG feature bit initialization test, Eduardo Habkost, 2014/09/30
- [Qemu-devel] [PATCH v2 7/7] tests: test-x86-cpu: Add KVM feature bit initialization test, Eduardo Habkost, 2014/09/30