From: Ming Lei <ming.lei@redhat.com>
To: Uday Shankar <ushankar@purestorage.com>
Cc: Shuah Khan <shuah@kernel.org>,
linux-block@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] selftests: ublk: kublk: build with -Werror iff CONFIG_WERROR=y
Date: Tue, 29 Apr 2025 09:11:05 +0800 [thread overview]
Message-ID: <aBAnKZCUZWyEJhfS@fedora> (raw)
In-Reply-To: <20250428-ublk_selftests-v1-1-5795f7b00cda@purestorage.com>
On Mon, Apr 28, 2025 at 05:10:20PM -0600, Uday Shankar wrote:
> Compiler warnings can catch bugs at compile time. They can also produce
> annoying false positives. Due to this duality, the kernel provides
> CONFIG_WERROR so that the developer can choose whether or not they want
> compiler warnings to fail the build. Use this same config options to
> control whether or not warnings in building kublk fail its build.
>
> Signed-off-by: Uday Shankar <ushankar@purestorage.com>
> ---
> tools/testing/selftests/ublk/Makefile | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftests/ublk/Makefile
> index ec4624a283bce2ebeed80509be6573c1b7a3623d..86474cfe8d03b2df3f8c9bc1a5902701a0f72f58 100644
> --- a/tools/testing/selftests/ublk/Makefile
> +++ b/tools/testing/selftests/ublk/Makefile
> @@ -1,6 +1,8 @@
> # SPDX-License-Identifier: GPL-2.0
>
> -CFLAGS += -O3 -Wl,-no-as-needed -Wall -I $(top_srcdir)
> +CONFIG = $(top_srcdir)/include/config/auto.conf
> +WERROR = $(if $(shell grep CONFIG_WERROR=y ${CONFIG}),-Werror,)
> +CFLAGS += -O3 -Wl,-no-as-needed -Wall ${WERROR} -I $(top_srcdir)
> LDLIBS += -lpthread -lm -luring
I think it isn't good to reuse kernel CONFIG_WERROR for test code.
But it can be done in the following way by passing 'WERROR=1' to make
command line:
+ifneq ($(WERROR),0)
+ CFLAGS += -Werror
+endif
Thanks,
Ming
next prev parent reply other threads:[~2025-04-29 1:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-28 23:10 [PATCH 0/3] selftests: ublk: more misc fixes Uday Shankar
2025-04-28 23:10 ` [PATCH 1/3] selftests: ublk: kublk: build with -Werror iff CONFIG_WERROR=y Uday Shankar
2025-04-29 1:11 ` Ming Lei [this message]
2025-04-29 22:46 ` Uday Shankar
2025-04-28 23:10 ` [PATCH 2/3] selftests: ublk: make test_generic_06 silent on success Uday Shankar
2025-04-29 1:12 ` Ming Lei
2025-04-28 23:10 ` [PATCH 3/3] selftests: ublk: kublk: fix include path Uday Shankar
2025-04-29 1:14 ` Caleb Sander Mateos
2025-04-29 22:43 ` Uday Shankar
2025-04-29 1:22 ` Ming Lei
2025-05-05 20:31 ` [PATCH 0/3] selftests: ublk: more misc fixes Uday Shankar
2025-05-05 20:34 ` Uday Shankar
2025-05-05 22:44 ` Jens Axboe
2025-05-05 22:53 ` Uday Shankar
2025-05-05 22:55 ` Jens Axboe
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=aBAnKZCUZWyEJhfS@fedora \
--to=ming.lei@redhat.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=ushankar@purestorage.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