From: Uday Shankar Date: Tue, 29 Apr 2025 22:41:03 +0000 (-0600) Subject: selftests: ublk: kublk: build with -Werror iff WERROR!=0 X-Git-Tag: for-6.16/block-20250523~104 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=3d6ee575d0d49be35dbb787db4d05bdf94e2cdbb;p=linux-block.git selftests: ublk: kublk: build with -Werror iff WERROR!=0 Compiler warnings can catch bugs at compile time; thus, heeding them is usually a good idea. Turn warnings into errors by default for the kublk build so that anyone making changes is forced to heed them. Compiler warnings can also sometimes produce annoying false positives, so provide a flag WERROR that the developer can use as follows to have the build and selftests run go through even if there are warnings: make WERROR=0 TARGETS=ublk kselftest Signed-off-by: Uday Shankar Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/20250429-ublk_selftests-v2-1-e970b6d9e4f4@purestorage.com Signed-off-by: Jens Axboe --- diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftests/ublk/Makefile index f34ac0bac696..d8eb137abacd 100644 --- a/tools/testing/selftests/ublk/Makefile +++ b/tools/testing/selftests/ublk/Makefile @@ -1,6 +1,10 @@ # SPDX-License-Identifier: GPL-2.0 CFLAGS += -O3 -Wl,-no-as-needed -Wall -I $(top_srcdir) +ifneq ($(WERROR),0) + CFLAGS += -Werror +endif + LDLIBS += -lpthread -lm -luring TEST_PROGS := test_generic_01.sh