Hi On Fri, Feb 24, 2023 at 8:31 AM Daniel Xu <d...@dxuuu.xyz> wrote: > > It looks like qga's working directory is in a tempdir. So the relative > path that the test case gives qga through the QGA_OS_RELEASE= > env variable does not resolve correctly. > > Fix by doing a poor man's path canonicalization of the test data file. > > Note we cannot use g_canonicalize_filename() b/c that helper was only > introduced in glib 2.58 and the current GLIB_VERSION_MAX_ALLOWED is > pinned to 2.56. > > Signed-off-by: Daniel Xu <d...@dxuuu.xyz>
This breaks "meson test test-qga" for me. How do you run the tests? > --- > tests/unit/test-qga.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c > index b4e0a14573..9d8e1d1cd3 100644 > --- a/tests/unit/test-qga.c > +++ b/tests/unit/test-qga.c > @@ -881,13 +881,16 @@ static void test_qga_guest_get_osinfo(gconstpointer > data) > { > TestFixture fixture; > const gchar *str; > + g_autofree const gchar *cwd; const is not appropriate here, interesting I don't get a warning > g_autoptr(QDict) ret = NULL; > char *env[2]; > QDict *val; > > + 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%c%s%c..%cdata%ctest-qga-os-release", > + cwd, G_DIR_SEPARATOR, g_test_get_dir(G_TEST_DIST), G_DIR_SEPARATOR, > + G_DIR_SEPARATOR, G_DIR_SEPARATOR); > env[1] = NULL; > fixture_setup(&fixture, NULL, env); > > -- > 2.39.1 > > -- Marc-André Lureau