Hi On Mon, Dec 4, 2023 at 8:33 PM Andrey Drobyshev <andrey.drobys...@virtuozzo.com> wrote: > > 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.
Can you detail how the build and the test is done? If I recall correctly, this change was done in order to move qga to a subproject(), but isn't strictly required at this point. Although I believe it is more correct to lookup test data relative to G_TEST_DIST. > > This reverts commit a85d09269bb1a7071d3ce0f2957e3ca9dba7c047. > > Signed-off-by: Andrey Drobyshev <andrey.drobys...@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 > > -- Marc-André Lureau