[Spice-devel] [PATCH server v2 04/13] stream-test: add batch test

Marc-André Lureau marcandre.lureau at gmail.com
Thu Jan 14 13:01:04 PST 2016


Check that two consecutive msgfd are read back from two different reads.

Signed-off-by: Marc-André Lureau <marcandre.lureau at gmail.com>
---
 server/tests/stream-test.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/server/tests/stream-test.c b/server/tests/stream-test.c
index 7dc9fbf..f83f0e1 100644
--- a/server/tests/stream-test.c
+++ b/server/tests/stream-test.c
@@ -111,6 +111,22 @@ int main(int argc, char *argv[])
     spice_assert(ret == 1);
     spice_assert(fd == -1);
 
+    /* batch test */
+    ret = reds_stream_send_msgfd(st[0], 0);
+    spice_assert(ret == 1);
+    ret = reds_stream_send_msgfd(st[0], 0);
+    spice_assert(ret == 1);
+    ret = sock_fd_read(sv[1], &c, 1, &fd);
+    spice_assert(c == '@');
+    spice_assert(ret == 1);
+    spice_assert(fd != -1);
+    close(fd);
+    ret = sock_fd_read(sv[1], &c, 1, &fd);
+    spice_assert(c == '@');
+    spice_assert(ret == 1);
+    spice_assert(fd != -1);
+    close(fd);
+
     reds_stream_free(st[0]);
     reds_stream_free(st[1]);
 
-- 
2.5.0



More information about the Spice-devel mailing list