1*1e8a1faeSThomas Huth #include "qemu/osdep.h" 2*1e8a1faeSThomas Huth #include <glib/gstdio.h> 3*1e8a1faeSThomas Huth #include <gio/gio.h> 4*1e8a1faeSThomas Huth #include "libqtest.h" 5*1e8a1faeSThomas Huth #include "qemu-common.h" 6*1e8a1faeSThomas Huth #include "dbus-vmstate1.h" 7*1e8a1faeSThomas Huth #include "migration-helpers.h" 8*1e8a1faeSThomas Huth 9*1e8a1faeSThomas Huth static char *workdir; 10*1e8a1faeSThomas Huth 11*1e8a1faeSThomas Huth typedef struct TestServerId { 12*1e8a1faeSThomas Huth const char *name; 13*1e8a1faeSThomas Huth const char *data; 14*1e8a1faeSThomas Huth size_t size; 15*1e8a1faeSThomas Huth } TestServerId; 16*1e8a1faeSThomas Huth 17*1e8a1faeSThomas Huth static const TestServerId idA = { 18*1e8a1faeSThomas Huth "idA", "I'am\0idA!", sizeof("I'am\0idA!") 19*1e8a1faeSThomas Huth }; 20*1e8a1faeSThomas Huth 21*1e8a1faeSThomas Huth static const TestServerId idB = { 22*1e8a1faeSThomas Huth "idB", "I'am\0idB!", sizeof("I'am\0idB!") 23*1e8a1faeSThomas Huth }; 24*1e8a1faeSThomas Huth 25*1e8a1faeSThomas Huth typedef struct TestServer { 26*1e8a1faeSThomas Huth const TestServerId *id; 27*1e8a1faeSThomas Huth bool save_called; 28*1e8a1faeSThomas Huth bool load_called; 29*1e8a1faeSThomas Huth } TestServer; 30*1e8a1faeSThomas Huth 31*1e8a1faeSThomas Huth typedef struct Test { 32*1e8a1faeSThomas Huth const char *id_list; 33*1e8a1faeSThomas Huth bool migrate_fail; 34*1e8a1faeSThomas Huth bool without_dst_b; 35*1e8a1faeSThomas Huth TestServer srcA; 36*1e8a1faeSThomas Huth TestServer dstA; 37*1e8a1faeSThomas Huth TestServer srcB; 38*1e8a1faeSThomas Huth TestServer dstB; 39*1e8a1faeSThomas Huth GMainLoop *loop; 40*1e8a1faeSThomas Huth QTestState *src_qemu; 41*1e8a1faeSThomas Huth } Test; 42*1e8a1faeSThomas Huth 43*1e8a1faeSThomas Huth static gboolean 44*1e8a1faeSThomas Huth vmstate_load(VMState1 *object, GDBusMethodInvocation *invocation, 45*1e8a1faeSThomas Huth const gchar *arg_data, gpointer user_data) 46*1e8a1faeSThomas Huth { 47*1e8a1faeSThomas Huth TestServer *h = user_data; 48*1e8a1faeSThomas Huth g_autoptr(GVariant) var = NULL; 49*1e8a1faeSThomas Huth GVariant *args; 50*1e8a1faeSThomas Huth const uint8_t *data; 51*1e8a1faeSThomas Huth size_t size; 52*1e8a1faeSThomas Huth 53*1e8a1faeSThomas Huth args = g_dbus_method_invocation_get_parameters(invocation); 54*1e8a1faeSThomas Huth var = g_variant_get_child_value(args, 0); 55*1e8a1faeSThomas Huth data = g_variant_get_fixed_array(var, &size, sizeof(char)); 56*1e8a1faeSThomas Huth g_assert_cmpuint(size, ==, h->id->size); 57*1e8a1faeSThomas Huth g_assert(!memcmp(data, h->id->data, h->id->size)); 58*1e8a1faeSThomas Huth h->load_called = true; 59*1e8a1faeSThomas Huth 60*1e8a1faeSThomas Huth g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); 61*1e8a1faeSThomas Huth return TRUE; 62*1e8a1faeSThomas Huth } 63*1e8a1faeSThomas Huth 64*1e8a1faeSThomas Huth static gboolean 65*1e8a1faeSThomas Huth vmstate_save(VMState1 *object, GDBusMethodInvocation *invocation, 66*1e8a1faeSThomas Huth gpointer user_data) 67*1e8a1faeSThomas Huth { 68*1e8a1faeSThomas Huth TestServer *h = user_data; 69*1e8a1faeSThomas Huth GVariant *var; 70*1e8a1faeSThomas Huth 71*1e8a1faeSThomas Huth var = g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, 72*1e8a1faeSThomas Huth h->id->data, h->id->size, sizeof(char)); 73*1e8a1faeSThomas Huth g_dbus_method_invocation_return_value(invocation, 74*1e8a1faeSThomas Huth g_variant_new("(@ay)", var)); 75*1e8a1faeSThomas Huth h->save_called = true; 76*1e8a1faeSThomas Huth 77*1e8a1faeSThomas Huth return TRUE; 78*1e8a1faeSThomas Huth } 79*1e8a1faeSThomas Huth 80*1e8a1faeSThomas Huth typedef struct WaitNamed { 81*1e8a1faeSThomas Huth GMainLoop *loop; 82*1e8a1faeSThomas Huth bool named; 83*1e8a1faeSThomas Huth } WaitNamed; 84*1e8a1faeSThomas Huth 85*1e8a1faeSThomas Huth static void 86*1e8a1faeSThomas Huth named_cb(GDBusConnection *connection, 87*1e8a1faeSThomas Huth const gchar *name, 88*1e8a1faeSThomas Huth gpointer user_data) 89*1e8a1faeSThomas Huth { 90*1e8a1faeSThomas Huth WaitNamed *t = user_data; 91*1e8a1faeSThomas Huth 92*1e8a1faeSThomas Huth t->named = true; 93*1e8a1faeSThomas Huth g_main_loop_quit(t->loop); 94*1e8a1faeSThomas Huth } 95*1e8a1faeSThomas Huth 96*1e8a1faeSThomas Huth static GDBusConnection * 97*1e8a1faeSThomas Huth get_connection(Test *test, guint *ownid) 98*1e8a1faeSThomas Huth { 99*1e8a1faeSThomas Huth g_autofree gchar *addr = NULL; 100*1e8a1faeSThomas Huth WaitNamed *wait; 101*1e8a1faeSThomas Huth GError *err = NULL; 102*1e8a1faeSThomas Huth GDBusConnection *c; 103*1e8a1faeSThomas Huth 104*1e8a1faeSThomas Huth wait = g_new0(WaitNamed, 1); 105*1e8a1faeSThomas Huth wait->loop = test->loop; 106*1e8a1faeSThomas Huth addr = g_dbus_address_get_for_bus_sync(G_BUS_TYPE_SESSION, NULL, &err); 107*1e8a1faeSThomas Huth g_assert_no_error(err); 108*1e8a1faeSThomas Huth 109*1e8a1faeSThomas Huth c = g_dbus_connection_new_for_address_sync( 110*1e8a1faeSThomas Huth addr, 111*1e8a1faeSThomas Huth G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION | 112*1e8a1faeSThomas Huth G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, 113*1e8a1faeSThomas Huth NULL, NULL, &err); 114*1e8a1faeSThomas Huth g_assert_no_error(err); 115*1e8a1faeSThomas Huth *ownid = g_bus_own_name_on_connection(c, "org.qemu.VMState1", 116*1e8a1faeSThomas Huth G_BUS_NAME_OWNER_FLAGS_NONE, 117*1e8a1faeSThomas Huth named_cb, named_cb, wait, g_free); 118*1e8a1faeSThomas Huth if (!wait->named) { 119*1e8a1faeSThomas Huth g_main_loop_run(wait->loop); 120*1e8a1faeSThomas Huth } 121*1e8a1faeSThomas Huth 122*1e8a1faeSThomas Huth return c; 123*1e8a1faeSThomas Huth } 124*1e8a1faeSThomas Huth 125*1e8a1faeSThomas Huth static GDBusObjectManagerServer * 126*1e8a1faeSThomas Huth get_server(GDBusConnection *conn, TestServer *s, const TestServerId *id) 127*1e8a1faeSThomas Huth { 128*1e8a1faeSThomas Huth g_autoptr(GDBusObjectSkeleton) sk = NULL; 129*1e8a1faeSThomas Huth g_autoptr(VMState1Skeleton) v = NULL; 130*1e8a1faeSThomas Huth GDBusObjectManagerServer *os; 131*1e8a1faeSThomas Huth 132*1e8a1faeSThomas Huth s->id = id; 133*1e8a1faeSThomas Huth os = g_dbus_object_manager_server_new("/org/qemu"); 134*1e8a1faeSThomas Huth sk = g_dbus_object_skeleton_new("/org/qemu/VMState1"); 135*1e8a1faeSThomas Huth 136*1e8a1faeSThomas Huth v = VMSTATE1_SKELETON(vmstate1_skeleton_new()); 137*1e8a1faeSThomas Huth g_object_set(v, "id", id->name, NULL); 138*1e8a1faeSThomas Huth 139*1e8a1faeSThomas Huth g_signal_connect(v, "handle-load", G_CALLBACK(vmstate_load), s); 140*1e8a1faeSThomas Huth g_signal_connect(v, "handle-save", G_CALLBACK(vmstate_save), s); 141*1e8a1faeSThomas Huth 142*1e8a1faeSThomas Huth g_dbus_object_skeleton_add_interface(sk, G_DBUS_INTERFACE_SKELETON(v)); 143*1e8a1faeSThomas Huth g_dbus_object_manager_server_export(os, sk); 144*1e8a1faeSThomas Huth g_dbus_object_manager_server_set_connection(os, conn); 145*1e8a1faeSThomas Huth 146*1e8a1faeSThomas Huth return os; 147*1e8a1faeSThomas Huth } 148*1e8a1faeSThomas Huth 149*1e8a1faeSThomas Huth static void 150*1e8a1faeSThomas Huth set_id_list(Test *test, QTestState *s) 151*1e8a1faeSThomas Huth { 152*1e8a1faeSThomas Huth if (!test->id_list) { 153*1e8a1faeSThomas Huth return; 154*1e8a1faeSThomas Huth } 155*1e8a1faeSThomas Huth 156*1e8a1faeSThomas Huth g_assert(!qmp_rsp_is_err(qtest_qmp(s, 157*1e8a1faeSThomas Huth "{ 'execute': 'qom-set', 'arguments': " 158*1e8a1faeSThomas Huth "{ 'path': '/objects/dv', 'property': 'id-list', 'value': %s } }", 159*1e8a1faeSThomas Huth test->id_list))); 160*1e8a1faeSThomas Huth } 161*1e8a1faeSThomas Huth 162*1e8a1faeSThomas Huth static gpointer 163*1e8a1faeSThomas Huth dbus_vmstate_thread(gpointer data) 164*1e8a1faeSThomas Huth { 165*1e8a1faeSThomas Huth GMainLoop *loop = data; 166*1e8a1faeSThomas Huth 167*1e8a1faeSThomas Huth g_main_loop_run(loop); 168*1e8a1faeSThomas Huth 169*1e8a1faeSThomas Huth return NULL; 170*1e8a1faeSThomas Huth } 171*1e8a1faeSThomas Huth 172*1e8a1faeSThomas Huth static void 173*1e8a1faeSThomas Huth test_dbus_vmstate(Test *test) 174*1e8a1faeSThomas Huth { 175*1e8a1faeSThomas Huth g_autofree char *src_qemu_args = NULL; 176*1e8a1faeSThomas Huth g_autofree char *dst_qemu_args = NULL; 177*1e8a1faeSThomas Huth g_autoptr(GTestDBus) srcbus = NULL; 178*1e8a1faeSThomas Huth g_autoptr(GTestDBus) dstbus = NULL; 179*1e8a1faeSThomas Huth g_autoptr(GDBusConnection) srcconnA = NULL; 180*1e8a1faeSThomas Huth g_autoptr(GDBusConnection) srcconnB = NULL; 181*1e8a1faeSThomas Huth g_autoptr(GDBusConnection) dstconnA = NULL; 182*1e8a1faeSThomas Huth g_autoptr(GDBusConnection) dstconnB = NULL; 183*1e8a1faeSThomas Huth g_autoptr(GDBusObjectManagerServer) srcserverA = NULL; 184*1e8a1faeSThomas Huth g_autoptr(GDBusObjectManagerServer) srcserverB = NULL; 185*1e8a1faeSThomas Huth g_autoptr(GDBusObjectManagerServer) dstserverA = NULL; 186*1e8a1faeSThomas Huth g_autoptr(GDBusObjectManagerServer) dstserverB = NULL; 187*1e8a1faeSThomas Huth g_auto(GStrv) srcaddr = NULL; 188*1e8a1faeSThomas Huth g_auto(GStrv) dstaddr = NULL; 189*1e8a1faeSThomas Huth g_autoptr(GThread) thread = NULL; 190*1e8a1faeSThomas Huth g_autoptr(GMainLoop) loop = NULL; 191*1e8a1faeSThomas Huth g_autofree char *uri = NULL; 192*1e8a1faeSThomas Huth QTestState *src_qemu = NULL, *dst_qemu = NULL; 193*1e8a1faeSThomas Huth guint ownsrcA, ownsrcB, owndstA, owndstB; 194*1e8a1faeSThomas Huth 195*1e8a1faeSThomas Huth uri = g_strdup_printf("unix:%s/migsocket", workdir); 196*1e8a1faeSThomas Huth 197*1e8a1faeSThomas Huth loop = g_main_loop_new(NULL, FALSE); 198*1e8a1faeSThomas Huth test->loop = loop; 199*1e8a1faeSThomas Huth 200*1e8a1faeSThomas Huth srcbus = g_test_dbus_new(G_TEST_DBUS_NONE); 201*1e8a1faeSThomas Huth g_test_dbus_up(srcbus); 202*1e8a1faeSThomas Huth srcconnA = get_connection(test, &ownsrcA); 203*1e8a1faeSThomas Huth srcserverA = get_server(srcconnA, &test->srcA, &idA); 204*1e8a1faeSThomas Huth srcconnB = get_connection(test, &ownsrcB); 205*1e8a1faeSThomas Huth srcserverB = get_server(srcconnB, &test->srcB, &idB); 206*1e8a1faeSThomas Huth 207*1e8a1faeSThomas Huth /* remove ,guid=foo part */ 208*1e8a1faeSThomas Huth srcaddr = g_strsplit(g_test_dbus_get_bus_address(srcbus), ",", 2); 209*1e8a1faeSThomas Huth src_qemu_args = 210*1e8a1faeSThomas Huth g_strdup_printf("-object dbus-vmstate,id=dv,addr=%s", srcaddr[0]); 211*1e8a1faeSThomas Huth 212*1e8a1faeSThomas Huth dstbus = g_test_dbus_new(G_TEST_DBUS_NONE); 213*1e8a1faeSThomas Huth g_test_dbus_up(dstbus); 214*1e8a1faeSThomas Huth dstconnA = get_connection(test, &owndstA); 215*1e8a1faeSThomas Huth dstserverA = get_server(dstconnA, &test->dstA, &idA); 216*1e8a1faeSThomas Huth if (!test->without_dst_b) { 217*1e8a1faeSThomas Huth dstconnB = get_connection(test, &owndstB); 218*1e8a1faeSThomas Huth dstserverB = get_server(dstconnB, &test->dstB, &idB); 219*1e8a1faeSThomas Huth } 220*1e8a1faeSThomas Huth 221*1e8a1faeSThomas Huth dstaddr = g_strsplit(g_test_dbus_get_bus_address(dstbus), ",", 2); 222*1e8a1faeSThomas Huth dst_qemu_args = 223*1e8a1faeSThomas Huth g_strdup_printf("-object dbus-vmstate,id=dv,addr=%s -incoming %s", 224*1e8a1faeSThomas Huth dstaddr[0], uri); 225*1e8a1faeSThomas Huth 226*1e8a1faeSThomas Huth src_qemu = qtest_init(src_qemu_args); 227*1e8a1faeSThomas Huth dst_qemu = qtest_init(dst_qemu_args); 228*1e8a1faeSThomas Huth set_id_list(test, src_qemu); 229*1e8a1faeSThomas Huth set_id_list(test, dst_qemu); 230*1e8a1faeSThomas Huth 231*1e8a1faeSThomas Huth thread = g_thread_new("dbus-vmstate-thread", dbus_vmstate_thread, loop); 232*1e8a1faeSThomas Huth 233*1e8a1faeSThomas Huth migrate_qmp(src_qemu, uri, "{}"); 234*1e8a1faeSThomas Huth test->src_qemu = src_qemu; 235*1e8a1faeSThomas Huth if (test->migrate_fail) { 236*1e8a1faeSThomas Huth wait_for_migration_fail(src_qemu, true); 237*1e8a1faeSThomas Huth qtest_set_expected_status(dst_qemu, 1); 238*1e8a1faeSThomas Huth } else { 239*1e8a1faeSThomas Huth wait_for_migration_complete(src_qemu); 240*1e8a1faeSThomas Huth } 241*1e8a1faeSThomas Huth 242*1e8a1faeSThomas Huth qtest_quit(dst_qemu); 243*1e8a1faeSThomas Huth qtest_quit(src_qemu); 244*1e8a1faeSThomas Huth g_bus_unown_name(ownsrcA); 245*1e8a1faeSThomas Huth g_bus_unown_name(ownsrcB); 246*1e8a1faeSThomas Huth g_bus_unown_name(owndstA); 247*1e8a1faeSThomas Huth if (!test->without_dst_b) { 248*1e8a1faeSThomas Huth g_bus_unown_name(owndstB); 249*1e8a1faeSThomas Huth } 250*1e8a1faeSThomas Huth 251*1e8a1faeSThomas Huth g_main_loop_quit(test->loop); 252*1e8a1faeSThomas Huth } 253*1e8a1faeSThomas Huth 254*1e8a1faeSThomas Huth static void 255*1e8a1faeSThomas Huth check_not_migrated(TestServer *s, TestServer *d) 256*1e8a1faeSThomas Huth { 257*1e8a1faeSThomas Huth assert(!s->save_called); 258*1e8a1faeSThomas Huth assert(!s->load_called); 259*1e8a1faeSThomas Huth assert(!d->save_called); 260*1e8a1faeSThomas Huth assert(!d->load_called); 261*1e8a1faeSThomas Huth } 262*1e8a1faeSThomas Huth 263*1e8a1faeSThomas Huth static void 264*1e8a1faeSThomas Huth check_migrated(TestServer *s, TestServer *d) 265*1e8a1faeSThomas Huth { 266*1e8a1faeSThomas Huth assert(s->save_called); 267*1e8a1faeSThomas Huth assert(!s->load_called); 268*1e8a1faeSThomas Huth assert(!d->save_called); 269*1e8a1faeSThomas Huth assert(d->load_called); 270*1e8a1faeSThomas Huth } 271*1e8a1faeSThomas Huth 272*1e8a1faeSThomas Huth static void 273*1e8a1faeSThomas Huth test_dbus_vmstate_without_list(void) 274*1e8a1faeSThomas Huth { 275*1e8a1faeSThomas Huth Test test = { 0, }; 276*1e8a1faeSThomas Huth 277*1e8a1faeSThomas Huth test_dbus_vmstate(&test); 278*1e8a1faeSThomas Huth 279*1e8a1faeSThomas Huth check_migrated(&test.srcA, &test.dstA); 280*1e8a1faeSThomas Huth check_migrated(&test.srcB, &test.dstB); 281*1e8a1faeSThomas Huth } 282*1e8a1faeSThomas Huth 283*1e8a1faeSThomas Huth static void 284*1e8a1faeSThomas Huth test_dbus_vmstate_with_list(void) 285*1e8a1faeSThomas Huth { 286*1e8a1faeSThomas Huth Test test = { .id_list = "idA,idB" }; 287*1e8a1faeSThomas Huth 288*1e8a1faeSThomas Huth test_dbus_vmstate(&test); 289*1e8a1faeSThomas Huth 290*1e8a1faeSThomas Huth check_migrated(&test.srcA, &test.dstA); 291*1e8a1faeSThomas Huth check_migrated(&test.srcB, &test.dstB); 292*1e8a1faeSThomas Huth } 293*1e8a1faeSThomas Huth 294*1e8a1faeSThomas Huth static void 295*1e8a1faeSThomas Huth test_dbus_vmstate_only_a(void) 296*1e8a1faeSThomas Huth { 297*1e8a1faeSThomas Huth Test test = { .id_list = "idA" }; 298*1e8a1faeSThomas Huth 299*1e8a1faeSThomas Huth test_dbus_vmstate(&test); 300*1e8a1faeSThomas Huth 301*1e8a1faeSThomas Huth check_migrated(&test.srcA, &test.dstA); 302*1e8a1faeSThomas Huth check_not_migrated(&test.srcB, &test.dstB); 303*1e8a1faeSThomas Huth } 304*1e8a1faeSThomas Huth 305*1e8a1faeSThomas Huth static void 306*1e8a1faeSThomas Huth test_dbus_vmstate_missing_src(void) 307*1e8a1faeSThomas Huth { 308*1e8a1faeSThomas Huth Test test = { .id_list = "idA,idC", .migrate_fail = true }; 309*1e8a1faeSThomas Huth 310*1e8a1faeSThomas Huth /* run in subprocess to silence QEMU error reporting */ 311*1e8a1faeSThomas Huth if (g_test_subprocess()) { 312*1e8a1faeSThomas Huth test_dbus_vmstate(&test); 313*1e8a1faeSThomas Huth check_not_migrated(&test.srcA, &test.dstA); 314*1e8a1faeSThomas Huth check_not_migrated(&test.srcB, &test.dstB); 315*1e8a1faeSThomas Huth return; 316*1e8a1faeSThomas Huth } 317*1e8a1faeSThomas Huth 318*1e8a1faeSThomas Huth g_test_trap_subprocess(NULL, 0, 0); 319*1e8a1faeSThomas Huth g_test_trap_assert_passed(); 320*1e8a1faeSThomas Huth } 321*1e8a1faeSThomas Huth 322*1e8a1faeSThomas Huth static void 323*1e8a1faeSThomas Huth test_dbus_vmstate_missing_dst(void) 324*1e8a1faeSThomas Huth { 325*1e8a1faeSThomas Huth Test test = { .id_list = "idA,idB", 326*1e8a1faeSThomas Huth .without_dst_b = true, 327*1e8a1faeSThomas Huth .migrate_fail = true }; 328*1e8a1faeSThomas Huth 329*1e8a1faeSThomas Huth /* run in subprocess to silence QEMU error reporting */ 330*1e8a1faeSThomas Huth if (g_test_subprocess()) { 331*1e8a1faeSThomas Huth test_dbus_vmstate(&test); 332*1e8a1faeSThomas Huth assert(test.srcA.save_called); 333*1e8a1faeSThomas Huth assert(test.srcB.save_called); 334*1e8a1faeSThomas Huth assert(!test.dstB.save_called); 335*1e8a1faeSThomas Huth return; 336*1e8a1faeSThomas Huth } 337*1e8a1faeSThomas Huth 338*1e8a1faeSThomas Huth g_test_trap_subprocess(NULL, 0, 0); 339*1e8a1faeSThomas Huth g_test_trap_assert_passed(); 340*1e8a1faeSThomas Huth } 341*1e8a1faeSThomas Huth 342*1e8a1faeSThomas Huth int 343*1e8a1faeSThomas Huth main(int argc, char **argv) 344*1e8a1faeSThomas Huth { 345*1e8a1faeSThomas Huth GError *err = NULL; 346*1e8a1faeSThomas Huth g_autofree char *dbus_daemon = NULL; 347*1e8a1faeSThomas Huth int ret; 348*1e8a1faeSThomas Huth 349*1e8a1faeSThomas Huth dbus_daemon = g_build_filename(G_STRINGIFY(SRCDIR), 350*1e8a1faeSThomas Huth "tests", 351*1e8a1faeSThomas Huth "dbus-vmstate-daemon.sh", 352*1e8a1faeSThomas Huth NULL); 353*1e8a1faeSThomas Huth g_setenv("G_TEST_DBUS_DAEMON", dbus_daemon, true); 354*1e8a1faeSThomas Huth 355*1e8a1faeSThomas Huth g_test_init(&argc, &argv, NULL); 356*1e8a1faeSThomas Huth 357*1e8a1faeSThomas Huth workdir = g_dir_make_tmp("dbus-vmstate-test-XXXXXX", &err); 358*1e8a1faeSThomas Huth if (!workdir) { 359*1e8a1faeSThomas Huth g_error("Unable to create temporary dir: %s\n", err->message); 360*1e8a1faeSThomas Huth exit(1); 361*1e8a1faeSThomas Huth } 362*1e8a1faeSThomas Huth 363*1e8a1faeSThomas Huth g_setenv("DBUS_VMSTATE_TEST_TMPDIR", workdir, true); 364*1e8a1faeSThomas Huth 365*1e8a1faeSThomas Huth qtest_add_func("/dbus-vmstate/without-list", 366*1e8a1faeSThomas Huth test_dbus_vmstate_without_list); 367*1e8a1faeSThomas Huth qtest_add_func("/dbus-vmstate/with-list", 368*1e8a1faeSThomas Huth test_dbus_vmstate_with_list); 369*1e8a1faeSThomas Huth qtest_add_func("/dbus-vmstate/only-a", 370*1e8a1faeSThomas Huth test_dbus_vmstate_only_a); 371*1e8a1faeSThomas Huth qtest_add_func("/dbus-vmstate/missing-src", 372*1e8a1faeSThomas Huth test_dbus_vmstate_missing_src); 373*1e8a1faeSThomas Huth qtest_add_func("/dbus-vmstate/missing-dst", 374*1e8a1faeSThomas Huth test_dbus_vmstate_missing_dst); 375*1e8a1faeSThomas Huth 376*1e8a1faeSThomas Huth ret = g_test_run(); 377*1e8a1faeSThomas Huth 378*1e8a1faeSThomas Huth rmdir(workdir); 379*1e8a1faeSThomas Huth g_free(workdir); 380*1e8a1faeSThomas Huth 381*1e8a1faeSThomas Huth return ret; 382*1e8a1faeSThomas Huth } 383