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>
This commit is contained in:
parent
561bfcb69d
commit
a85d09269b
|
@ -914,15 +914,14 @@ static void test_qga_guest_get_osinfo(gconstpointer data)
|
||||||
{
|
{
|
||||||
TestFixture fixture;
|
TestFixture fixture;
|
||||||
const gchar *str;
|
const gchar *str;
|
||||||
gchar *cwd, *env[2];
|
QDict *ret = NULL;
|
||||||
QDict *ret, *val;
|
char *env[2];
|
||||||
|
QDict *val;
|
||||||
|
|
||||||
cwd = g_get_current_dir();
|
|
||||||
env[0] = g_strdup_printf(
|
env[0] = g_strdup_printf(
|
||||||
"QGA_OS_RELEASE=%s%ctests%cdata%ctest-qga-os-release",
|
"QGA_OS_RELEASE=%s%c..%cdata%ctest-qga-os-release",
|
||||||
cwd, G_DIR_SEPARATOR, G_DIR_SEPARATOR, G_DIR_SEPARATOR);
|
g_test_get_dir(G_TEST_DIST), G_DIR_SEPARATOR, G_DIR_SEPARATOR, G_DIR_SEPARATOR);
|
||||||
env[1] = NULL;
|
env[1] = NULL;
|
||||||
g_free(cwd);
|
|
||||||
fixture_setup(&fixture, NULL, env);
|
fixture_setup(&fixture, NULL, env);
|
||||||
|
|
||||||
ret = qmp_fd(fixture.fd, "{'execute': 'guest-get-osinfo'}");
|
ret = qmp_fd(fixture.fd, "{'execute': 'guest-get-osinfo'}");
|
||||||
|
|
Loading…
Reference in New Issue