KVM Archive mirror
 help / color / mirror / Atom feed
From: Edward Liaw <edliaw@google.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: shuah@kernel.org, "Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>, "Nhat Pham" <nphamcs@gmail.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Christian Brauner" <brauner@kernel.org>,
	"Eric Biederman" <ebiederm@xmission.com>,
	"Kees Cook" <keescook@chromium.org>,
	"OGAWA Hirofumi" <hirofumi@mail.parknet.co.jp>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Darren Hart" <dvhart@infradead.org>,
	"Davidlohr Bueso" <dave@stgolabs.net>,
	"André Almeida" <andrealmeid@igalia.com>,
	"Jiri Kosina" <jikos@kernel.org>,
	"Benjamin Tissoires" <bentiss@kernel.org>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Kevin Tian" <kevin.tian@intel.com>,
	"Andy Lutomirski" <luto@amacapital.net>,
	"Will Drewry" <wad@chromium.org>, "Marc Zyngier" <maz@kernel.org>,
	"Oliver Upton" <oliver.upton@linux.dev>,
	"James Morse" <james.morse@arm.com>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	"Zenghui Yu" <yuzenghui@huawei.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Sean Christopherson" <seanjc@google.com>,
	"Anup Patel" <anup@brainfault.org>,
	"Atish Patra" <atishp@atishpatra.org>,
	"Paul Walmsley" <paul.walmsley@sifive.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Albert Ou" <aou@eecs.berkeley.edu>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Mickaël Salaün" <mic@digikod.net>,
	"Paul Moore" <paul@paul-moore.com>,
	"James Morris" <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Seth Forshee" <sforshee@kernel.org>,
	"Bongsu Jeon" <bongsu.jeon@samsung.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Steffen Klassert" <steffen.klassert@secunet.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"Andreas Färber" <afaerber@suse.de>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Matthieu Baerts" <matttbe@kernel.org>,
	"Mat Martineau" <martineau@kernel.org>,
	"Geliang Tang" <geliang@kernel.org>,
	"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>,
	"Fenghua Yu" <fenghua.yu@intel.com>,
	"Reinette Chatre" <reinette.chatre@intel.com>,
	"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Jarkko Sakkinen" <jarkko@kernel.org>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"Muhammad Usama Anjum" <usama.anjum@collabora.com>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kernel-team@android.com, linux-sound@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org,
	linux-input@vger.kernel.org, iommu@lists.linux.dev,
	kvmarm@lists.linux.dev, kvm@vger.kernel.org,
	kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org,
	linux-security-module@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org,
	linux-actions@lists.infradead.org, mptcp@lists.linux.dev,
	linux-rtc@vger.kernel.org, linux-sgx@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH v2 3/5] selftests: Include KHDR_INCLUDES in Makefile
Date: Wed, 8 May 2024 17:29:07 -0700	[thread overview]
Message-ID: <CAG4es9XPLhHhH-Hfm3_m5zLLtiB1zme8pAazMhErMpHqJcAMmw@mail.gmail.com> (raw)
In-Reply-To: <ec8ab737-a841-4cd5-8ec1-e0a777744262@nvidia.com>

On Wed, May 8, 2024 at 2:41 PM John Hubbard <jhubbard@nvidia.com> wrote:
>
> On 5/7/24 2:38 PM, Edward Liaw wrote:
> > Add KHDR_INCLUDES to CFLAGS to pull in the kselftest harness
> > dependencies (-D_GNU_SOURCE).
> >
> > Fixes: 809216233555 ("selftests/harness: remove use of LINE_MAX")
> > Signed-off-by: Edward Liaw <edliaw@google.com>
> > ---
> >   tools/testing/selftests/alsa/Makefile                  | 2 +-
> >   tools/testing/selftests/arm64/signal/Makefile          | 2 +-
> >   tools/testing/selftests/exec/Makefile                  | 2 +-
> >   tools/testing/selftests/filesystems/overlayfs/Makefile | 2 +-
> >   tools/testing/selftests/hid/Makefile                   | 2 +-
> >   tools/testing/selftests/nci/Makefile                   | 2 +-
> >   tools/testing/selftests/prctl/Makefile                 | 2 ++
> >   tools/testing/selftests/proc/Makefile                  | 2 +-
> >   tools/testing/selftests/riscv/mm/Makefile              | 2 +-
> >   tools/testing/selftests/rtc/Makefile                   | 2 +-
> >   tools/testing/selftests/tmpfs/Makefile                 | 2 +-
> >   11 files changed, 12 insertions(+), 10 deletions(-)
>
> Hi Edward,
>
> Seeing as how these all include lib.mk, and all use CFLAGS, is there
> any reason not to simply fix this in lib.mk instead? Like this:
>
> diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
> index 7fa4a96e26ed..df72610e0d2b 100644
> --- a/tools/testing/selftests/lib.mk
> +++ b/tools/testing/selftests/lib.mk
> @@ -170,6 +170,8 @@ clean: $(if $(TEST_GEN_MODS_DIR),clean_mods_dir)
>   CFLAGS += $(USERCFLAGS)
>   LDFLAGS += $(USERLDFLAGS)
>
> +CFLAGS += $(KHDR_INCLUDES)
> +
>   # When make O= with kselftest target from main level
>   # the following aren't defined.
>   #
>

