3 #include <glib/gstdio.h>
9 #include <sys/socket.h>
15 #include "config-host.h"
24 static int connect_qga(char *path)
26 int s, ret, len, i = 0;
27 struct sockaddr_un remote;
29 s = socket(AF_UNIX, SOCK_STREAM, 0);
32 remote.sun_family = AF_UNIX;
34 strcpy(remote.sun_path, path);
35 len = strlen(remote.sun_path) + sizeof(remote.sun_family);
36 ret = connect(s, (struct sockaddr *)&remote, len);
38 g_usleep(G_USEC_PER_SEC);
48 static void qga_watch(GPid pid, gint status, gpointer user_data)
50 TestFixture *fixture = user_data;
52 g_assert_cmpint(status, ==, 0);
53 g_main_loop_quit(fixture->loop);
57 fixture_setup(TestFixture *fixture, gconstpointer data)
59 const gchar *extra_arg = data;
61 gchar *cwd, *path, *cmd, **argv = NULL;
63 fixture->loop = g_main_loop_new(NULL, FALSE);
65 fixture->test_dir = g_strdup("/tmp/qgatest.XXXXXX");
66 g_assert_nonnull(mkdtemp(fixture->test_dir));
68 path = g_build_filename(fixture->test_dir, "sock", NULL);
69 cwd = g_get_current_dir();
70 cmd = g_strdup_printf("%s%cqemu-ga -m unix-listen -t %s -p %s %s %s",
72 fixture->test_dir, path,
73 getenv("QTEST_LOG") ? "-v" : "",
75 g_shell_parse_argv(cmd, NULL, &argv, &error);
76 g_assert_no_error(error);
78 g_spawn_async(fixture->test_dir, argv, NULL,
79 G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD,
80 NULL, NULL, &fixture->pid, &error);
81 g_assert_no_error(error);
83 g_child_watch_add(fixture->pid, qga_watch, fixture);
85 fixture->fd = connect_qga(path);
86 g_assert_cmpint(fixture->fd, !=, -1);
95 fixture_tear_down(TestFixture *fixture, gconstpointer data)
99 kill(fixture->pid, SIGTERM);
101 g_main_loop_run(fixture->loop);
102 g_main_loop_unref(fixture->loop);
104 g_spawn_close_pid(fixture->pid);
106 tmp = g_build_filename(fixture->test_dir, "foo", NULL);
110 tmp = g_build_filename(fixture->test_dir, "qga.state", NULL);
114 tmp = g_build_filename(fixture->test_dir, "sock", NULL);
118 g_rmdir(fixture->test_dir);
119 g_free(fixture->test_dir);
122 static void qmp_assertion_message_error(const char *domain,
129 const char *class, *desc;
133 error = qdict_get_qdict(dict, "error");
134 class = qdict_get_try_str(error, "class");
135 desc = qdict_get_try_str(error, "desc");
137 s = g_strdup_printf("assertion failed %s: %s %s", expr, class, desc);
138 g_assertion_message(domain, file, line, func, s);
142 #define qmp_assert_no_error(err) do { \
143 if (qdict_haskey(err, "error")) { \
144 qmp_assertion_message_error(G_LOG_DOMAIN, __FILE__, __LINE__, \
145 G_STRFUNC, #err, err); \
149 static void test_qga_sync_delimited(gconstpointer fix)
151 const TestFixture *fixture = fix;
152 guint32 v, r = g_random_int();
157 cmd = g_strdup_printf("%c{'execute': 'guest-sync-delimited',"
158 " 'arguments': {'id': %u } }", 0xff, r);
159 qmp_fd_send(fixture->fd, cmd);
162 v = read(fixture->fd, &c, 1);
163 g_assert_cmpint(v, ==, 1);
164 g_assert_cmpint(c, ==, 0xff);
166 ret = qmp_fd_receive(fixture->fd);
167 g_assert_nonnull(ret);
168 qmp_assert_no_error(ret);
170 v = qdict_get_int(ret, "return");
171 g_assert_cmpint(r, ==, v);
176 static void test_qga_sync(gconstpointer fix)
178 const TestFixture *fixture = fix;
179 guint32 v, r = g_random_int();
183 cmd = g_strdup_printf("%c{'execute': 'guest-sync',"
184 " 'arguments': {'id': %u } }", 0xff, r);
185 ret = qmp_fd(fixture->fd, cmd);
188 g_assert_nonnull(ret);
189 qmp_assert_no_error(ret);
191 v = qdict_get_int(ret, "return");
192 g_assert_cmpint(r, ==, v);
197 static void test_qga_ping(gconstpointer fix)
199 const TestFixture *fixture = fix;
202 ret = qmp_fd(fixture->fd, "{'execute': 'guest-ping'}");
203 g_assert_nonnull(ret);
204 qmp_assert_no_error(ret);
209 static void test_qga_invalid_cmd(gconstpointer fix)
211 const TestFixture *fixture = fix;
213 const gchar *class, *desc;
215 ret = qmp_fd(fixture->fd, "{'execute': 'guest-invalid-cmd'}");
216 g_assert_nonnull(ret);
218 error = qdict_get_qdict(ret, "error");
219 class = qdict_get_try_str(error, "class");
220 desc = qdict_get_try_str(error, "desc");
222 g_assert_cmpstr(class, ==, "CommandNotFound");
223 g_assert_cmpint(strlen(desc), >, 0);
228 static void test_qga_info(gconstpointer fix)
230 const TestFixture *fixture = fix;
232 const gchar *version;
234 ret = qmp_fd(fixture->fd, "{'execute': 'guest-info'}");
235 g_assert_nonnull(ret);
236 qmp_assert_no_error(ret);
238 val = qdict_get_qdict(ret, "return");
239 version = qdict_get_try_str(val, "version");
240 g_assert_cmpstr(version, ==, QEMU_VERSION);
245 static void test_qga_get_vcpus(gconstpointer fix)
247 const TestFixture *fixture = fix;
250 const QListEntry *entry;
252 ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-vcpus'}");
253 g_assert_nonnull(ret);
254 qmp_assert_no_error(ret);
256 /* check there is at least a cpu */
257 list = qdict_get_qlist(ret, "return");
258 entry = qlist_first(list);
259 g_assert(qdict_haskey(qobject_to_qdict(entry->value), "online"));
260 g_assert(qdict_haskey(qobject_to_qdict(entry->value), "logical-id"));
265 static void test_qga_get_fsinfo(gconstpointer fix)
267 const TestFixture *fixture = fix;
270 const QListEntry *entry;
272 ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-fsinfo'}");
273 g_assert_nonnull(ret);
274 qmp_assert_no_error(ret);
276 /* sanity-check the response if there are any filesystems */
277 list = qdict_get_qlist(ret, "return");
278 entry = qlist_first(list);
280 g_assert(qdict_haskey(qobject_to_qdict(entry->value), "name"));
281 g_assert(qdict_haskey(qobject_to_qdict(entry->value), "mountpoint"));
282 g_assert(qdict_haskey(qobject_to_qdict(entry->value), "type"));
283 g_assert(qdict_haskey(qobject_to_qdict(entry->value), "disk"));
289 static void test_qga_get_memory_block_info(gconstpointer fix)
291 const TestFixture *fixture = fix;
295 ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-memory-block-info'}");
296 g_assert_nonnull(ret);
298 /* some systems might not expose memory block info in sysfs */
299 if (!qdict_haskey(ret, "error")) {
300 /* check there is at least some memory */
301 val = qdict_get_qdict(ret, "return");
302 size = qdict_get_int(val, "size");
303 g_assert_cmpint(size, >, 0);
309 static void test_qga_get_memory_blocks(gconstpointer fix)
311 const TestFixture *fixture = fix;
314 const QListEntry *entry;
316 ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-memory-blocks'}");
317 g_assert_nonnull(ret);
319 /* some systems might not expose memory block info in sysfs */
320 if (!qdict_haskey(ret, "error")) {
321 list = qdict_get_qlist(ret, "return");
322 entry = qlist_first(list);
323 /* newer versions of qga may return empty list without error */
325 g_assert(qdict_haskey(qobject_to_qdict(entry->value), "phys-index"));
326 g_assert(qdict_haskey(qobject_to_qdict(entry->value), "online"));
333 static void test_qga_network_get_interfaces(gconstpointer fix)
335 const TestFixture *fixture = fix;
338 const QListEntry *entry;
340 ret = qmp_fd(fixture->fd, "{'execute': 'guest-network-get-interfaces'}");
341 g_assert_nonnull(ret);
342 qmp_assert_no_error(ret);
344 /* check there is at least an interface */
345 list = qdict_get_qlist(ret, "return");
346 entry = qlist_first(list);
347 g_assert(qdict_haskey(qobject_to_qdict(entry->value), "name"));
352 static void test_qga_file_ops(gconstpointer fix)
354 const TestFixture *fixture = fix;
355 const unsigned char helloworld[] = "Hello World!\n";
357 gchar *cmd, *path, *enc;
366 ret = qmp_fd(fixture->fd, "{'execute': 'guest-file-open',"
367 " 'arguments': { 'path': 'foo', 'mode': 'w+' } }");
368 g_assert_nonnull(ret);
369 qmp_assert_no_error(ret);
370 id = qdict_get_int(ret, "return");
373 enc = g_base64_encode(helloworld, sizeof(helloworld));
375 cmd = g_strdup_printf("{'execute': 'guest-file-write',"
376 " 'arguments': { 'handle': %" PRId64 ","
377 " 'buf-b64': '%s' } }", id, enc);
378 ret = qmp_fd(fixture->fd, cmd);
379 g_assert_nonnull(ret);
380 qmp_assert_no_error(ret);
382 val = qdict_get_qdict(ret, "return");
383 count = qdict_get_int(val, "count");
384 eof = qdict_get_bool(val, "eof");
385 g_assert_cmpint(count, ==, sizeof(helloworld));
386 g_assert_cmpint(eof, ==, 0);
391 cmd = g_strdup_printf("{'execute': 'guest-file-flush',"
392 " 'arguments': {'handle': %" PRId64 "} }",
394 ret = qmp_fd(fixture->fd, cmd);
399 cmd = g_strdup_printf("{'execute': 'guest-file-close',"
400 " 'arguments': {'handle': %" PRId64 "} }",
402 ret = qmp_fd(fixture->fd, cmd);
407 path = g_build_filename(fixture->test_dir, "foo", NULL);
408 f = fopen(path, "r");
410 count = fread(tmp, 1, sizeof(tmp), f);
411 g_assert_cmpint(count, ==, sizeof(helloworld));
413 g_assert_cmpstr(tmp, ==, (char *)helloworld);
417 ret = qmp_fd(fixture->fd, "{'execute': 'guest-file-open',"
418 " 'arguments': { 'path': 'foo', 'mode': 'r' } }");
419 g_assert_nonnull(ret);
420 qmp_assert_no_error(ret);
421 id = qdict_get_int(ret, "return");
425 cmd = g_strdup_printf("{'execute': 'guest-file-read',"
426 " 'arguments': { 'handle': %" PRId64 "} }",
428 ret = qmp_fd(fixture->fd, cmd);
429 val = qdict_get_qdict(ret, "return");
430 count = qdict_get_int(val, "count");
431 eof = qdict_get_bool(val, "eof");
432 b64 = qdict_get_str(val, "buf-b64");
433 g_assert_cmpint(count, ==, sizeof(helloworld));
435 g_assert_cmpstr(b64, ==, enc);
442 cmd = g_strdup_printf("{'execute': 'guest-file-read',"
443 " 'arguments': { 'handle': %" PRId64 "} }",
445 ret = qmp_fd(fixture->fd, cmd);
446 val = qdict_get_qdict(ret, "return");
447 count = qdict_get_int(val, "count");
448 eof = qdict_get_bool(val, "eof");
449 b64 = qdict_get_str(val, "buf-b64");
450 g_assert_cmpint(count, ==, 0);
452 g_assert_cmpstr(b64, ==, "");
457 cmd = g_strdup_printf("{'execute': 'guest-file-seek',"
458 " 'arguments': { 'handle': %" PRId64 ", "
459 " 'offset': %d, 'whence': %d } }",
461 ret = qmp_fd(fixture->fd, cmd);
462 qmp_assert_no_error(ret);
463 val = qdict_get_qdict(ret, "return");
464 count = qdict_get_int(val, "position");
465 eof = qdict_get_bool(val, "eof");
466 g_assert_cmpint(count, ==, 6);
472 cmd = g_strdup_printf("{'execute': 'guest-file-read',"
473 " 'arguments': { 'handle': %" PRId64 "} }",
475 ret = qmp_fd(fixture->fd, cmd);
476 val = qdict_get_qdict(ret, "return");
477 count = qdict_get_int(val, "count");
478 eof = qdict_get_bool(val, "eof");
479 b64 = qdict_get_str(val, "buf-b64");
480 g_assert_cmpint(count, ==, sizeof(helloworld) - 6);
482 dec = g_base64_decode(b64, &count);
483 g_assert_cmpint(count, ==, sizeof(helloworld) - 6);
484 g_assert_cmpmem(dec, count, helloworld + 6, sizeof(helloworld) - 6);
491 cmd = g_strdup_printf("{'execute': 'guest-file-close',"
492 " 'arguments': {'handle': %" PRId64 "} }",
494 ret = qmp_fd(fixture->fd, cmd);
499 static void test_qga_file_write_read(gconstpointer fix)
501 const TestFixture *fixture = fix;
502 const unsigned char helloworld[] = "Hello World!\n";
510 ret = qmp_fd(fixture->fd, "{'execute': 'guest-file-open',"
511 " 'arguments': { 'path': 'foo', 'mode': 'w+' } }");
512 g_assert_nonnull(ret);
513 qmp_assert_no_error(ret);
514 id = qdict_get_int(ret, "return");
517 enc = g_base64_encode(helloworld, sizeof(helloworld));
519 cmd = g_strdup_printf("{'execute': 'guest-file-write',"
520 " 'arguments': { 'handle': %" PRId64 ","
521 " 'buf-b64': '%s' } }", id, enc);
522 ret = qmp_fd(fixture->fd, cmd);
523 g_assert_nonnull(ret);
524 qmp_assert_no_error(ret);
526 val = qdict_get_qdict(ret, "return");
527 count = qdict_get_int(val, "count");
528 eof = qdict_get_bool(val, "eof");
529 g_assert_cmpint(count, ==, sizeof(helloworld));
530 g_assert_cmpint(eof, ==, 0);
534 /* read (check implicit flush) */
535 cmd = g_strdup_printf("{'execute': 'guest-file-read',"
536 " 'arguments': { 'handle': %" PRId64 "} }",
538 ret = qmp_fd(fixture->fd, cmd);
539 val = qdict_get_qdict(ret, "return");
540 count = qdict_get_int(val, "count");
541 eof = qdict_get_bool(val, "eof");
542 b64 = qdict_get_str(val, "buf-b64");
543 g_assert_cmpint(count, ==, 0);
545 g_assert_cmpstr(b64, ==, "");
550 cmd = g_strdup_printf("{'execute': 'guest-file-seek',"
551 " 'arguments': { 'handle': %" PRId64 ", "
552 " 'offset': %d, 'whence': %d } }",
554 ret = qmp_fd(fixture->fd, cmd);
555 qmp_assert_no_error(ret);
556 val = qdict_get_qdict(ret, "return");
557 count = qdict_get_int(val, "position");
558 eof = qdict_get_bool(val, "eof");
559 g_assert_cmpint(count, ==, 0);
565 cmd = g_strdup_printf("{'execute': 'guest-file-read',"
566 " 'arguments': { 'handle': %" PRId64 "} }",
568 ret = qmp_fd(fixture->fd, cmd);
569 val = qdict_get_qdict(ret, "return");
570 count = qdict_get_int(val, "count");
571 eof = qdict_get_bool(val, "eof");
572 b64 = qdict_get_str(val, "buf-b64");
573 g_assert_cmpint(count, ==, sizeof(helloworld));
575 g_assert_cmpstr(b64, ==, enc);
581 cmd = g_strdup_printf("{'execute': 'guest-file-close',"
582 " 'arguments': {'handle': %" PRId64 "} }",
584 ret = qmp_fd(fixture->fd, cmd);
589 static void test_qga_get_time(gconstpointer fix)
591 const TestFixture *fixture = fix;
595 ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-time'}");
596 g_assert_nonnull(ret);
597 qmp_assert_no_error(ret);
599 time = qdict_get_int(ret, "return");
600 g_assert_cmpint(time, >, 0);
605 static void test_qga_set_time(gconstpointer fix)
607 const TestFixture *fixture = fix;
609 int64_t current, time;
612 /* get current time */
613 ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-time'}");
614 g_assert_nonnull(ret);
615 qmp_assert_no_error(ret);
616 current = qdict_get_int(ret, "return");
617 g_assert_cmpint(current, >, 0);
620 /* set some old time */
621 ret = qmp_fd(fixture->fd, "{'execute': 'guest-set-time',"
622 " 'arguments': { 'time': 1000 } }");
623 g_assert_nonnull(ret);
624 qmp_assert_no_error(ret);
628 ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-time'}");
629 g_assert_nonnull(ret);
630 qmp_assert_no_error(ret);
631 time = qdict_get_int(ret, "return");
632 g_assert_cmpint(time / 1000, <, G_USEC_PER_SEC * 10);
635 /* set back current time */
636 cmd = g_strdup_printf("{'execute': 'guest-set-time',"
637 " 'arguments': { 'time': %" PRId64 " } }",
638 current + time * 1000);
639 ret = qmp_fd(fixture->fd, cmd);
641 g_assert_nonnull(ret);
642 qmp_assert_no_error(ret);
646 static void test_qga_fstrim(gconstpointer fix)
648 const TestFixture *fixture = fix;
651 const QListEntry *entry;
653 ret = qmp_fd(fixture->fd, "{'execute': 'guest-fstrim',"
654 " arguments: { minimum: 4194304 } }");
655 g_assert_nonnull(ret);
656 qmp_assert_no_error(ret);
657 list = qdict_get_qlist(ret, "return");
658 entry = qlist_first(list);
659 g_assert(qdict_haskey(qobject_to_qdict(entry->value), "paths"));
664 static void test_qga_blacklist(gconstpointer data)
668 const gchar *class, *desc;
670 fixture_setup(&fix, "-b guest-ping,guest-get-time");
672 /* check blacklist */
673 ret = qmp_fd(fix.fd, "{'execute': 'guest-ping'}");
674 g_assert_nonnull(ret);
675 error = qdict_get_qdict(ret, "error");
676 class = qdict_get_try_str(error, "class");
677 desc = qdict_get_try_str(error, "desc");
678 g_assert_cmpstr(class, ==, "GenericError");
679 g_assert_nonnull(g_strstr_len(desc, -1, "has been disabled"));
682 ret = qmp_fd(fix.fd, "{'execute': 'guest-get-time'}");
683 g_assert_nonnull(ret);
684 error = qdict_get_qdict(ret, "error");
685 class = qdict_get_try_str(error, "class");
686 desc = qdict_get_try_str(error, "desc");
687 g_assert_cmpstr(class, ==, "GenericError");
688 g_assert_nonnull(g_strstr_len(desc, -1, "has been disabled"));
691 /* check something work */
692 ret = qmp_fd(fix.fd, "{'execute': 'guest-get-fsinfo'}");
693 qmp_assert_no_error(ret);
696 fixture_tear_down(&fix, NULL);
699 static void test_qga_config(gconstpointer data)
701 GError *error = NULL;
702 char *cwd, *cmd, *out, *err, *str, **strv, *conf, **argv = NULL;
707 const char *qga_config =
710 "method=virtio-serial\n"
711 "path=/path/to/org.qemu.guest_agent.0\n"
712 "pidfile=/var/foo/qemu-ga.pid\n"
713 "statedir=/var/state\n"
715 "blacklist=guest-ping;guest-get-time\n";
717 tmp = g_file_open_tmp(NULL, &conf, &error);
718 g_assert_no_error(error);
719 g_assert_cmpint(tmp, >=, 0);
720 g_assert_cmpstr(conf, !=, "");
722 g_file_set_contents(conf, qga_config, -1, &error);
723 g_assert_no_error(error);
725 cwd = g_get_current_dir();
726 cmd = g_strdup_printf("%s%cqemu-ga -D",
727 cwd, G_DIR_SEPARATOR);
728 g_shell_parse_argv(cmd, NULL, &argv, &error);
729 g_assert_no_error(error);
731 env[0] = g_strdup_printf("QGA_CONF=%s", conf);
733 g_spawn_sync(NULL, argv, env, 0,
734 NULL, NULL, &out, &err, &status, &error);
735 g_assert_no_error(error);
736 g_assert_cmpstr(err, ==, "");
737 g_assert_cmpint(status, ==, 0);
739 kf = g_key_file_new();
740 g_key_file_load_from_data(kf, out, -1, G_KEY_FILE_NONE, &error);
741 g_assert_no_error(error);
743 str = g_key_file_get_start_group(kf);
744 g_assert_cmpstr(str, ==, "general");
747 g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error));
748 g_assert_no_error(error);
750 str = g_key_file_get_string(kf, "general", "method", &error);
751 g_assert_no_error(error);
752 g_assert_cmpstr(str, ==, "virtio-serial");
755 str = g_key_file_get_string(kf, "general", "path", &error);
756 g_assert_no_error(error);
757 g_assert_cmpstr(str, ==, "/path/to/org.qemu.guest_agent.0");
760 str = g_key_file_get_string(kf, "general", "pidfile", &error);
761 g_assert_no_error(error);
762 g_assert_cmpstr(str, ==, "/var/foo/qemu-ga.pid");
765 str = g_key_file_get_string(kf, "general", "statedir", &error);
766 g_assert_no_error(error);
767 g_assert_cmpstr(str, ==, "/var/state");
770 g_assert_true(g_key_file_get_boolean(kf, "general", "verbose", &error));
771 g_assert_no_error(error);
773 strv = g_key_file_get_string_list(kf, "general", "blacklist", &n, &error);
774 g_assert_cmpint(n, ==, 2);
775 #if GLIB_CHECK_VERSION(2, 44, 0)
776 g_assert_true(g_strv_contains((const char * const *)strv,
778 g_assert_true(g_strv_contains((const char * const *)strv,
781 g_assert_no_error(error);
793 static void test_qga_fsfreeze_status(gconstpointer fix)
795 const TestFixture *fixture = fix;
799 ret = qmp_fd(fixture->fd, "{'execute': 'guest-fsfreeze-status'}");
800 g_assert_nonnull(ret);
801 qmp_assert_no_error(ret);
803 status = qdict_get_try_str(ret, "return");
804 g_assert_cmpstr(status, ==, "thawed");
809 static void test_qga_fsfreeze_and_thaw(gconstpointer fix)
811 const TestFixture *fixture = fix;
815 ret = qmp_fd(fixture->fd, "{'execute': 'guest-fsfreeze-freeze'}");
816 g_assert_nonnull(ret);
817 qmp_assert_no_error(ret);
820 ret = qmp_fd(fixture->fd, "{'execute': 'guest-fsfreeze-status'}");
821 g_assert_nonnull(ret);
822 qmp_assert_no_error(ret);
823 status = qdict_get_try_str(ret, "return");
824 g_assert_cmpstr(status, ==, "frozen");
827 ret = qmp_fd(fixture->fd, "{'execute': 'guest-fsfreeze-thaw'}");
828 g_assert_nonnull(ret);
829 qmp_assert_no_error(ret);
833 int main(int argc, char **argv)
838 setlocale (LC_ALL, "");
839 g_test_init(&argc, &argv, NULL);
840 fixture_setup(&fix, NULL);
842 g_test_add_data_func("/qga/sync-delimited", &fix, test_qga_sync_delimited);
843 g_test_add_data_func("/qga/sync", &fix, test_qga_sync);
844 g_test_add_data_func("/qga/ping", &fix, test_qga_ping);
845 g_test_add_data_func("/qga/info", &fix, test_qga_info);
846 g_test_add_data_func("/qga/network-get-interfaces", &fix,
847 test_qga_network_get_interfaces);
848 g_test_add_data_func("/qga/get-vcpus", &fix, test_qga_get_vcpus);
849 g_test_add_data_func("/qga/get-fsinfo", &fix, test_qga_get_fsinfo);
850 g_test_add_data_func("/qga/get-memory-block-info", &fix,
851 test_qga_get_memory_block_info);
852 g_test_add_data_func("/qga/get-memory-blocks", &fix,
853 test_qga_get_memory_blocks);
854 g_test_add_data_func("/qga/file-ops", &fix, test_qga_file_ops);
855 g_test_add_data_func("/qga/file-write-read", &fix, test_qga_file_write_read);
856 g_test_add_data_func("/qga/get-time", &fix, test_qga_get_time);
857 g_test_add_data_func("/qga/invalid-cmd", &fix, test_qga_invalid_cmd);
858 g_test_add_data_func("/qga/fsfreeze-status", &fix,
859 test_qga_fsfreeze_status);
861 g_test_add_data_func("/qga/blacklist", NULL, test_qga_blacklist);
862 g_test_add_data_func("/qga/config", NULL, test_qga_config);
864 if (g_getenv("QGA_TEST_SIDE_EFFECTING")) {
865 g_test_add_data_func("/qga/fsfreeze-and-thaw", &fix,
866 test_qga_fsfreeze_and_thaw);
867 g_test_add_data_func("/qga/set-time", &fix, test_qga_set_time);
868 g_test_add_data_func("/qga/fstrim", &fix, test_qga_fstrim);
873 fixture_tear_down(&fix, NULL);