From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D29C5C433EF for ; Fri, 20 May 2022 13:44:38 +0000 (UTC) Received: from localhost ([::1]:39988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ns2vl-0001p4-Sk for qemu-devel@archiver.kernel.org; Fri, 20 May 2022 09:44:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ns2un-0000W4-3L for qemu-devel@nongnu.org; Fri, 20 May 2022 09:43:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57084) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ns2ul-0006lJ-9G for qemu-devel@nongnu.org; Fri, 20 May 2022 09:43:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653054214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cvqHoI6xuUJ4ZP29DcTeU1JkZgn8Sa7wpgLOB5dcdpk=; b=LjJ6KKO8qR5kV/PG5XJt86fYXSBGPhknxJnc5QWtyRhhqkEVb0IRd9RKVhLITfRuJEMKCs K0gGEuvgrUl4tsv4q5qVEfqkTqWQLKLSgSv2KEpdemGciqllNw0fTw6dJ8iLRminwnHR9u uC6FPzDazKxPsg8Oi3Hl3/dpk9Uiv5s= Received: from mail-yw1-f199.google.com (mail-yw1-f199.google.com [209.85.128.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-670-jZKFsmBKNWadlZSJTn_YfQ-1; Fri, 20 May 2022 09:43:32 -0400 X-MC-Unique: jZKFsmBKNWadlZSJTn_YfQ-1 Received: by mail-yw1-f199.google.com with SMTP id 00721157ae682-2dc7bdd666fso71998587b3.7 for ; Fri, 20 May 2022 06:43:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cvqHoI6xuUJ4ZP29DcTeU1JkZgn8Sa7wpgLOB5dcdpk=; b=QpX38uaLsWJuosWA33u5HUvrugEXoJMntWHkw/V5Kh8r0Iciu5Jpb589U6X0f7TmYV 4+q0aySyq2EH4SNZZPg8MT4obCwY4+Km1HSsEvlbUgoKsDoMlgoYTah6EiWzdB9/7f4i ogIlYirepQyyiMMMSgrJIMo4GEQpHORSyJi6rvtfFLZ5AAJdGGQNTFceUgUA8bWKvYTc i0tyXtCysqlu6oh4gIqBI5Slgz9TKfVE476MDLzWl3QkoCjue6TyiTujpZ3/INezzBDB F89DZkG1pKH+WKZ/lSoiVsDKIGAUe0U8dJvp8E+R+R0T/eQlrgJfEhSwuKM5MP1c1QH8 Yu6Q== X-Gm-Message-State: AOAM530z6i/laBBz1v77CFtebNCAJ5EofeDqmPWaOaW2sZH1//Vmeh1Y JTS4CpOqG9TE7LZ4nRqfOwuzidQrEGxhgz3j6pod01t1pPrDY6oN0IzYaGrl5lEiIOzVDf0dMGM Zg3Wnl/3XAROsIH9GCL1xo2+xgtOcBmE= X-Received: by 2002:a05:6902:729:b0:64f:3cfb:6d28 with SMTP id l9-20020a056902072900b0064f3cfb6d28mr6979898ybt.30.1653054212385; Fri, 20 May 2022 06:43:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjI8qvlzS0fLVSzFAOlDXDyLSp/upii7UR9s+eEZI3Gwh9e9OjrkJOxIh4nwZ8jlevaTKZh4FBIRMKCoYzF04= X-Received: by 2002:a05:6902:729:b0:64f:3cfb:6d28 with SMTP id l9-20020a056902072900b0064f3cfb6d28mr6979883ybt.30.1653054212183; Fri, 20 May 2022 06:43:32 -0700 (PDT) MIME-Version: 1.0 References: <20220513180821.905149-1-marcandre.lureau@redhat.com> <20220513180821.905149-11-marcandre.lureau@redhat.com> In-Reply-To: <20220513180821.905149-11-marcandre.lureau@redhat.com> From: Konstantin Kostiuk Date: Fri, 20 May 2022 16:43:21 +0300 Message-ID: Subject: Re: [PATCH v3 10/15] test/qga: use G_TEST_DIR to locate os-release test file To: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Cc: QEMU , Michael Roth , Markus Armbruster Content-Type: multipart/alternative; boundary="0000000000001ca7f105df71ad55" Received-SPF: pass client-ip=170.10.133.124; envelope-from=kkostiuk@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --0000000000001ca7f105df71ad55 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Reviewed-by: Konstantin Kostiuk On Fri, May 13, 2022 at 9:08 PM wrote: > From: Marc-Andr=C3=A9 Lureau > > 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=C3=A9 Lureau > --- > 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 d6df1ee92e..ab0b12a2dd 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 =3D NULL; > + char *env[2]; + QDict *val; > > - cwd =3D g_get_current_dir(); > env[0] =3D g_strdup_printf( > - "QGA_OS_RELEASE=3D%s%ctests%cdata%ctest-qga-os-release", > - cwd, G_DIR_SEPARATOR, G_DIR_SEPARATOR, G_DIR_SEPARATOR); > + "QGA_OS_RELEASE=3D%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] =3D NULL; > - g_free(cwd); > fixture_setup(&fixture, NULL, env); > > ret =3D qmp_fd(fixture.fd, "{'execute': 'guest-get-osinfo'}"); > -- > 2.36.1 > > --0000000000001ca7f105df71ad55 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com= >

On Fri, May 13, 2022 at 9:08 PM <marcandre.lureau@redhat.com> wrote:
From: Marc-Andr=C3=A9 Lureau <marcandre.lur= eau@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=C3=A9 Lureau <marcandre.lureau@redhat.com>
---
=C2=A0tests/unit/test-qga.c | 11 +++++------
=C2=A01 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c
index d6df1ee92e..ab0b12a2dd 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 d= ata)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0TestFixture fixture;
=C2=A0 =C2=A0 =C2=A0const gchar *str;
-=C2=A0 =C2=A0 gchar *cwd, *env[2];
-=C2=A0 =C2=A0 QDict *ret, *val;
+=C2=A0 =C2=A0 QDict *ret =3D NULL;
+=C2=A0 =C2=A0 char *env[2];
+=C2=A0 =C2=A0 QDict *val;

-=C2=A0 =C2=A0 cwd =3D g_get_current_dir();
=C2=A0 =C2=A0 =C2=A0env[0] =3D g_strdup_printf(
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 "QGA_OS_RELEASE=3D%s%ctests%cdata%ctest-q= ga-os-release",
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 cwd, G_DIR_SEPARATOR, G_DIR_SEPARATOR, G_DIR_S= EPARATOR);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 "QGA_OS_RELEASE=3D%s%c..%cdata%ctest-qga-= os-release",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 g_test_get_dir(G_TEST_DIST), G_DIR_SEPARATOR, = G_DIR_SEPARATOR, G_DIR_SEPARATOR);
=C2=A0 =C2=A0 =C2=A0env[1] =3D NULL;
-=C2=A0 =C2=A0 g_free(cwd);
=C2=A0 =C2=A0 =C2=A0fixture_setup(&fixture, NULL, env);

=C2=A0 =C2=A0 =C2=A0ret =3D qmp_fd(fixture.fd, "{'execute': &#= 39;guest-get-osinfo'}");
--
2.36.1

--0000000000001ca7f105df71ad55--