static void test_qga_config(gconstpointer data)

{

    GError *error = NULL;

    char *cwd, *cmd, *out, *err, *str, **strv, **argv = NULL;

    char *env[2];

    int status;

    gsize n;

    GKeyFile *kf;



    cwd = g_get_current_dir();

    cmd = g_strdup_printf("%s%cqemu-ga -D",

                          cwd, G_DIR_SEPARATOR);


    g_shell_parse_argv(cmd, NULL, &argv, &error);


    g_assert_no_error(error);



    env[0] = g_strdup_printf("QGA_CONF=tests%cdata%ctest-qga-config",

                             G_DIR_SEPARATOR, G_DIR_SEPARATOR);

    env[1] = NULL;

    g_spawn_sync(NULL, argv, env, 0,

                 NULL, NULL, &out, &err, &status, &error);

    g_strfreev(argv);



    g_assert_no_error(error);

    g_assert_cmpstr(err, ==, "");

    g_assert_cmpint(status, ==, 0);



    kf = g_key_file_new();

    g_key_file_load_from_data(kf, out, -1, G_KEY_FILE_NONE, &error);

    g_assert_no_error(error);



    str = g_key_file_get_start_group(kf);

    g_assert_cmpstr(str, ==, "general");

    g_free(str);



    g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error));

    g_assert_no_error(error);



    str = g_key_file_get_string(kf, "general", "method", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(str, ==, "virtio-serial");

    g_free(str);



    str = g_key_file_get_string(kf, "general", "path", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(str, ==, "/path/to/org.qemu.guest_agent.0");

    g_free(str);



    str = g_key_file_get_string(kf, "general", "pidfile", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(str, ==, "/var/foo/qemu-ga.pid");

    g_free(str);



    str = g_key_file_get_string(kf, "general", "statedir", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(str, ==, "/var/state");

    g_free(str);



    g_assert_true(g_key_file_get_boolean(kf, "general", "verbose", &error));

    g_assert_no_error(error);



    strv = g_key_file_get_string_list(kf, "general", "blacklist", &n, &error);

    g_assert_cmpint(n, ==, 2);

#if GLIB_CHECK_VERSION(2, 44, 0)

    g_assert_true(g_strv_contains((const char * const *)strv,

                                  "guest-ping"));

    g_assert_true(g_strv_contains((const char * const *)strv,

                                  "guest-get-time"));

#endif

    g_assert_no_error(error);

    g_strfreev(strv);



    g_free(out);

    g_free(err);

    g_free(env[0]);

    g_key_file_free(kf);

}
static void test_qga_config(gconstpointer data)

{

    GError *error = NULL;

    char *cwd, *cmd, *out, *err, *str, **strv, **argv = NULL;

    char *env[2];

    int status;

    gsize n;

    GKeyFile *kf;



    cwd = g_get_current_dir();

    cmd = g_strdup_printf("%s%cqemu-ga -D",

                          cwd, G_DIR_SEPARATOR);


    g_shell_parse_argv(cmd, NULL, &argv, &error);


    g_assert_no_error(error);



    env[0] = g_strdup_printf("QGA_CONF=tests%cdata%ctest-qga-config",

                             G_DIR_SEPARATOR, G_DIR_SEPARATOR);

    env[1] = NULL;

    g_spawn_sync(NULL, argv, env, 0,

                 NULL, NULL, &out, &err, &status, &error);

    g_strfreev(argv);



    g_assert_no_error(error);

    g_assert_cmpstr(err, ==, "");

    g_assert_cmpint(status, ==, 0);



    kf = g_key_file_new();

    g_key_file_load_from_data(kf, out, -1, G_KEY_FILE_NONE, &error);

    g_assert_no_error(error);



    str = g_key_file_get_start_group(kf);

    g_assert_cmpstr(str, ==, "general");

    g_free(str);



    g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error));

    g_assert_no_error(error);



    str = g_key_file_get_string(kf, "general", "method", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(str, ==, "virtio-serial");

    g_free(str);



    str = g_key_file_get_string(kf, "general", "path", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(str, ==, "/path/to/org.qemu.guest_agent.0");

    g_free(str);



    str = g_key_file_get_string(kf, "general", "pidfile", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(str, ==, "/var/foo/qemu-ga.pid");

    g_free(str);



    str = g_key_file_get_string(kf, "general", "statedir", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(str, ==, "/var/state");

    g_free(str);



    g_assert_true(g_key_file_get_boolean(kf, "general", "verbose", &error));

    g_assert_no_error(error);



    strv = g_key_file_get_string_list(kf, "general", "blacklist", &n, &error);

    g_assert_cmpint(n, ==, 2);

#if GLIB_CHECK_VERSION(2, 44, 0)

    g_assert_true(g_strv_contains((const char * const *)strv,

                                  "guest-ping"));

    g_assert_true(g_strv_contains((const char * const *)strv,

                                  "guest-get-time"));

#endif

    g_assert_no_error(error);

    g_strfreev(strv);



    g_free(out);

    g_free(err);

    g_free(env[0]);

    g_key_file_free(kf);

}
static void FUNC_0(gconstpointer VAR_0)

{

    GError *error = NULL;

    char *VAR_1, *VAR_2, *VAR_3, *VAR_4, *VAR_5, **VAR_6, **VAR_7 = NULL;

    char *VAR_8[2];

    int VAR_9;

    gsize n;

    GKeyFile *kf;



    VAR_1 = g_get_current_dir();

    VAR_2 = g_strdup_printf("%s%cqemu-ga -D",

                          VAR_1, G_DIR_SEPARATOR);


    g_shell_parse_argv(VAR_2, NULL, &VAR_7, &error);


    g_assert_no_error(error);



    VAR_8[0] = g_strdup_printf("QGA_CONF=tests%cdata%ctest-qga-config",

                             G_DIR_SEPARATOR, G_DIR_SEPARATOR);

    VAR_8[1] = NULL;

    g_spawn_sync(NULL, VAR_7, VAR_8, 0,

                 NULL, NULL, &VAR_3, &VAR_4, &VAR_9, &error);

    g_strfreev(VAR_7);



    g_assert_no_error(error);

    g_assert_cmpstr(VAR_4, ==, "");

    g_assert_cmpint(VAR_9, ==, 0);



    kf = g_key_file_new();

    g_key_file_load_from_data(kf, VAR_3, -1, G_KEY_FILE_NONE, &error);

    g_assert_no_error(error);



    VAR_5 = g_key_file_get_start_group(kf);

    g_assert_cmpstr(VAR_5, ==, "general");

    g_free(VAR_5);



    g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error));

    g_assert_no_error(error);



    VAR_5 = g_key_file_get_string(kf, "general", "method", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(VAR_5, ==, "virtio-serial");

    g_free(VAR_5);



    VAR_5 = g_key_file_get_string(kf, "general", "path", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(VAR_5, ==, "/path/to/org.qemu.guest_agent.0");

    g_free(VAR_5);



    VAR_5 = g_key_file_get_string(kf, "general", "pidfile", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(VAR_5, ==, "/var/foo/qemu-ga.pid");

    g_free(VAR_5);



    VAR_5 = g_key_file_get_string(kf, "general", "statedir", &error);

    g_assert_no_error(error);

    g_assert_cmpstr(VAR_5, ==, "/var/state");

    g_free(VAR_5);



    g_assert_true(g_key_file_get_boolean(kf, "general", "verbose", &error));

    g_assert_no_error(error);



    VAR_6 = g_key_file_get_string_list(kf, "general", "blacklist", &n, &error);

    g_assert_cmpint(n, ==, 2);

#if GLIB_CHECK_VERSION(2, 44, 0)

    g_assert_true(g_strv_contains((const char * const *)VAR_6,

                                  "guest-ping"));

    g_assert_true(g_strv_contains((const char * const *)VAR_6,

                                  "guest-get-time"));

#endif

    g_assert_no_error(error);

    g_strfreev(VAR_6);



    g_free(VAR_3);

    g_free(VAR_4);

    g_free(VAR_8[0]);

    g_key_file_free(kf);

}
static void FUNC_0(gconstpointer VAR_0)
{ GError *error = NULL; char *VAR_1, *VAR_2, *VAR_3, *VAR_4, *VAR_5, **VAR_6, **VAR_7 = NULL; char *VAR_8[2]; int VAR_9; gsize n; GKeyFile *kf; VAR_1 = g_get_current_dir(); VAR_2 = g_strdup_printf("%s%cqemu-ga -D",
VAR_1, G_DIR_SEPARATOR); g_shell_parse_argv(VAR_2, NULL, &VAR_7, &error); g_assert_no_error(error); VAR_8[0] = g_strdup_printf("QGA_CONF=tests%cdata%ctest-qga-config",
G_DIR_SEPARATOR, G_DIR_SEPARATOR); VAR_8[1] = NULL; g_spawn_sync(NULL, VAR_7, VAR_8, 0,
NULL, NULL, &VAR_3, &VAR_4, &VAR_9, &error); g_strfreev(VAR_7); g_assert_no_error(error); g_assert_cmpstr(VAR_4, ==, ""); g_assert_cmpint(VAR_9, ==, 0); kf = g_key_file_new(); g_key_file_load_from_data(kf, VAR_3, -1, G_KEY_FILE_NONE, &error); g_assert_no_error(error); VAR_5 = g_key_file_get_start_group(kf); g_assert_cmpstr(VAR_5, ==, "general"); g_free(VAR_5); g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error)); g_assert_no_error(error); VAR_5 = g_key_file_get_string(kf, "general", "method", &error); g_assert_no_error(error); g_assert_cmpstr(VAR_5, ==, "virtio-serial"); g_free(VAR_5); VAR_5 = g_key_file_get_string(kf, "general", "path", &error); g_assert_no_error(error); g_assert_cmpstr(VAR_5, ==, "/path/to/org.qemu.guest_agent.0"); g_free(VAR_5); VAR_5 = g_key_file_get_string(kf, "general", "pidfile", &error); g_assert_no_error(error); g_assert_cmpstr(VAR_5, ==, "/var/foo/qemu-ga.pid"); g_free(VAR_5); VAR_5 = g_key_file_get_string(kf, "general", "statedir", &error); g_assert_no_error(error); g_assert_cmpstr(VAR_5, ==, "/var/state"); g_free(VAR_5); g_assert_true(g_key_file_get_boolean(kf, "general", "verbose", &error)); g_assert_no_error(error); VAR_6 = g_key_file_get_string_list(kf, "general", "blacklist", &n, &error); g_assert_cmpint(n, ==, 2); #if GLIB_CHECK_VERSION(2, 44, 0)
g_assert_true(g_strv_contains((const char * const *)VAR_6,
"guest-ping")); g_assert_true(g_strv_contains((const char * const *)VAR_6,
"guest-get-time")); #endif
g_assert_no_error(error); g_strfreev(VAR_6); g_free(VAR_3); g_free(VAR_4); g_free(VAR_8[0]); g_key_file_free(kf); }