public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] selftests: ublk: misc fixes
@ 2025-04-23 21:29 Uday Shankar
  2025-04-23 21:29 ` [PATCH 1/2] selftests: ublk: kublk: build with -Werror Uday Shankar
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Uday Shankar @ 2025-04-23 21:29 UTC (permalink / raw)
  To: Ming Lei, Shuah Khan
  Cc: linux-block, linux-kselftest, linux-kernel, Uday Shankar

Fix a couple of small issues in the ublk selftests

Signed-off-by: Uday Shankar <ushankar@purestorage.com>
---
Uday Shankar (2):
      selftests: ublk: kublk: build with -Werror
      selftests: ublk: common: fix _get_disk_dev_t for pre-9.0 coreutils

 tools/testing/selftests/ublk/Makefile       | 2 +-
 tools/testing/selftests/ublk/test_common.sh | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: d2ce053979d1d302fb009f6e1538a0776f177e1a
change-id: 20250423-ublk_selftests-3b2e200b1fa4

Best regards,
-- 
Uday Shankar <ushankar@purestorage.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] selftests: ublk: kublk: build with -Werror
  2025-04-23 21:29 [PATCH 0/2] selftests: ublk: misc fixes Uday Shankar
@ 2025-04-23 21:29 ` Uday Shankar
  2025-04-24  0:08   ` Ming Lei
  2025-04-24  0:18   ` Jens Axboe
  2025-04-23 21:29 ` [PATCH 2/2] selftests: ublk: common: fix _get_disk_dev_t for pre-9.0 coreutils Uday Shankar
  2025-04-24 12:31 ` (subset) [PATCH 0/2] selftests: ublk: misc fixes Jens Axboe
  2 siblings, 2 replies; 7+ messages in thread
From: Uday Shankar @ 2025-04-23 21:29 UTC (permalink / raw)
  To: Ming Lei, Shuah Khan
  Cc: linux-block, linux-kselftest, linux-kernel, Uday Shankar

Heeding compiler warnings is generally a good idea, and is easy to do
for kublk since there is not much source code. Turn warnings into errors
so that anyone making changes is forced to heed them.

Signed-off-by: Uday Shankar <ushankar@purestorage.com>
---
 tools/testing/selftests/ublk/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftests/ublk/Makefile
index ec4624a283bce2ebeed80509be6573c1b7a3623d..57e580253a68bc497b4292d07ab94d21f4feafdd 100644
--- a/tools/testing/selftests/ublk/Makefile
+++ b/tools/testing/selftests/ublk/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
-CFLAGS += -O3 -Wl,-no-as-needed -Wall -I $(top_srcdir)
+CFLAGS += -O3 -Wl,-no-as-needed -Wall -Werror -I $(top_srcdir)
 LDLIBS += -lpthread -lm -luring
 
 TEST_PROGS := test_generic_01.sh

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] selftests: ublk: common: fix _get_disk_dev_t for pre-9.0 coreutils
  2025-04-23 21:29 [PATCH 0/2] selftests: ublk: misc fixes Uday Shankar
  2025-04-23 21:29 ` [PATCH 1/2] selftests: ublk: kublk: build with -Werror Uday Shankar
@ 2025-04-23 21:29 ` Uday Shankar
  2025-04-24  0:08   ` Ming Lei
  2025-04-24 12:31 ` (subset) [PATCH 0/2] selftests: ublk: misc fixes Jens Axboe
  2 siblings, 1 reply; 7+ messages in thread
From: Uday Shankar @ 2025-04-23 21:29 UTC (permalink / raw)
  To: Ming Lei, Shuah Khan
  Cc: linux-block, linux-kselftest, linux-kernel, Uday Shankar

Some distributions, such as centos stream 9, still have a version of
coreutils which does not yet support the %Hr and %Lr formats for stat(1)
[1, 2]. Running ublk selftests on these distributions results in the
following error in tests that use the _get_disk_dev_t helper:

