[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Revert "test/qga: use G_TEST_DIR to locate os-release test file"
From: |
Andrey Drobyshev |
Subject: |
[PATCH] Revert "test/qga: use G_TEST_DIR to locate os-release test file" |
Date: |
Mon, 4 Dec 2023 18:32:57 +0200 |
Since the commit a85d09269b QGA_OS_RELEASE variable points to the path
relative to the build dir. Then on qemu-ga startup this path can't be
found as qemu-ga cwd is somewhere else, which leads to the test failure:
# ./tests/unit/test-qga -p /qga/guest-get-osinfo
# random seed: R02S3a90c22d77ff1070fbd844f4959cf4a4
# Start of qga tests
**
ERROR:../tests/unit/test-qga.c:906:test_qga_guest_get_osinfo: 'str' should
not be NULL
Bail out! ERROR:../tests/unit/test-qga.c:906:test_qga_guest_get_osinfo: 'str'
should not be NULL
Let's obtain the absolute path again.
This reverts commit a85d09269bb1a7071d3ce0f2957e3ca9dba7c047.
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
---
tests/unit/test-qga.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c
index 671e83cb86..47cf5e30ec 100644
--- a/tests/unit/test-qga.c
+++ b/tests/unit/test-qga.c
@@ -1034,10 +1034,12 @@ static void test_qga_guest_get_osinfo(gconstpointer
data)
g_autoptr(QDict) ret = NULL;
char *env[2];
QDict *val;
+ g_autofree gchar *cwd = NULL;
+ cwd = g_get_current_dir();
env[0] = g_strdup_printf(
- "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);
+ "QGA_OS_RELEASE=%s%ctests%cdata%ctest-qga-os-release",
+ cwd, G_DIR_SEPARATOR, G_DIR_SEPARATOR, G_DIR_SEPARATOR);
env[1] = NULL;
fixture_setup(&fixture, NULL, env);
--
2.39.3
- [PATCH] Revert "test/qga: use G_TEST_DIR to locate os-release test file",
Andrey Drobyshev <=