--- server/tests/Makefile.am | 8 ++++++ 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 + server/tests/test_guest_capabilities.c | 24 ++++++++++++++++++ 6 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 server/tests/test_guest_capabilities.c diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am index e0472f3..c0f6866 100644 --- a/server/tests/Makefile.am +++ b/server/tests/Makefile.am @@ -35,6 +35,7 @@ noinst_PROGRAMS = \ test_display_resolution_changes \ test_two_servers \ test_vdagent \ + test_guest_capabilities \ $(NULL) test_vdagent_SOURCES = \ @@ -79,6 +80,13 @@ test_empty_success_SOURCES = \ test_empty_success.c \ $(NULL) +test_guest_capabilities_SOURCES = \ + $(COMMON_BASE) \ + test_display_base.c \ + test_display_base.h \ + test_guest_capabilities.c \ + $(NULL) + test_fail_on_null_core_interface_SOURCES = \ test_fail_on_null_core_interface.c \ $(NULL) 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); diff --git a/server/tests/test_guest_capabilities.c b/server/tests/test_guest_capabilities.c new file mode 100644 index 0000000..992cad4 --- /dev/null +++ b/server/tests/test_guest_capabilities.c @@ -0,0 +1,24 @@ +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "spice.h" + +#include "test_display_base.h" + +int main(void) +{ + SpiceCoreInterface *core; + uint8_t caps[1] = {7}; + Test *test; + + core = basic_event_loop_init(); + test = test_new(core); + test_add_display_interface(test); + + spice_qxl_guest_capabilities_set(&test->qxl_instance, sizeof(caps), caps); + + return 0; +} -- 1.7.12 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel