qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] qga: test: Use absolute path to test data


From: Marc-André Lureau
Subject: Re: [PATCH 1/3] qga: test: Use absolute path to test data
Date: Mon, 27 Feb 2023 12:16:52 +0400

Hi

On Fri, Feb 24, 2023 at 8:31 AM Daniel Xu <dxu@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 <dxu@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]