]> git.proxmox.com Git - mirror_qemu.git/blob - tests/migration-test.c
tests: Clean up string interpolation into QMP input (simple cases)
[mirror_qemu.git] / tests / migration-test.c
1 /*
2 * QTest testcase for migration
3 *
4 * Copyright (c) 2016-2018 Red Hat, Inc. and/or its affiliates
5 * based on the vhost-user-test.c that is:
6 * Copyright (c) 2014 Virtual Open Systems Sarl.
7 *
8 * This work is licensed under the terms of the GNU GPL, version 2 or later.
9 * See the COPYING file in the top-level directory.
10 *
11 */
12
13 #include "qemu/osdep.h"
14
15 #include "libqtest.h"
16 #include "qapi/qmp/qdict.h"
17 #include "qemu/option.h"
18 #include "qemu/range.h"
19 #include "qemu/sockets.h"
20 #include "chardev/char.h"
21 #include "sysemu/sysemu.h"
22
23 /* TODO actually test the results and get rid of this */
24 #define qtest_qmp_discard_response(...) qobject_unref(qtest_qmp(__VA_ARGS__))
25
26 const unsigned start_address = 1024 * 1024;
27 const unsigned end_address = 100 * 1024 * 1024;
28 bool got_stop;
29 static bool uffd_feature_thread_id;
30
31 #if defined(__linux__)
32 #include <sys/syscall.h>
33 #include <sys/vfs.h>
34 #endif
35
36 #if defined(__linux__) && defined(__NR_userfaultfd) && defined(CONFIG_EVENTFD)
37 #include <sys/eventfd.h>
38 #include <sys/ioctl.h>
39 #include <linux/userfaultfd.h>
40
41 static bool ufd_version_check(void)
42 {
43 struct uffdio_api api_struct;
44 uint64_t ioctl_mask;
45
46 int ufd = syscall(__NR_userfaultfd, O_CLOEXEC);
47
48 if (ufd == -1) {
49 g_test_message("Skipping test: userfaultfd not available");
50 return false;
51 }
52
53 api_struct.api = UFFD_API;
54 api_struct.features = 0;
55 if (ioctl(ufd, UFFDIO_API, &api_struct)) {
56 g_test_message("Skipping test: UFFDIO_API failed");
57 return false;
58 }
59 uffd_feature_thread_id = api_struct.features & UFFD_FEATURE_THREAD_ID;
60
61 ioctl_mask = (__u64)1 << _UFFDIO_REGISTER |
62 (__u64)1 << _UFFDIO_UNREGISTER;
63 if ((api_struct.ioctls & ioctl_mask) != ioctl_mask) {
64 g_test_message("Skipping test: Missing userfault feature");
65 return false;
66 }
67
68 return true;
69 }
70
71 #else
72 static bool ufd_version_check(void)
73 {
74 g_test_message("Skipping test: Userfault not available (builtdtime)");
75 return false;
76 }
77
78 #endif
79
80 static const char *tmpfs;
81
82 /* A simple PC boot sector that modifies memory (1-100MB) quickly
83 * outputting a 'B' every so often if it's still running.
84 */
85 #include "tests/migration/x86-a-b-bootblock.h"
86
87 static void init_bootfile_x86(const char *bootpath)
88 {
89 FILE *bootfile = fopen(bootpath, "wb");
90
91 g_assert_cmpint(fwrite(x86_bootsect, 512, 1, bootfile), ==, 1);
92 fclose(bootfile);
93 }
94
95 /*
96 * Wait for some output in the serial output file,
97 * we get an 'A' followed by an endless string of 'B's
98 * but on the destination we won't have the A.
99 */
100 static void wait_for_serial(const char *side)
101 {
102 char *serialpath = g_strdup_printf("%s/%s", tmpfs, side);
103 FILE *serialfile = fopen(serialpath, "r");
104 const char *arch = qtest_get_arch();
105 int started = (strcmp(side, "src_serial") == 0 &&
106 strcmp(arch, "ppc64") == 0) ? 0 : 1;
107
108 g_free(serialpath);
109 do {
110 int readvalue = fgetc(serialfile);
111
112 if (!started) {
113 /* SLOF prints its banner before starting test,
114 * to ignore it, mark the start of the test with '_',
115 * ignore all characters until this marker
116 */
117 switch (readvalue) {
118 case '_':
119 started = 1;
120 break;
121 case EOF:
122 fseek(serialfile, 0, SEEK_SET);
123 usleep(1000);
124 break;
125 }
126 continue;
127 }
128 switch (readvalue) {
129 case 'A':
130 /* Fine */
131 break;
132
133 case 'B':
134 /* It's alive! */
135 fclose(serialfile);
136 return;
137
138 case EOF:
139 started = (strcmp(side, "src_serial") == 0 &&
140 strcmp(arch, "ppc64") == 0) ? 0 : 1;
141 fseek(serialfile, 0, SEEK_SET);
142 usleep(1000);
143 break;
144
145 default:
146 fprintf(stderr, "Unexpected %d on %s serial\n", readvalue, side);
147 g_assert_not_reached();
148 }
149 } while (true);
150 }
151
152 /*
153 * Events can get in the way of responses we are actually waiting for.
154 */
155 static QDict *wait_command(QTestState *who, const char *command)
156 {
157 const char *event_string;
158 QDict *response;
159
160 response = qtest_qmp(who, command);
161
162 while (qdict_haskey(response, "event")) {
163 /* OK, it was an event */
164 event_string = qdict_get_str(response, "event");
165 if (!strcmp(event_string, "STOP")) {
166 got_stop = true;
167 }
168 qobject_unref(response);
169 response = qtest_qmp_receive(who);
170 }
171 return response;
172 }
173
174 /*
175 * Note: caller is responsible to free the returned object via
176 * qobject_unref() after use
177 */
178 static QDict *migrate_query(QTestState *who)
179 {
180 QDict *rsp, *rsp_return;
181
182 rsp = wait_command(who, "{ 'execute': 'query-migrate' }");
183 rsp_return = qdict_get_qdict(rsp, "return");
184 g_assert(rsp_return);
185 qobject_ref(rsp_return);
186 qobject_unref(rsp);
187
188 return rsp_return;
189 }
190
191 /*
192 * Note: caller is responsible to free the returned object via
193 * g_free() after use
194 */
195 static gchar *migrate_query_status(QTestState *who)
196 {
197 QDict *rsp_return = migrate_query(who);
198 gchar *status = g_strdup(qdict_get_str(rsp_return, "status"));
199
200 g_assert(status);
201 qobject_unref(rsp_return);
202
203 return status;
204 }
205
206 /*
207 * It's tricky to use qemu's migration event capability with qtest,
208 * events suddenly appearing confuse the qmp()/hmp() responses.
209 */
210
211 static uint64_t get_migration_pass(QTestState *who)
212 {
213 QDict *rsp_return, *rsp_ram;
214 uint64_t result;
215
216 rsp_return = migrate_query(who);
217 if (!qdict_haskey(rsp_return, "ram")) {
218 /* Still in setup */
219 result = 0;
220 } else {
221 rsp_ram = qdict_get_qdict(rsp_return, "ram");
222 result = qdict_get_try_int(rsp_ram, "dirty-sync-count", 0);
223 }
224 qobject_unref(rsp_return);
225 return result;
226 }
227
228 static void read_blocktime(QTestState *who)
229 {
230 QDict *rsp_return;
231
232 rsp_return = migrate_query(who);
233 g_assert(qdict_haskey(rsp_return, "postcopy-blocktime"));
234 qobject_unref(rsp_return);
235 }
236
237 static void wait_for_migration_status(QTestState *who,
238 const char *goal)
239 {
240 while (true) {
241 bool completed;
242 char *status;
243
244 status = migrate_query_status(who);
245 completed = strcmp(status, goal) == 0;
246 g_assert_cmpstr(status, !=, "failed");
247 g_free(status);
248 if (completed) {
249 return;
250 }
251 usleep(1000);
252 }
253 }
254
255 static void wait_for_migration_complete(QTestState *who)
256 {
257 wait_for_migration_status(who, "completed");
258 }
259
260 static void wait_for_migration_pass(QTestState *who)
261 {
262 uint64_t initial_pass = get_migration_pass(who);
263 uint64_t pass;
264
265 /* Wait for the 1st sync */
266 while (!got_stop && !initial_pass) {
267 usleep(1000);
268 initial_pass = get_migration_pass(who);
269 }
270
271 do {
272 usleep(1000);
273 pass = get_migration_pass(who);
274 } while (pass == initial_pass && !got_stop);
275 }
276
277 static void check_guests_ram(QTestState *who)
278 {
279 /* Our ASM test will have been incrementing one byte from each page from
280 * 1MB to <100MB in order.
281 * This gives us a constraint that any page's byte should be equal or less
282 * than the previous pages byte (mod 256); and they should all be equal
283 * except for one transition at the point where we meet the incrementer.
284 * (We're running this with the guest stopped).
285 */
286 unsigned address;
287 uint8_t first_byte;
288 uint8_t last_byte;
289 bool hit_edge = false;
290 bool bad = false;
291
292 qtest_memread(who, start_address, &first_byte, 1);
293 last_byte = first_byte;
294
295 for (address = start_address + 4096; address < end_address; address += 4096)
296 {
297 uint8_t b;
298 qtest_memread(who, address, &b, 1);
299 if (b != last_byte) {
300 if (((b + 1) % 256) == last_byte && !hit_edge) {
301 /* This is OK, the guest stopped at the point of
302 * incrementing the previous page but didn't get
303 * to us yet.
304 */
305 hit_edge = true;
306 last_byte = b;
307 } else {
308 fprintf(stderr, "Memory content inconsistency at %x"
309 " first_byte = %x last_byte = %x current = %x"
310 " hit_edge = %x\n",
311 address, first_byte, last_byte, b, hit_edge);
312 bad = true;
313 }
314 }
315 }
316 g_assert_false(bad);
317 }
318
319 static void cleanup(const char *filename)
320 {
321 char *path = g_strdup_printf("%s/%s", tmpfs, filename);
322
323 unlink(path);
324 g_free(path);
325 }
326
327 static void migrate_check_parameter(QTestState *who, const char *parameter,
328 const char *value)
329 {
330 QDict *rsp, *rsp_return;
331 char *result;
332
333 rsp = wait_command(who, "{ 'execute': 'query-migrate-parameters' }");
334 rsp_return = qdict_get_qdict(rsp, "return");
335 result = g_strdup_printf("%" PRId64,
336 qdict_get_try_int(rsp_return, parameter, -1));
337 g_assert_cmpstr(result, ==, value);
338 g_free(result);
339 qobject_unref(rsp);
340 }
341
342 static void migrate_set_parameter(QTestState *who, const char *parameter,
343 const char *value)
344 {
345 QDict *rsp;
346 gchar *cmd;
347
348 cmd = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
349 "'arguments': { '%s': %s } }",
350 parameter, value);
351 rsp = qtest_qmp(who, cmd);
352 g_free(cmd);
353 g_assert(qdict_haskey(rsp, "return"));
354 qobject_unref(rsp);
355 migrate_check_parameter(who, parameter, value);
356 }
357
358 static void migrate_pause(QTestState *who)
359 {
360 QDict *rsp;
361
362 rsp = wait_command(who, "{ 'execute': 'migrate-pause' }");
363 g_assert(qdict_haskey(rsp, "return"));
364 qobject_unref(rsp);
365 }
366
367 static void migrate_recover(QTestState *who, const char *uri)
368 {
369 QDict *rsp;
370 gchar *cmd = g_strdup_printf(
371 "{ 'execute': 'migrate-recover', "
372 " 'id': 'recover-cmd', "
373 " 'arguments': { 'uri': '%s' } }", uri);
374
375 rsp = wait_command(who, cmd);
376 g_assert(qdict_haskey(rsp, "return"));
377 g_free(cmd);
378 qobject_unref(rsp);
379 }
380
381 static void migrate_set_capability(QTestState *who, const char *capability,
382 const char *value)
383 {
384 QDict *rsp;
385 gchar *cmd;
386
387 cmd = g_strdup_printf("{ 'execute': 'migrate-set-capabilities',"
388 "'arguments': { "
389 "'capabilities': [ { "
390 "'capability': '%s', 'state': %s } ] } }",
391 capability, value);
392 rsp = qtest_qmp(who, cmd);
393 g_free(cmd);
394 g_assert(qdict_haskey(rsp, "return"));
395 qobject_unref(rsp);
396 }
397
398 static void migrate(QTestState *who, const char *uri, const char *extra)
399 {
400 QDict *rsp;
401 gchar *cmd;
402
403 cmd = g_strdup_printf("{ 'execute': 'migrate',"
404 " 'arguments': { 'uri': '%s' %s } }",
405 uri, extra ? extra : "");
406 rsp = qtest_qmp(who, cmd);
407 g_free(cmd);
408 g_assert(qdict_haskey(rsp, "return"));
409 qobject_unref(rsp);
410 }
411
412 static void migrate_postcopy_start(QTestState *from, QTestState *to)
413 {
414 QDict *rsp;
415
416 rsp = wait_command(from, "{ 'execute': 'migrate-start-postcopy' }");
417 g_assert(qdict_haskey(rsp, "return"));
418 qobject_unref(rsp);
419
420 if (!got_stop) {
421 qtest_qmp_eventwait(from, "STOP");
422 }
423
424 qtest_qmp_eventwait(to, "RESUME");
425 }
426
427 static int test_migrate_start(QTestState **from, QTestState **to,
428 const char *uri, bool hide_stderr)
429 {
430 gchar *cmd_src, *cmd_dst;
431 char *bootpath = g_strdup_printf("%s/bootsect", tmpfs);
432 const char *arch = qtest_get_arch();
433 const char *accel = "kvm:tcg";
434
435 got_stop = false;
436
437 if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
438 init_bootfile_x86(bootpath);
439 cmd_src = g_strdup_printf("-machine accel=%s -m 150M"
440 " -name source,debug-threads=on"
441 " -serial file:%s/src_serial"
442 " -drive file=%s,format=raw",
443 accel, tmpfs, bootpath);
444 cmd_dst = g_strdup_printf("-machine accel=%s -m 150M"
445 " -name target,debug-threads=on"
446 " -serial file:%s/dest_serial"
447 " -drive file=%s,format=raw"
448 " -incoming %s",
449 accel, tmpfs, bootpath, uri);
450 } else if (strcmp(arch, "ppc64") == 0) {
451
452 /* On ppc64, the test only works with kvm-hv, but not with kvm-pr
453 * and TCG is touchy due to race conditions on dirty bits
454 * (especially on PPC for some reason)
455 */
456 if (access("/sys/module/kvm_hv", F_OK)) {
457 g_print("Skipping test: kvm_hv not available ");
458 return -1;
459 }
460 cmd_src = g_strdup_printf("-machine accel=%s -m 256M"
461 " -name source,debug-threads=on"
462 " -serial file:%s/src_serial"
463 " -prom-env '"
464 "boot-command=hex .\" _\" begin %x %x "
465 "do i c@ 1 + i c! 1000 +loop .\" B\" 0 "
466 "until'", accel, tmpfs, end_address,
467 start_address);
468 cmd_dst = g_strdup_printf("-machine accel=%s -m 256M"
469 " -name target,debug-threads=on"
470 " -serial file:%s/dest_serial"
471 " -incoming %s",
472 accel, tmpfs, uri);
473 } else {
474 g_assert_not_reached();
475 }
476
477 g_free(bootpath);
478
479 if (hide_stderr) {
480 gchar *tmp;
481 tmp = g_strdup_printf("%s 2>/dev/null", cmd_src);
482 g_free(cmd_src);
483 cmd_src = tmp;
484
485 tmp = g_strdup_printf("%s 2>/dev/null", cmd_dst);
486 g_free(cmd_dst);
487 cmd_dst = tmp;
488 }
489
490 *from = qtest_start(cmd_src);
491 g_free(cmd_src);
492
493 *to = qtest_init(cmd_dst);
494 g_free(cmd_dst);
495 return 0;
496 }
497
498 static void test_migrate_end(QTestState *from, QTestState *to, bool test_dest)
499 {
500 unsigned char dest_byte_a, dest_byte_b, dest_byte_c, dest_byte_d;
501
502 qtest_quit(from);
503
504 if (test_dest) {
505 qtest_memread(to, start_address, &dest_byte_a, 1);
506
507 /* Destination still running, wait for a byte to change */
508 do {
509 qtest_memread(to, start_address, &dest_byte_b, 1);
510 usleep(1000 * 10);
511 } while (dest_byte_a == dest_byte_b);
512
513 qtest_qmp_discard_response(to, "{ 'execute' : 'stop'}");
514
515 /* With it stopped, check nothing changes */
516 qtest_memread(to, start_address, &dest_byte_c, 1);
517 usleep(1000 * 200);
518 qtest_memread(to, start_address, &dest_byte_d, 1);
519 g_assert_cmpint(dest_byte_c, ==, dest_byte_d);
520
521 check_guests_ram(to);
522 }
523
524 qtest_quit(to);
525
526 cleanup("bootsect");
527 cleanup("migsocket");
528 cleanup("src_serial");
529 cleanup("dest_serial");
530 }
531
532 static void deprecated_set_downtime(QTestState *who, const double value)
533 {
534 QDict *rsp;
535 char *expected;
536 int64_t result_int;
537
538 rsp = qtest_qmp(who,
539 "{ 'execute': 'migrate_set_downtime',"
540 " 'arguments': { 'value': %f } }", value);
541 g_assert(qdict_haskey(rsp, "return"));
542 qobject_unref(rsp);
543 result_int = value * 1000L;
544 expected = g_strdup_printf("%" PRId64, result_int);
545 migrate_check_parameter(who, "downtime-limit", expected);
546 g_free(expected);
547 }
548
549 static void deprecated_set_speed(QTestState *who, const char *value)
550 {
551 QDict *rsp;
552 gchar *cmd;
553
554 cmd = g_strdup_printf("{ 'execute': 'migrate_set_speed',"
555 "'arguments': { 'value': %s } }", value);
556 rsp = qtest_qmp(who, cmd);
557 g_free(cmd);
558 g_assert(qdict_haskey(rsp, "return"));
559 qobject_unref(rsp);
560 migrate_check_parameter(who, "max-bandwidth", value);
561 }
562
563 static void test_deprecated(void)
564 {
565 QTestState *from;
566
567 from = qtest_start("");
568
569 deprecated_set_downtime(from, 0.12345);
570 deprecated_set_speed(from, "12345");
571
572 qtest_quit(from);
573 }
574
575 static int migrate_postcopy_prepare(QTestState **from_ptr,
576 QTestState **to_ptr,
577 bool hide_error)
578 {
579 char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
580 QTestState *from, *to;
581
582 if (test_migrate_start(&from, &to, uri, hide_error)) {
583 return -1;
584 }
585
586 migrate_set_capability(from, "postcopy-ram", "true");
587 migrate_set_capability(to, "postcopy-ram", "true");
588 migrate_set_capability(to, "postcopy-blocktime", "true");
589
590 /* We want to pick a speed slow enough that the test completes
591 * quickly, but that it doesn't complete precopy even on a slow
592 * machine, so also set the downtime.
593 */
594 migrate_set_parameter(from, "max-bandwidth", "100000000");
595 migrate_set_parameter(from, "downtime-limit", "1");
596
597 /* Wait for the first serial output from the source */
598 wait_for_serial("src_serial");
599
600 migrate(from, uri, NULL);
601 g_free(uri);
602
603 wait_for_migration_pass(from);
604
605 *from_ptr = from;
606 *to_ptr = to;
607
608 return 0;
609 }
610
611 static void migrate_postcopy_complete(QTestState *from, QTestState *to)
612 {
613 wait_for_migration_complete(from);
614
615 /* Make sure we get at least one "B" on destination */
616 wait_for_serial("dest_serial");
617
618 if (uffd_feature_thread_id) {
619 read_blocktime(to);
620 }
621
622 test_migrate_end(from, to, true);
623 }
624
625 static void test_postcopy(void)
626 {
627 QTestState *from, *to;
628
629 if (migrate_postcopy_prepare(&from, &to, false)) {
630 return;
631 }
632 migrate_postcopy_start(from, to);
633 migrate_postcopy_complete(from, to);
634 }
635
636 static void test_postcopy_recovery(void)
637 {
638 QTestState *from, *to;
639 char *uri;
640
641 if (migrate_postcopy_prepare(&from, &to, true)) {
642 return;
643 }
644
645 /* Turn postcopy speed down, 4K/s is slow enough on any machines */
646 migrate_set_parameter(from, "max-postcopy-bandwidth", "4096");
647
648 /* Now we start the postcopy */
649 migrate_postcopy_start(from, to);
650
651 /*
652 * Wait until postcopy is really started; we can only run the
653 * migrate-pause command during a postcopy
654 */
655 wait_for_migration_status(from, "postcopy-active");
656
657 /*
658 * Manually stop the postcopy migration. This emulates a network
659 * failure with the migration socket
660 */
661 migrate_pause(from);
662
663 /*
664 * Wait for destination side to reach postcopy-paused state. The
665 * migrate-recover command can only succeed if destination machine
666 * is in the paused state
667 */
668 wait_for_migration_status(to, "postcopy-paused");
669
670 /*
671 * Create a new socket to emulate a new channel that is different
672 * from the broken migration channel; tell the destination to
673 * listen to the new port
674 */
675 uri = g_strdup_printf("unix:%s/migsocket-recover", tmpfs);
676 migrate_recover(to, uri);
677
678 /*
679 * Try to rebuild the migration channel using the resume flag and
680 * the newly created channel
681 */
682 wait_for_migration_status(from, "postcopy-paused");
683 migrate(from, uri, ", 'resume': true");
684 g_free(uri);
685
686 /* Restore the postcopy bandwidth to unlimited */
687 migrate_set_parameter(from, "max-postcopy-bandwidth", "0");
688
689 migrate_postcopy_complete(from, to);
690 }
691
692 static void test_baddest(void)
693 {
694 QTestState *from, *to;
695 QDict *rsp, *rsp_return;
696 char *status;
697 bool failed;
698
699 if (test_migrate_start(&from, &to, "tcp:0:0", true)) {
700 return;
701 }
702 migrate(from, "tcp:0:0", NULL);
703 do {
704 status = migrate_query_status(from);
705 g_assert(!strcmp(status, "setup") || !(strcmp(status, "failed")));
706 failed = !strcmp(status, "failed");
707 g_free(status);
708 } while (!failed);
709
710 /* Is the machine currently running? */
711 rsp = wait_command(from, "{ 'execute': 'query-status' }");
712 g_assert(qdict_haskey(rsp, "return"));
713 rsp_return = qdict_get_qdict(rsp, "return");
714 g_assert(qdict_haskey(rsp_return, "running"));
715 g_assert(qdict_get_bool(rsp_return, "running"));
716 qobject_unref(rsp);
717
718 test_migrate_end(from, to, false);
719 }
720
721 static void test_precopy_unix(void)
722 {
723 char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs);
724 QTestState *from, *to;
725
726 if (test_migrate_start(&from, &to, uri, false)) {
727 return;
728 }
729
730 /* We want to pick a speed slow enough that the test completes
731 * quickly, but that it doesn't complete precopy even on a slow
732 * machine, so also set the downtime.
733 */
734 /* 1 ms should make it not converge*/
735 migrate_set_parameter(from, "downtime-limit", "1");
736 /* 1GB/s */
737 migrate_set_parameter(from, "max-bandwidth", "1000000000");
738
739 /* Wait for the first serial output from the source */
740 wait_for_serial("src_serial");
741
742 migrate(from, uri, NULL);
743
744 wait_for_migration_pass(from);
745
746 /* 300 ms should converge */
747 migrate_set_parameter(from, "downtime-limit", "300");
748
749 if (!got_stop) {
750 qtest_qmp_eventwait(from, "STOP");
751 }
752
753 qtest_qmp_eventwait(to, "RESUME");
754
755 wait_for_serial("dest_serial");
756 wait_for_migration_complete(from);
757
758 test_migrate_end(from, to, true);
759 g_free(uri);
760 }
761
762 int main(int argc, char **argv)
763 {
764 char template[] = "/tmp/migration-test-XXXXXX";
765 int ret;
766
767 g_test_init(&argc, &argv, NULL);
768
769 if (!ufd_version_check()) {
770 return 0;
771 }
772
773 tmpfs = mkdtemp(template);
774 if (!tmpfs) {
775 g_test_message("mkdtemp on path (%s): %s\n", template, strerror(errno));
776 }
777 g_assert(tmpfs);
778
779 module_call_init(MODULE_INIT_QOM);
780
781 qtest_add_func("/migration/postcopy/unix", test_postcopy);
782 qtest_add_func("/migration/postcopy/recovery", test_postcopy_recovery);
783 qtest_add_func("/migration/deprecated", test_deprecated);
784 qtest_add_func("/migration/bad_dest", test_baddest);
785 qtest_add_func("/migration/precopy/unix", test_precopy_unix);
786
787 ret = g_test_run();
788
789 g_assert_cmpint(ret, ==, 0);
790
791 ret = rmdir(tmpfs);
792 if (ret != 0) {
793 g_test_message("unable to rmdir: path (%s): %s\n",
794 tmpfs, strerror(errno));
795 }
796
797 return ret;
798 }