[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 12/16] test/qga: use G_TEST_DIR to locate os-release test file
From: |
marcandre . lureau |
Subject: |
[PATCH 12/16] test/qga: use G_TEST_DIR to locate os-release test file |
Date: |
Wed, 4 May 2022 21:30:21 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
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>
---
tests/unit/test-qga.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c
index d6df1ee92ea1..ab0b12a2dd16 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'}");
--
2.36.0.44.g0f828332d5ac
- Re: [PATCH 04/16] compiler.h: add QEMU_{BEGIN, END}_IGNORE_INITIALIZER_OVERRIDES, (continued)
- [PATCH 05/16] qobject/json-lexer: disable -Winitializer-overrides warnings, marcandre . lureau, 2022/05/04
- [PATCH 06/16] include: adjust header guards after renaming, marcandre . lureau, 2022/05/04
- [PATCH 07/16] qga: flatten safe_open_or_create(), marcandre . lureau, 2022/05/04
- [PATCH 09/16] qga: use qemu_open_cloexec() for safe_open_or_create(), marcandre . lureau, 2022/05/04
- [PATCH 08/16] osdep: export qemu_open_cloexec(), marcandre . lureau, 2022/05/04
- [PATCH 10/16] qapi/error: add g_autoptr(Error) support, marcandre . lureau, 2022/05/04
- [PATCH 11/16] qga: replace qemu_open_old() with qemu_open_cloexec(), marcandre . lureau, 2022/05/04
- [PATCH 12/16] test/qga: use G_TEST_DIR to locate os-release test file,
marcandre . lureau <=
- [PATCH 13/16] qga/wixl: prefer variables over environment, marcandre . lureau, 2022/05/04
- [PATCH 14/16] qga/wixl: require Mingw_bin, marcandre . lureau, 2022/05/04
- [PATCH 15/16] qga/wixl: simplify some pre-processing, marcandre . lureau, 2022/05/04
- [PATCH 16/16] qga/wixl: replace QEMU_GA_MSI_MINGW_BIN_PATH with glib bindir, marcandre . lureau, 2022/05/04
- Re: [PATCH 00/16] Misc cleanups, Paolo Bonzini, 2022/05/05