qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

tests: use static qga config file

Do not create a leaking temporary file, but use a static file instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>

authored by

Marc-André Lureau and committed by
Michael Roth
1741b945 fe31017f

+12 -23
+8
tests/data/test-qga-config
··· 1 + [general] 2 + daemon=false 3 + method=virtio-serial 4 + path=/path/to/org.qemu.guest_agent.0 5 + pidfile=/var/foo/qemu-ga.pid 6 + statedir=/var/state 7 + verbose=true 8 + blacklist=guest-ping;guest-get-time
+4 -23
tests/test-qga.c
··· 691 691 static void test_qga_config(gconstpointer data) 692 692 { 693 693 GError *error = NULL; 694 - char *cwd, *cmd, *out, *err, *str, **strv, *conf, **argv = NULL; 694 + char *cwd, *cmd, *out, *err, *str, **strv, **argv = NULL; 695 695 char *env[2]; 696 - int status, tmp; 696 + int status; 697 697 gsize n; 698 698 GKeyFile *kf; 699 - const char *qga_config = 700 - "[general]\n" 701 - "daemon=false\n" 702 - "method=virtio-serial\n" 703 - "path=/path/to/org.qemu.guest_agent.0\n" 704 - "pidfile=/var/foo/qemu-ga.pid\n" 705 - "statedir=/var/state\n" 706 - "verbose=true\n" 707 - "blacklist=guest-ping;guest-get-time\n"; 708 - 709 - tmp = g_file_open_tmp(NULL, &conf, &error); 710 - g_assert_no_error(error); 711 - g_assert_cmpint(tmp, >=, 0); 712 - g_assert_cmpstr(conf, !=, ""); 713 - 714 - g_file_set_contents(conf, qga_config, -1, &error); 715 - g_assert_no_error(error); 716 699 717 700 cwd = g_get_current_dir(); 718 701 cmd = g_strdup_printf("%s%cqemu-ga -D", ··· 720 703 g_shell_parse_argv(cmd, NULL, &argv, &error); 721 704 g_assert_no_error(error); 722 705 723 - env[0] = g_strdup_printf("QGA_CONF=%s", conf); 706 + env[0] = g_strdup_printf("QGA_CONF=tests%cdata%ctest-qga-config", 707 + G_DIR_SEPARATOR, G_DIR_SEPARATOR); 724 708 env[1] = NULL; 725 709 g_spawn_sync(NULL, argv, env, 0, 726 710 NULL, NULL, &out, &err, &status, &error); ··· 775 759 776 760 g_free(out); 777 761 g_free(err); 778 - g_free(conf); 779 762 g_free(env[0]); 780 763 g_key_file_free(kf); 781 - 782 - close(tmp); 783 764 } 784 765 785 766 static void test_qga_fsfreeze_status(gconstpointer fix)