[Spice-devel] [PATCH spice v3 6/7] server/tests: agent mock, client_monitors_config
Hans de Goede
hdegoede at redhat.com
Wed Sep 12 07:03:49 PDT 2012
ACK.
On 09/12/2012 03:13 PM, Alon Levy wrote:
> ---
> server/tests/basic_event_loop.c | 2 +-
> server/tests/test_display_base.c | 46 ++++++++++++++++++++++++++++++++++++++
> server/tests/test_display_base.h | 1 +
> server/tests/test_display_no_ssl.c | 1 +
> 4 files changed, 49 insertions(+), 1 deletion(-)
>
> diff --git a/server/tests/basic_event_loop.c b/server/tests/basic_event_loop.c
> index 34bb178..c6f6698 100644
> --- a/server/tests/basic_event_loop.c
> +++ b/server/tests/basic_event_loop.c
> @@ -115,7 +115,7 @@ static void watch_remove(SpiceWatch *watch)
>
> static void channel_event(int event, SpiceChannelEventInfo *info)
> {
> - DPRINTF(0, "channel event con, type, id, event: %ld, %d, %d, %d\n",
> + DPRINTF(0, "channel event con, type, id, event: %ld, %d, %d, %d",
> info->connection_id, info->type, info->id, event);
> }
>
> diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
> index 710e3a8..8c7f512 100644
> --- a/server/tests/test_display_base.c
> +++ b/server/tests/test_display_base.c
> @@ -10,6 +10,7 @@
> #include <sys/types.h>
> #include <getopt.h>
>
> +#include "spice.h"
> #include <spice/qxl_dev.h>
>
> #include "test_display_base.h"
> @@ -700,6 +701,11 @@ static int flush_resources(QXLInstance *qin)
> return TRUE;
> }
>
> +static void client_monitors_config(QXLInstance *qin, VDAgentMonitorsConfig *monitors_config)
> +{
> + printf("%s: %d\n", __func__, monitors_config->num_of_monitors);
> +}
> +
> QXLInterface display_sif = {
> .base = {
> .type = SPICE_INTERFACE_QXL,
> @@ -720,6 +726,7 @@ QXLInterface display_sif = {
> .req_cursor_notification = req_cursor_notification,
> .notify_update = notify_update,
> .flush_resources = flush_resources,
> + .client_monitors_config = client_monitors_config,
> };
>
> /* interface for tests */
> @@ -728,6 +735,45 @@ void test_add_display_interface(Test* test)
> spice_server_add_interface(test->server, &test->qxl_instance.base);
> }
>
> +static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
> +{
> + printf("%s: %d\n", __func__, len);
> + return len;
> +}
> +
> +static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
> +{
> + printf("%s: %d\n", __func__, len);
> + return 0;
> +}
> +
> +static void vmc_state(SpiceCharDeviceInstance *sin, int connected)
> +{
> + printf("%s: %d\n", __func__, connected);
> +}
> +
> +static SpiceCharDeviceInterface vdagent_sif = {
> + .base.type = SPICE_INTERFACE_CHAR_DEVICE,
> + .base.description = "test spice virtual channel char device",
> + .base.major_version = SPICE_INTERFACE_CHAR_DEVICE_MAJOR,
> + .base.minor_version = SPICE_INTERFACE_CHAR_DEVICE_MINOR,
> + .state = vmc_state,
> + .write = vmc_write,
> + .read = vmc_read,
> +};
> +
> +SpiceCharDeviceInstance vdagent_sin = {
> + .base = {
> + .sif = &vdagent_sif.base,
> + },
> + .subtype = "vdagent",
> +};
> +
> +void test_add_agent_interface(SpiceServer *server)
> +{
> + spice_server_add_interface(server, &vdagent_sin.base);
> +}
> +
> void test_set_simple_command_list(Test *test, int *simple_commands, int num_commands)
> {
> int i;
> diff --git a/server/tests/test_display_base.h b/server/tests/test_display_base.h
> index db97b8c..c3b9fea 100644
> --- a/server/tests/test_display_base.h
> +++ b/server/tests/test_display_base.h
> @@ -105,6 +105,7 @@ struct Test {
> void test_set_simple_command_list(Test *test, int *command, int num_commands);
> 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(SpiceCoreInterface* core);
>
> uint32_t test_get_width(void);
> diff --git a/server/tests/test_display_no_ssl.c b/server/tests/test_display_no_ssl.c
> index 67325cc..83ab3dc 100644
> --- a/server/tests/test_display_no_ssl.c
> +++ b/server/tests/test_display_no_ssl.c
> @@ -43,6 +43,7 @@ int main(void)
> test = test_new(core);
> //spice_server_set_image_compression(server, SPICE_IMAGE_COMPRESS_OFF);
> test_add_display_interface(test);
> + test_add_agent_interface(test->server);
> test_set_simple_command_list(test, simple_commands, COUNT(simple_commands));
>
> ping_timer = core->timer_add(pinger, NULL);
>
More information about the Spice-devel
mailing list