From nobody Tue Feb 10 01:59:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552495901157303.97947907113485; Wed, 13 Mar 2019 09:51:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 52B33F95F5; Wed, 13 Mar 2019 16:51:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 25CF960634; Wed, 13 Mar 2019 16:51:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D1F2E181A138; Wed, 13 Mar 2019 16:51:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2DGpY8g013403 for ; Wed, 13 Mar 2019 12:51:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id CD9905D73F; Wed, 13 Mar 2019 16:51:34 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5137F5D706 for ; Wed, 13 Mar 2019 16:51:34 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Wed, 13 Mar 2019 17:51:20 +0100 Message-Id: <20190313165123.23324-6-abologna@redhat.com> In-Reply-To: <20190313165123.23324-1-abologna@redhat.com> References: <20190313165123.23324-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/8] tests: Stop looking for abs_top_srcdir in the environment X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 13 Mar 2019 16:51:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This code snippet has clearly been cargo-culted, and all its instances can be safely dropped seeing as 1) a much better way to handle the scenario in C programs would be to pass the value via the preprocessor, and 2) the value is actually not used anywhere after being defined. Signed-off-by: Andrea Bolognani --- tests/libxlxml2domconfigtest.c | 5 ----- tests/networkxml2firewalltest.c | 6 ------ tests/nwfilterxml2firewalltest.c | 6 ------ tests/qemumemlocktest.c | 5 ----- tests/qemuxml2argvtest.c | 5 ----- tests/virscsitest.c | 5 ----- 6 files changed, 32 deletions(-) diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index 863d8cded5..a96422b3f9 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -41,7 +41,6 @@ =20 # define VIR_FROM_THIS VIR_FROM_LIBXL =20 -static const char *abs_top_srcdir; static virCapsPtr caps; =20 static int @@ -172,10 +171,6 @@ mymain(void) { int ret =3D 0; =20 - abs_top_srcdir =3D getenv("abs_top_srcdir"); - if (!abs_top_srcdir) - abs_top_srcdir =3D abs_srcdir "/.."; - /* Set the timezone because we are mocking the time() function. * If we don't do that, then localtime() may return unpredictable * results. In order to detect things that just work by a blind diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltes= t.c index 91bb6e6b8a..575b68379a 100644 --- a/tests/networkxml2firewalltest.c +++ b/tests/networkxml2firewalltest.c @@ -36,8 +36,6 @@ =20 # define VIR_FROM_THIS VIR_FROM_NONE =20 -static const char *abs_top_srcdir; - # ifdef __linux__ # define RULESTYPE "linux" # else @@ -136,10 +134,6 @@ mymain(void) { int ret =3D 0; =20 - abs_top_srcdir =3D getenv("abs_top_srcdir"); - if (!abs_top_srcdir) - abs_top_srcdir =3D abs_srcdir "/.."; - # define DO_TEST(name) \ do { \ static struct testInfo info =3D { \ diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewallt= est.c index b4cfe5769e..bea267f0fc 100644 --- a/tests/nwfilterxml2firewalltest.c +++ b/tests/nwfilterxml2firewalltest.c @@ -35,8 +35,6 @@ =20 # define VIR_FROM_THIS VIR_FROM_NONE =20 -static const char *abs_top_srcdir; - # ifdef __linux__ # define RULESTYPE "linux" # else @@ -459,10 +457,6 @@ mymain(void) { int ret =3D 0; =20 - abs_top_srcdir =3D getenv("abs_top_srcdir"); - if (!abs_top_srcdir) - abs_top_srcdir =3D abs_srcdir "/.."; - # define DO_TEST(name) \ do { \ static struct testInfo info =3D { \ diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c index 786f647cf0..42a4643338 100644 --- a/tests/qemumemlocktest.c +++ b/tests/qemumemlocktest.c @@ -19,7 +19,6 @@ =20 # define VIR_FROM_THIS VIR_FROM_QEMU =20 -static const char *abs_top_srcdir; static virQEMUDriver driver; =20 struct testInfo { @@ -74,10 +73,6 @@ mymain(void) =20 setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1); =20 - abs_top_srcdir =3D getenv("abs_top_srcdir"); - if (!abs_top_srcdir) - abs_top_srcdir =3D abs_srcdir "/.."; - if (qemuTestDriverInit(&driver) < 0) { VIR_FREE(fakerootdir); return EXIT_FAILURE; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 03e8d79595..67c5c74ec5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -33,7 +33,6 @@ =20 # define VIR_FROM_THIS VIR_FROM_QEMU =20 -static const char *abs_top_srcdir; static virQEMUDriver driver; =20 static unsigned char * @@ -653,10 +652,6 @@ mymain(void) =20 setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1); =20 - abs_top_srcdir =3D getenv("abs_top_srcdir"); - if (!abs_top_srcdir) - abs_top_srcdir =3D abs_srcdir "/.."; - /* Set the timezone because we are mocking the time() function. * If we don't do that, then localtime() may return unpredictable * results. In order to detect things that just work by a blind diff --git a/tests/virscsitest.c b/tests/virscsitest.c index 665f70e28b..be3ef6234e 100644 --- a/tests/virscsitest.c +++ b/tests/virscsitest.c @@ -30,7 +30,6 @@ =20 VIR_LOG_INIT("tests.scsitest"); =20 -static const char *abs_top_srcdir; static char *virscsi_prefix; =20 static int @@ -195,10 +194,6 @@ mymain(void) char *tmpdir =3D NULL; char template[] =3D "/tmp/libvirt_XXXXXX"; =20 - abs_top_srcdir =3D getenv("abs_top_srcdir"); - if (!abs_top_srcdir) - abs_top_srcdir =3D abs_srcdir "/.."; - if (virAsprintf(&virscsi_prefix, "%s" VIR_SCSI_DATA, abs_srcdir) < 0) { ret =3D -1; goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list