[Spice-devel] [PATCH spice-server 1/2] tests: Check leaks registering migration interface

Frediano Ziglio fziglio at redhat.com
Thu Oct 12 14:56:16 UTC 2017


Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/tests/test-leaks.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/server/tests/test-leaks.c b/server/tests/test-leaks.c
index 04dcac4f4..7032000aa 100644
--- a/server/tests/test-leaks.c
+++ b/server/tests/test-leaks.c
@@ -143,12 +143,48 @@ static void vmc_leaks(void)
     basic_event_loop_destroy();
 }
 
+static void migrate_cb(SpiceMigrateInstance *sin)
+{
+}
+
+static const SpiceMigrateInterface migrate_interface = {
+    .base = {
+        .type          = SPICE_INTERFACE_MIGRATION,
+        .description   = "migration",
+        .major_version = SPICE_INTERFACE_MIGRATION_MAJOR,
+        .minor_version = SPICE_INTERFACE_MIGRATION_MINOR,
+    },
+    .migrate_connect_complete = migrate_cb,
+    .migrate_end_complete = migrate_cb,
+};
+
+static void migration_leaks(void)
+{
+    SpiceCoreInterface *core;
+    SpiceServer *server = spice_server_new();
+    SpiceMigrateInstance migrate;
+
+    g_assert_nonnull(server);
+
+    core = basic_event_loop_init();
+    g_assert_nonnull(core);
+
+    g_assert_cmpint(spice_server_init(server, core), ==, 0);
+
+    migrate.base.sif = &migrate_interface.base;
+    spice_server_add_interface(server, &migrate.base);
+
+    spice_server_destroy(server);
+    basic_event_loop_destroy();
+}
+
 int main(int argc, char *argv[])
 {
     g_test_init(&argc, &argv, NULL);
 
     g_test_add_func("/server/server leaks", server_leaks);
     g_test_add_func("/server/vmc leaks", vmc_leaks);
+    g_test_add_func("/server/migration leaks", migration_leaks);
 
     return g_test_run();
 }
-- 
2.13.6



More information about the Spice-devel mailing list