[spice-gtk,v4,28/29] test-cd-emu: Make sure we can call spice_usb_backend_channel_flush_writes

Submitted by Frediano Ziglio on Aug. 27, 2019, 9:22 a.m.

Details

Message ID 20190827092246.10276-29-fziglio@redhat.com
State Accepted
Commit 7d5e1c30058c7137b5cac5b654e176e6faeb69af
Headers show
Series "added feature of sharing CD image" ( rev: 6 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Aug. 27, 2019, 9:22 a.m.
Currently we call this function when the SPICE channel is up
however this function should continue to work as in theory
the channel could avoid to handle the message and stop the flow
(for instance to implement some kind of flow limitation)
and so will need to call this function again.
This was failing in the first USB emulation implementation
causing a crash.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 tests/cd-emu.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/cd-emu.c b/tests/cd-emu.c
index 8bc3a7ed..da6e3c3f 100644
--- a/tests/cd-emu.c
+++ b/tests/cd-emu.c
@@ -151,6 +151,10 @@  printf("LOOP %d\n", loop);
     g_assert_cmpint(hellos_sent, ==, hellos_expected);
     g_assert_cmpint(messages_sent, >=, messages_expected);
 
+    spice_usb_backend_channel_flush_writes(usb_ch);
+    g_assert_cmpint(hellos_sent, ==, hellos_expected);
+    g_assert_cmpint(messages_sent, >=, messages_expected);
+
     // send hello reply
     if (loop == 0) {
         DATA_START