[Spice-devel] [PATCH spice-server v2 14/15] tests: Make test-two-servers work

Christophe Fergeau cfergeau at redhat.com
Thu Sep 7 07:49:08 UTC 2017


Acked-by: Christophe Fergeau <cfergeau at redhat.com>

On Wed, Sep 06, 2017 at 05:26:55PM +0100, Frediano Ziglio wrote:
> This test runs 2 spice server in one program.
> Use two different tcp port to be able to connect to both servers.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/tests/test-display-base.c | 8 ++++++--
>  server/tests/test-display-base.h | 1 +
>  server/tests/test-two-servers.c  | 2 +-
>  3 files changed, 8 insertions(+), 3 deletions(-)
> 
> Changes since v1:
> - use test_new_with_port;
> - moved thread part to another patch.
> 
> diff --git a/server/tests/test-display-base.c b/server/tests/test-display-base.c
> index e27dcf951..289aa9840 100644
> --- a/server/tests/test-display-base.c
> +++ b/server/tests/test-display-base.c
> @@ -900,9 +900,8 @@ void test_set_command_list(Test *test, Command *commands, int num_commands)
>  }
>  
>  
> -Test *test_new(SpiceCoreInterface *core)
> +Test* test_new_with_port(SpiceCoreInterface* core, int port)
>  {
> -    int port = 5912;
>      Test *test = spice_new0(Test, 1);
>      SpiceServer* server = spice_server_new();
>  
> @@ -926,6 +925,11 @@ Test *test_new(SpiceCoreInterface *core)
>      return test;
>  }
>  
> +Test *test_new(SpiceCoreInterface *core)
> +{
> +    return test_new_with_port(core, 5912);
> +}
> +
>  void test_destroy(Test *test)
>  {
>      spice_server_destroy(test->server);
> diff --git a/server/tests/test-display-base.h b/server/tests/test-display-base.h
> index 1a4f20c5b..a80f03e78 100644
> --- a/server/tests/test-display-base.h
> +++ b/server/tests/test-display-base.h
> @@ -134,6 +134,7 @@ void test_set_simple_command_list(Test *test, const int *command, int num_comman
>  void test_set_command_list(Test *test, Command *command, int num_commands);
>  void test_add_display_interface(Test *test);
>  void test_add_agent_interface(SpiceServer *server); // TODO - Test *test
> +Test* test_new_with_port(SpiceCoreInterface* core, int port);
>  Test* test_new(SpiceCoreInterface* core);
>  void test_destroy(Test *test);
>  
> diff --git a/server/tests/test-two-servers.c b/server/tests/test-two-servers.c
> index 40a0e5717..92935528e 100644
> --- a/server/tests/test-two-servers.c
> +++ b/server/tests/test-two-servers.c
> @@ -42,7 +42,7 @@ int main(void)
>  
>      core = basic_event_loop_init();
>      t1 = test_new(core);
> -    t2 = test_new(core);
> +    t2 = test_new_with_port(core, 5913);
>      //spice_server_set_image_compression(server, SPICE_IMAGE_COMPRESSION_OFF);
>      test_add_display_interface(t1);
>      test_add_display_interface(t2);
> -- 
> 2.13.5
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list