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