[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG4es9XPLhHhH-Hfm3_m5zLLtiB1zme8pAazMhErMpHqJcAMmw@mail.gmail.com>
Date: Wed, 8 May 2024 17:29:07 -0700
From: Edward Liaw <edliaw@...gle.com>
To: John Hubbard <jhubbard@...dia.com>
Cc: shuah@...nel.org, Mark Brown <broonie@...nel.org>, Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>,
Nhat Pham <nphamcs@...il.com>, Johannes Weiner <hannes@...xchg.org>,
Christian Brauner <brauner@...nel.org>, Eric Biederman <ebiederm@...ssion.com>,
Kees Cook <keescook@...omium.org>, OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, Darren Hart <dvhart@...radead.org>,
Davidlohr Bueso <dave@...olabs.net>, André Almeida <andrealmeid@...lia.com>,
Jiri Kosina <jikos@...nel.org>, Benjamin Tissoires <bentiss@...nel.org>, Jason Gunthorpe <jgg@...pe.ca>,
Kevin Tian <kevin.tian@...el.com>, Andy Lutomirski <luto@...capital.net>,
Will Drewry <wad@...omium.org>, Marc Zyngier <maz@...nel.org>, Oliver Upton <oliver.upton@...ux.dev>,
James Morse <james.morse@....com>, Suzuki K Poulose <suzuki.poulose@....com>,
Zenghui Yu <yuzenghui@...wei.com>, Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>, Anup Patel <anup@...infault.org>,
Atish Patra <atishp@...shpatra.org>, Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Christian Borntraeger <borntraeger@...ux.ibm.com>, Janosch Frank <frankja@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>, David Hildenbrand <david@...hat.com>,
Mickaël Salaün <mic@...ikod.net>,
Paul Moore <paul@...l-moore.com>, James Morris <jmorris@...ei.org>,
"Serge E. Hallyn" <serge@...lyn.com>, Andrew Morton <akpm@...ux-foundation.org>,
Seth Forshee <sforshee@...nel.org>, Bongsu Jeon <bongsu.jeon@...sung.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Steffen Klassert <steffen.klassert@...unet.com>, Herbert Xu <herbert@...dor.apana.org.au>,
Andreas Färber <afaerber@...e.de>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>, Matthieu Baerts <matttbe@...nel.org>,
Mat Martineau <martineau@...nel.org>, Geliang Tang <geliang@...nel.org>,
Willem de Bruijn <willemdebruijn.kernel@...il.com>, Fenghua Yu <fenghua.yu@...el.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, "Paul E. McKenney" <paulmck@...nel.org>,
Boqun Feng <boqun.feng@...il.com>, Alexandre Belloni <alexandre.belloni@...tlin.com>,
Jarkko Sakkinen <jarkko@...nel.org>, Dave Hansen <dave.hansen@...ux.intel.com>,
Muhammad Usama Anjum <usama.anjum@...labora.com>, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, kernel-team@...roid.com,
linux-sound@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mm@...ck.org, linux-input@...r.kernel.org, iommu@...ts.linux.dev,
kvmarm@...ts.linux.dev, kvm@...r.kernel.org, kvm-riscv@...ts.infradead.org,
linux-riscv@...ts.infradead.org, linux-security-module@...r.kernel.org,
linux-fsdevel@...r.kernel.org, netdev@...r.kernel.org,
linux-actions@...ts.infradead.org, mptcp@...ts.linux.dev,
linux-rtc@...r.kernel.org, linux-sgx@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH v2 3/5] selftests: Include KHDR_INCLUDES in Makefile
On Wed, May 8, 2024 at 2:41 PM John Hubbard <jhubbard@...dia.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@...gle.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
>
>
Powered by blists - more mailing lists