line 23: ?r: syntax error: operand expected (error token is "?r")

To better accommodate older distributions, rewrite _get_disk_dev_t to
use the much older %t and %T formats for stat instead.

[1] https://github.com/coreutils/coreutils/blob/v9.0/NEWS#L114
[2] https://pkgs.org/download/coreutils

Signed-off-by: Uday Shankar <ushankar@purestorage.com>
---
 tools/testing/selftests/ublk/test_common.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/ublk/test_common.sh b/tools/testing/selftests/ublk/test_common.sh
index 9fc111f64576f91adb731d436c2d535f7dfe5c2e..a81210ca3e99d264f84260aab35827e0c00add01 100755
--- a/tools/testing/selftests/ublk/test_common.sh
+++ b/tools/testing/selftests/ublk/test_common.sh
@@ -17,8 +17,8 @@ _get_disk_dev_t() {
 	local minor
 
 	dev=/dev/ublkb"${dev_id}"
-	major=$(stat -c '%Hr' "$dev")
-	minor=$(stat -c '%Lr' "$dev")
+	major="0x"$(stat -c '%t' "$dev")
+	minor="0x"$(stat -c '%T' "$dev")
 
 	echo $(( (major & 0xfff) << 20 | (minor & 0xfffff) ))
 }

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] selftests: ublk: kublk: build with -Werror
  2025-04-23 21:29 ` [PATCH 1/2] selftests: ublk: kublk: build with -Werror Uday Shankar
@ 2025-04-24  0:08   ` Ming Lei
  2025-04-24  0:18   ` Jens Axboe
  1 sibling, 0 replies; 7+ messages in thread
From: Ming Lei @ 2025-04-24  0:08 UTC (permalink / raw)
  To: Uday Shankar; +Cc: Shuah Khan, linux-block, linux-kselftest, linux-kernel

On Wed, Apr 23, 2025 at 03:29:02PM -0600, Uday Shankar wrote:
> Heeding compiler warnings is generally a good idea, and is easy to do
> for kublk since there is not much source code. Turn warnings into errors
> so that anyone making changes is forced to heed them.
> 
> Signed-off-by: Uday Shankar <ushankar@purestorage.com>
> ---
>  tools/testing/selftests/ublk/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/ublk/Makefile b/tools/testing/selftests/ublk/Makefile
> index ec4624a283bce2ebeed80509be6573c1b7a3623d..57e580253a68bc497b4292d07ab94d21f4feafdd 100644
> --- a/tools/testing/selftests/ublk/Makefile
> +++ b/tools/testing/selftests/ublk/Makefile
> @@ -1,6 +1,6 @@
>  # SPDX-License-Identifier: GPL-2.0
>  
> -CFLAGS += -O3 -Wl,-no-as-needed -Wall -I $(top_srcdir)
> +CFLAGS += -O3 -Wl,-no-as-needed -Wall -Werror -I $(top_srcdir)
>  LDLIBS += -lpthread -lm -luring

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


Thanks,
Ming


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] selftests: ublk: common: fix _get_disk_dev_t for pre-9.0 coreutils
  2025-04-23 21:29 ` [PATCH 2/2] selftests: ublk: common: fix _get_disk_dev_t for pre-9.0 coreutils Uday Shankar
