[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 04/10] tests: Move fake yield_until_fd_readable() to c
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [RFC 04/10] tests: Move fake yield_until_fd_readable() to coroutine-stub.c |
Date: |
Thu, 25 Sep 2014 17:18:23 -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 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)
{
--
1.9.3
- [Qemu-devel] [RFC 00/10] Target-specific unit test support, add unit tests for target-i386/cpu.c code, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 01/10] tests: Add missing include to test-bitops.c, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 02/10] bitops.h: Don't include qemu-common.h, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 03/10] bitmap.h: Don't include qemu-common.h, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 04/10] tests: Move fake yield_until_fd_readable() to coroutine-stub.c,
Eduardo Habkost <=
- [Qemu-devel] [RFC 05/10] tests: Support target-specific unit tests, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 07/10] tests: Add unit test for X86CPU code, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 08/10] target-i386: Isolate enabled-by-default features to a separate array, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 06/10] tests: Make test-x86-cpuid target-specific, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 09/10] tests: test-x86-cpu: Add TCG feature bit initialization test, Eduardo Habkost, 2014/09/25
- [Qemu-devel] [RFC 10/10] tests: test-x86-cpu: Add KVM feature bit initialization test, Eduardo Habkost, 2014/09/25
- Re: [Qemu-devel] [RFC 00/10] Target-specific unit test support, add unit tests for target-i386/cpu.c code, Paolo Bonzini, 2014/09/26