Or how about just adding -D_GNU_SOURCE to CFLAGS then?



>
> thanks,
> --
> John Hubbard
> NVIDIA
>
> >
> > diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile
> > index 5af9ba8a4645..9a0ef194522c 100644
> > --- a/tools/testing/selftests/alsa/Makefile
> > +++ b/tools/testing/selftests/alsa/Makefile
> > @@ -6,7 +6,7 @@ LDLIBS += $(shell pkg-config --libs alsa)
> >   ifeq ($(LDLIBS),)
> >   LDLIBS += -lasound
> >   endif
> > -CFLAGS += -L$(OUTPUT) -Wl,-rpath=./
> > +CFLAGS += $(KHDR_INCLUDES) -L$(OUTPUT) -Wl,-rpath=./
> >
> >   LDLIBS+=-lpthread
> >
> > diff --git a/tools/testing/selftests/arm64/signal/Makefile b/tools/testing/selftests/arm64/signal/Makefile
> > index 8f5febaf1a9a..ae682ade615d 100644
> > --- a/tools/testing/selftests/arm64/signal/Makefile
> > +++ b/tools/testing/selftests/arm64/signal/Makefile
> > @@ -2,7 +2,7 @@
> >   # Copyright (C) 2019 ARM Limited
> >
> >   # Additional include paths needed by kselftest.h and local headers
> > -CFLAGS += -D_GNU_SOURCE -std=gnu99 -I.
> > +CFLAGS += $(KHDR_INCLUDES) -std=gnu99 -I.
> >
> >   SRCS := $(filter-out testcases/testcases.c,$(wildcard testcases/*.c))
> >   PROGS := $(patsubst %.c,%,$(SRCS))
> > diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
> > index fb4472ddffd8..15e78ec7c55e 100644
> > --- a/tools/testing/selftests/exec/Makefile
> > +++ b/tools/testing/selftests/exec/Makefile
> > @@ -1,7 +1,7 @@
> >   # SPDX-License-Identifier: GPL-2.0
> >   CFLAGS = -Wall
> >   CFLAGS += -Wno-nonnull
> > -CFLAGS += -D_GNU_SOURCE
> > +CFLAGS += $(KHDR_INCLUDES)
> >
> >   TEST_PROGS := binfmt_script.py
> >   TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular
> > diff --git a/tools/testing/selftests/filesystems/overlayfs/Makefile b/tools/testing/selftests/filesystems/overlayfs/Makefile
> > index 56b2b48a765b..6c29c963c7a8 100644
> > --- a/tools/testing/selftests/filesystems/overlayfs/Makefile
> > +++ b/tools/testing/selftests/filesystems/overlayfs/Makefile
> > @@ -2,6 +2,6 @@
> >
> >   TEST_GEN_PROGS := dev_in_maps
> >
> > -CFLAGS := -Wall -Werror
> > +CFLAGS := -Wall -Werror $(KHDR_INCLUDES)
> >
> >   include ../../lib.mk
> > diff --git a/tools/testing/selftests/hid/Makefile b/tools/testing/selftests/hid/Makefile
> > index 2b5ea18bde38..0661b34488ef 100644
> > --- a/tools/testing/selftests/hid/Makefile
> > +++ b/tools/testing/selftests/hid/Makefile
> > @@ -21,7 +21,7 @@ CXX ?= $(CROSS_COMPILE)g++
> >
> >   HOSTPKG_CONFIG := pkg-config
> >
> > -CFLAGS += -g -O0 -rdynamic -Wall -Werror -I$(OUTPUT)
> > +CFLAGS += -g -O0 -rdynamic -Wall -Werror $(KHDR_INCLUDES) -I$(OUTPUT)
> >   CFLAGS += -I$(OUTPUT)/tools/include
> >
> >   LDLIBS += -lelf -lz -lrt -lpthread
> > diff --git a/tools/testing/selftests/nci/Makefile b/tools/testing/selftests/nci/Makefile
> > index 47669a1d6a59..bbc5b8ec3b17 100644
> > --- a/tools/testing/selftests/nci/Makefile
> > +++ b/tools/testing/selftests/nci/Makefile
> > @@ -1,5 +1,5 @@
> >   # SPDX-License-Identifier: GPL-2.0
> > -CFLAGS += -Wl,-no-as-needed -Wall
> > +CFLAGS += -Wl,-no-as-needed -Wall $(KHDR_INCLUDES)
> >   LDFLAGS += -lpthread
> >
> >   TEST_GEN_PROGS := nci_dev
> > diff --git a/tools/testing/selftests/prctl/Makefile b/tools/testing/selftests/prctl/Makefile
> > index 01dc90fbb509..1a0aefec9d6f 100644
> > --- a/tools/testing/selftests/prctl/Makefile
> > +++ b/tools/testing/selftests/prctl/Makefile
> > @@ -6,6 +6,8 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/x86/ -e s/x86_64/x86/)
> >   ifeq ($(ARCH),x86)
> >   TEST_PROGS := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test \
> >               disable-tsc-test set-anon-vma-name-test set-process-name
> > +
> > +CFLAGS += $(KHDR_INCLUDES)
> >   all: $(TEST_PROGS)
> >
> >   include ../lib.mk
> > diff --git a/tools/testing/selftests/proc/Makefile b/tools/testing/selftests/proc/Makefile
> > index cd95369254c0..9596014c10a0 100644
> > --- a/tools/testing/selftests/proc/Makefile
> > +++ b/tools/testing/selftests/proc/Makefile
> > @@ -1,6 +1,6 @@
> >   # SPDX-License-Identifier: GPL-2.0-only
> >   CFLAGS += -Wall -O2 -Wno-unused-function
> > -CFLAGS += -D_GNU_SOURCE
> > +CFLAGS += $(KHDR_INCLUDES)
> >   LDFLAGS += -pthread
> >
> >   TEST_GEN_PROGS :=
> > diff --git a/tools/testing/selftests/riscv/mm/Makefile b/tools/testing/selftests/riscv/mm/Makefile
> > index c333263f2b27..715a21241113 100644
> > --- a/tools/testing/selftests/riscv/mm/Makefile
> > +++ b/tools/testing/selftests/riscv/mm/Makefile
> > @@ -3,7 +3,7 @@
> >   # Originally tools/testing/arm64/abi/Makefile
> >
> >   # Additional include paths needed by kselftest.h and local headers
> > -CFLAGS += -D_GNU_SOURCE -std=gnu99 -I.
> > +CFLAGS += $(KHDR_INCLUDES) -std=gnu99 -I.
> >
> >   TEST_GEN_FILES := mmap_default mmap_bottomup
> >
> > diff --git a/tools/testing/selftests/rtc/Makefile b/tools/testing/selftests/rtc/Makefile
> > index 55198ecc04db..654f9d58da3c 100644
> > --- a/tools/testing/selftests/rtc/Makefile
> > +++ b/tools/testing/selftests/rtc/Makefile
> > @@ -1,5 +1,5 @@
> >   # SPDX-License-Identifier: GPL-2.0
> > -CFLAGS += -O3 -Wl,-no-as-needed -Wall
> > +CFLAGS += -O3 -Wl,-no-as-needed -Wall $(KHDR_INCLUDES)
> >   LDLIBS += -lrt -lpthread -lm
> >
> >   TEST_GEN_PROGS = rtctest
> > diff --git a/tools/testing/selftests/tmpfs/Makefile b/tools/testing/selftests/tmpfs/Makefile
> > index aa11ccc92e5b..bcdc1bb6d2e6 100644
> > --- a/tools/testing/selftests/tmpfs/Makefile
> > +++ b/tools/testing/selftests/tmpfs/Makefile
> > @@ -1,6 +1,6 @@
> >   # SPDX-License-Identifier: GPL-2.0-only
> >   CFLAGS += -Wall -O2
> > -CFLAGS += -D_GNU_SOURCE
> > +CFLAGS += $(KHDR_INCLUDES)
> >
> >   TEST_GEN_PROGS :=
> >   TEST_GEN_PROGS += bug-link-o-tmpfile
>
>

  reply	other threads:[~2024-05-09  0:29 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07 21:38 [PATCH v2 0/5] Define _GNU_SOURCE for sources using Edward Liaw
2024-05-07 21:38 ` [PATCH v2 1/5] selftests: Compile kselftest headers with -D_GNU_SOURCE Edward Liaw
2024-05-08  7:48   ` Muhammad Usama Anjum
2024-05-08 12:05   ` Mark Brown
2024-05-08 21:23   ` John Hubbard
2024-05-07 21:38 ` [PATCH v2 2/5] selftests/sgx: Include KHDR_INCLUDES in Makefile Edward Liaw
2024-05-08  7:49   ` Muhammad Usama Anjum
2024-05-08 15:33   ` Dave Hansen
2024-05-08 16:44     ` Jarkko Sakkinen
2024-05-08 21:25   ` John Hubbard
2024-05-07 21:38 ` [PATCH v2 3/5] selftests: " Edward Liaw
2024-05-07 22:36   ` Jarkko Sakkinen
2024-05-08  7:49   ` Muhammad Usama Anjum
2024-05-08 21:41   ` John Hubbard
2024-05-09  0:29     ` Edward Liaw [this message]
2024-05-09  1:03       ` John Hubbard
2024-05-09  5:14   ` Mark Brown
2024-05-07 21:38 ` [PATCH v2 4/5] selftests: Drop define _GNU_SOURCE Edward Liaw
2024-05-08  7:50   ` Muhammad Usama Anjum
2024-05-08 13:54   ` Sean Christopherson
2024-05-08 20:27     ` Edward Liaw
2024-05-08 21:39   ` John Hubbard
2024-05-07 21:38 ` [PATCH v2 5/5] selftests: Drop duplicate -D_GNU_SOURCE Edward Liaw
2024-05-08  7:58   ` Muhammad Usama Anjum
2024-05-08 21:49   ` John Hubbard
2024-05-07 23:28 ` [PATCH v2 0/5] Define _GNU_SOURCE for sources using Kees Cook
2024-05-08 13:47 ` Sean Christopherson
2024-05-08 18:03   ` Edward Liaw
2024-05-08 23:10 ` Shuah Khan
2024-05-09  6:13   ` Edward Liaw
2024-05-09 14:37     ` Shuah Khan
2024-05-09 17:45       ` Edward Liaw
2024-05-09 18:20         ` Muhammad Usama Anjum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAG4es9XPLhHhH-Hfm3_m5zLLtiB1zme8pAazMhErMpHqJcAMmw@mail.gmail.com \
    --to=edliaw@google.com \
    --cc=afaerber@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrealmeid@igalia.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atishp@atishpatra.org \
    --cc=bentiss@kernel.org \
    --cc=bongsu.jeon@samsung.com \
    --cc=boqun.feng@gmail.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave@stgolabs.net \
    --cc=davem@davemloft.net \
    --cc=david@redhat.com \
    --cc=dvhart@infradead.org \
    --cc=ebiederm@xmission.com \
    --cc=edumazet@google.com \
    --cc=fenghua.yu@intel.com \
    --cc=frankja@linux.ibm.com \
    --cc=geliang@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=imbrenda@linux.ibm.com \
    --cc=iommu@lists.linux.dev \
    --cc=james.morse@arm.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=jikos@kernel.org \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.org \
    --cc=kernel-team@android.com \
    --cc=kevin.tian@intel.com \
    --cc=kuba@kernel.org \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-actions@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=martineau@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=matttbe@kernel.org \
    --cc=maz@kernel.org \
    --cc=mic@digikod.net \
    --cc=mingo@redhat.com \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=oliver.upton@linux.dev \
    --cc=pabeni@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=paul@paul-moore.com \
    --cc=paulmck@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=perex@perex.cz \
    --cc=peterz@infradead.org \
    --cc=reinette.chatre@intel.com \
    --cc=seanjc@google.com \
    --cc=serge@hallyn.com \
    --cc=sforshee@kernel.org \
    --cc=shuah@kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tglx@linutronix.de \
    --cc=tiwai@suse.com \
    --cc=usama.anjum@collabora.com \
    --cc=wad@chromium.org \
    --cc=will@kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).