aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/test-qga.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2022-05-25 16:41:35 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2022-05-28 11:42:56 +0200
commita85d09269bb1a7071d3ce0f2957e3ca9dba7c047 (patch)
treeebc4fe4c0ef64aea004395f5b81b7801f31103d9 /tests/unit/test-qga.c
parent561bfcb69dbd3ad055f9f7ff53f04213c09b51e3 (diff)
downloadqemu-a85d09269bb1a7071d3ce0f2957e3ca9dba7c047.zip
qemu-a85d09269bb1a7071d3ce0f2957e3ca9dba7c047.tar.gz
qemu-a85d09269bb1a7071d3ce0f2957e3ca9dba7c047.tar.bz2
test/qga: use G_TEST_DIR to locate os-release test file
This a more accurate way to lookup the test data, and will allow to move the test in a subproject. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com> Message-Id: <20220525144140.591926-11-marcandre.lureau@redhat.com>
Diffstat (limited to 'tests/unit/test-qga.c')
-rw-r--r--tests/unit/test-qga.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c
index d6df1ee..ab0b12a 100644
--- a/tests/unit/test-qga.c
+++ b/tests/unit/test-qga.c
@@ -914,15 +914,14 @@ static void test_qga_guest_get_osinfo(gconstpointer data)
{
TestFixture fixture;
const gchar *str;
- gchar *cwd, *env[2];
- QDict *ret, *val;
+ QDict *ret = NULL;
+ char *env[2];
+ QDict *val;
- cwd = g_get_current_dir();
env[0] = g_strdup_printf(
- "QGA_OS_RELEASE=%s%ctests%cdata%ctest-qga-os-release",
- cwd, G_DIR_SEPARATOR, G_DIR_SEPARATOR, G_DIR_SEPARATOR);
+ "QGA_OS_RELEASE=%s%c..%cdata%ctest-qga-os-release",
+ g_test_get_dir(G_TEST_DIST), G_DIR_SEPARATOR, G_DIR_SEPARATOR, G_DIR_SEPARATOR);
env[1] = NULL;
- g_free(cwd);
fixture_setup(&fixture, NULL, env);
ret = qmp_fd(fixture.fd, "{'execute': 'guest-get-osinfo'}");