[Spice-devel] [PATCH spice-server 3/3] test-stream-device: Check incomplete reads of StreamMsgFormat

Jonathon Jongsma jjongsma at redhat.com
Mon Nov 27 21:34:21 UTC 2017


Acked-by: Jonathon Jongsma <jjongsma at redhat.com>


On Thu, 2017-11-23 at 12:49 +0000, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/tests/test-stream-device.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/server/tests/test-stream-device.c b/server/tests/test-
> stream-device.c
> index c6f47758..656bf56b 100644
> --- a/server/tests/test-stream-device.c
> +++ b/server/tests/test-stream-device.c
> @@ -139,6 +139,11 @@ static void test_stream_device(void)
>      ++message_sizes_end;
>  
>      p = add_format(p, 640, 480, SPICE_VIDEO_CODEC_TYPE_VP9);
> +
> +    // this split the second format in half
> +    *message_sizes_end = p - message - 4;
> +    ++message_sizes_end;
> +
>      *message_sizes_end = p - message;
>      ++message_sizes_end;
>  
> @@ -163,10 +168,10 @@ static void test_stream_device(void)
>      spice_server_port_event(&vmc_instance, SPICE_PORT_EVENT_OPENED);
>      spice_server_char_device_wakeup(&vmc_instance);
>  
> -    // make sure first 2 parts are read completely
> -    g_assert(message_sizes_curr - message_sizes >= 2);
> +    // make sure first 3 parts are read completely
> +    g_assert(message_sizes_curr - message_sizes >= 3);
>      // make sure last part is not read at all
> -    g_assert(message_sizes_curr - message_sizes < 4);
> +    g_assert(message_sizes_curr - message_sizes < 5);
>  
>      test_destroy(test);
>      basic_event_loop_destroy();


More information about the Spice-devel mailing list