@ 2025-04-24  0:08   ` Ming Lei
  0 siblings, 0 replies; 7+ messages in thread
From: Ming Lei @ 2025-04-24  0:08 UTC (permalink / raw)
  To: Uday Shankar; +Cc: Shuah Khan, linux-block, linux-kselftest, linux-kernel

On Wed, Apr 23, 2025 at 03:29:03PM -0600, Uday Shankar wrote:
> Some distributions, such as centos stream 9, still have a version of
> coreutils which does not yet support the %Hr and %Lr formats for stat(1)
> [1, 2]. Running ublk selftests on these distributions results in the
> following error in tests that use the _get_disk_dev_t helper:
> 
> line 23: ?r: syntax error: operand expected (error token is "?r")
> 
> To better accommodate older distributions, rewrite _get_disk_dev_t to
> use the much older %t and %T formats for stat instead.
> 
> [1] https://github.com/coreutils/coreutils/blob/v9.0/NEWS#L114
> [2] https://pkgs.org/download/coreutils
> 
> Signed-off-by: Uday Shankar <ushankar@purestorage.com>
> ---
>  tools/testing/selftests/ublk/test_common.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/ublk/test_common.sh b/tools/testing/selftests/ublk/test_common.sh
> index 9fc111f64576f91adb731d436c2d535f7dfe5c2e..a81210ca3e99d264f84260aab35827e0c00add01 100755
> --- a/tools/testing/selftests/ublk/test_common.sh
> +++ b/tools/testing/selftests/ublk/test_common.sh
> @@ -17,8 +17,8 @@ _get_disk_dev_t() {
>  	local minor
>  
>  	dev=/dev/ublkb"${dev_id}"
> -	major=$(stat -c '%Hr' "$dev")
> -	minor=$(stat -c '%Lr' "$dev")
> +	major="0x"$(stat -c '%t' "$dev")
> +	minor="0x"$(stat -c '%T' "$dev")

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


Thanks,
Ming


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] selftests: ublk: kublk: build with -Werror
  2025-04-23 21:29 ` [PATCH 1/2] selftests: ublk: kublk: build with -Werror Uday Shankar
  2025-04-24  0:08   ` Ming Lei
@ 2025-04-24  0:18   ` Jens Axboe
  1 sibling, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2025-04-24  0:18 UTC (permalink / raw)
  To: Uday Shankar, Ming Lei, Shuah Khan
  Cc: linux-block, linux-kselftest, linux-kernel

On 4/23/25 3:29 PM, Uday Shankar wrote:
> Heeding compiler warnings is generally a good idea, and is easy to do
> for kublk since there is not much source code. Turn warnings into errors
> so that anyone making changes is forced to heed them.

Honestly not a fan of this, it tends to cause random warnings on
different compilers, and then just causing trouble for people
rather than being useful. If you think it's a good idea, make
it follow CONFIG_WERROR at least, don't make it unconditional.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: (subset) [PATCH 0/2] selftests: ublk: misc fixes
  2025-04-23 21:29 [PATCH 0/2] selftests: ublk: misc fixes Uday Shankar
  2025-04-23 21:29 ` [PATCH 1/2] selftests: ublk: kublk: build with -Werror Uday Shankar
  2025-04-23 21:29 ` [PATCH 2/2] selftests: ublk: common: fix _get_disk_dev_t for pre-9.0 coreutils Uday Shankar
@ 2025-04-24 12:31 ` Jens Axboe
  2 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2025-04-24 12:31 UTC (permalink / raw)
  To: Ming Lei, Shuah Khan, Uday Shankar
  Cc: linux-block, linux-kselftest, linux-kernel


On Wed, 23 Apr 2025 15:29:01 -0600, Uday Shankar wrote:
> Fix a couple of small issues in the ublk selftests
> 
> 

Applied, thanks!

[2/2] selftests: ublk: common: fix _get_disk_dev_t for pre-9.0 coreutils
      commit: 1d019736b6f812bebf3ef89d6e887d06e2a822fc

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-04-24 12:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-23 21:29 [PATCH 0/2] selftests: ublk: misc fixes Uday Shankar
2025-04-23 21:29 ` [PATCH 1/2] selftests: ublk: kublk: build with -Werror Uday Shankar
2025-04-24  0:08   ` Ming Lei
2025-04-24  0:18   ` Jens Axboe
2025-04-23 21:29 ` [PATCH 2/2] selftests: ublk: common: fix _get_disk_dev_t for pre-9.0 coreutils Uday Shankar
2025-04-24  0:08   ` Ming Lei
2025-04-24 12:31 ` (subset) [PATCH 0/2] selftests: ublk: misc fixes Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox