1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Machine independent migration tests
4  *
5  * This is just a very simple test that is intended to stress the migration
6  * support in the test harness. This could be expanded to test more guest
7  * library code, but architecture-specific tests should be used to test
8  * migration of tricky machine state.
9  */
10 #include <libcflat.h>
11 #include <migrate.h>
12 #include <asm/time.h>
13 
14 #define NR_MIGRATIONS 5
15 
main(int argc,char ** argv)16 int main(int argc, char **argv)
17 {
18 	report_prefix_push("migration harness");
19 
20 	if (argc > 1 && !strcmp(argv[1], "skip")) {
21 		migrate_skip();
22 		report(true, "migration skipping");
23 	} else {
24 		int i;
25 
26 		for (i = 0; i < NR_MIGRATIONS; i++)
27 			migrate_quiet();
28 		report(true, "cooperative migration");
29 
30 		migrate_begin_continuous();
31 		mdelay(1000);
32 		migrate_end_continuous();
33 		mdelay(500);
34 		migrate_begin_continuous();
35 		mdelay(1000);
36 		migrate_end_continuous();
37 		report(true, "continuous migration");
38 	}
39 
40 	report_prefix_pop();
41 
42 	return report_summary();
43 }
44