mbox series

[v2,0/3] selftests: ublk: more misc fixes

Message ID 20250429-ublk_selftests-v2-0-e970b6d9e4f4@purestorage.com
Headers show
Series selftests: ublk: more misc fixes | expand

Message

Uday Shankar April 29, 2025, 10:41 p.m. UTC
Fix some more minor issues in ublk selftests.

The first patch is from
https://lore.kernel.org/linux-block/20250423-ublk_selftests-v1-0-7d060e260e76@purestorage.com/
with a modification requested by Jens. The others are new.

Signed-off-by: Uday Shankar <ushankar@purestorage.com>
---
Changes in v2:
- Use a test-specific WERROR flag instead of reusing CONFIG_WERROR from
  the kernel build for deciding whether or not to use -Werror for the
  kublk build. The default behavior is to use -Werror (Ming Lei)
- Link to v1: https://lore.kernel.org/r/20250428-ublk_selftests-v1-0-5795f7b00cda@purestorage.com

---
Uday Shankar (3):
      selftests: ublk: kublk: build with -Werror iff WERROR!=0
      selftests: ublk: make test_generic_06 silent on success
      selftests: ublk: kublk: fix include path

 tools/testing/selftests/ublk/Makefile           | 6 +++++-
 tools/testing/selftests/ublk/kublk.h            | 1 -
 tools/testing/selftests/ublk/test_generic_06.sh | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)
---
base-commit: 53ec1abce79c986dc59e59d0c60d00088bcdf32a
change-id: 20250428-ublk_selftests-983240d3a325

Best regards,

Comments

Ming Lei April 30, 2025, 12:09 a.m. UTC | #1
On Tue, Apr 29, 2025 at 04:41:03PM -0600, Uday Shankar wrote:
> 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

I thought WERROR is 0 default, but actually the default value is 1.

Just tried gcc 14/15 and clang 18/20, looks everything works fine.

For kernel selftests, I guess the usual way is to do it explicitly
by passing 'make -C tools/testing/selftests TARGETS=ublk'.

Even though the build fails for people who is running the test on purpose,
or doling whole kernel selfests, they still can:

- report the failure

- skip ublk test by adding 'SKIP_TARGETS=ublk' to command line

Also this ways has been used by perf, lib/api, lib/subcmd and lib/sysmbol in
linux kernel tools/, so I feel the change should be doable, but let Jens decide
if it is fine to pass -Werror at default:

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Otherwise, it still can be enabled conditionally with default off.


Thanks,
Ming
Jens Axboe May 5, 2025, 10:55 p.m. UTC | #2
On Tue, 29 Apr 2025 16:41:02 -0600, Uday Shankar wrote:
> Fix some more minor issues in ublk selftests.
> 
> The first patch is from
> https://lore.kernel.org/linux-block/20250423-ublk_selftests-v1-0-7d060e260e76@purestorage.com/
> with a modification requested by Jens. The others are new.
> 
> 
> [...]

Applied, thanks!

[1/3] selftests: ublk: kublk: build with -Werror iff WERROR!=0
      commit: 3d6ee575d0d49be35dbb787db4d05bdf94e2cdbb
[2/3] selftests: ublk: make test_generic_06 silent on success
      commit: 254827a32118ddb171680dc2143c777cc68f2cbc
[3/3] selftests: ublk: kublk: fix include path
      commit: e371b9d3368ccb6b55fe9747be12c3107b2817b3

Best regards,