linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH blktests] check: confirm dependent commands
@ 2024-06-07  4:52 Shin'ichiro Kawasaki
  2024-06-07  4:56 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shin'ichiro Kawasaki @ 2024-06-07  4:52 UTC (permalink / raw)
  To: linux-block; +Cc: Christoph Hellwig, Shin'ichiro Kawasaki

As described in README, blktests requires some commands to run tests.
Check them and warn if they are not available. Also confirm that the
bash version is 4.2 or larger.

Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 check | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/check b/check
index 3ed4510..7f43a31 100755
--- a/check
+++ b/check
@@ -709,6 +709,32 @@ _check() {
 	return $ret
 }
 
+_check_dependencies() {
+	local v1 v2 v3
+	local -A required_commands_and_packages
+	local cmd
+
+	# Require bash version 4.2
+	IFS='.' read -r v1 v2 v3 < <(bash --version | grep version | head -1 | \
+					   sed 's/.*version \([0-9.]\+\).*/\1/')
+	if ((v1 * 65536 + v2 * 256 + v3 < 4 * 65536 + 2 * 256)); then
+		_warning "bash version is older than 4.2"
+	fi
+
+	# Check dependent commands to run blktests
+	required_commands_and_packages[dd]="GNU coreutils"
+	required_commands_and_packages[gawk]="GNU awk"
+	required_commands_and_packages[blockdev]="util-linux"
+	required_commands_and_packages[fio]="fio"
+	required_commands_and_packages[udevadm]="systemd-udev"
+
+	for cmd in "${!required_commands_and_packages[@]}"; do
+		command -v "$cmd" &> /dev/null && continue
+		_warning "$cmd is not available." \
+			 "Install ${required_commands_and_packages[$cmd]}."
+	done
+}
+
 usage () {
 	USAGE_STRING="\
 usage: $0 [options] [group-or-test...]
@@ -748,6 +774,8 @@ Miscellaneous:
 	esac
 }
 
+_check_dependencies
+
 if ! TEMP=$(getopt -o 'do:q::x:c:h' --long 'device-only,quick::,exclude:,output:,config:,help' -n "$0" -- "$@"); then
 	exit 1
 fi
-- 
2.45.0


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

* Re: [PATCH blktests] check: confirm dependent commands
  2024-06-07  4:52 [PATCH blktests] check: confirm dependent commands Shin'ichiro Kawasaki
@ 2024-06-07  4:56 ` Christoph Hellwig
  2024-06-10  2:49 ` Chaitanya Kulkarni
  2024-06-18  5:32 ` Shinichiro Kawasaki
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2024-06-07  4:56 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block, Christoph Hellwig

On Fri, Jun 07, 2024 at 01:52:46PM +0900, Shin'ichiro Kawasaki wrote:
> As described in README, blktests requires some commands to run tests.
> Check them and warn if they are not available. Also confirm that the
> bash version is 4.2 or larger.

Loks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


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

* Re: [PATCH blktests] check: confirm dependent commands
  2024-06-07  4:52 [PATCH blktests] check: confirm dependent commands Shin'ichiro Kawasaki
  2024-06-07  4:56 ` Christoph Hellwig
@ 2024-06-10  2:49 ` Chaitanya Kulkarni
  2024-06-18  5:32 ` Shinichiro Kawasaki
  2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2024-06-10  2:49 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-block@vger.kernel.org; +Cc: Christoph Hellwig

On 6/6/2024 9:52 PM, Shin'ichiro Kawasaki wrote:
> As described in README, blktests requires some commands to run tests.
> Check them and warn if they are not available. Also confirm that the
> bash version is 4.2 or larger.
> 
> Suggested-by: Christoph Hellwig<hch@lst.de>
> Signed-off-by: Shin'ichiro Kawasaki<shinichiro.kawasaki@wdc.com>
> ---

LGTM ...

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck


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

* Re: [PATCH blktests] check: confirm dependent commands
  2024-06-07  4:52 [PATCH blktests] check: confirm dependent commands Shin'ichiro Kawasaki
  2024-06-07  4:56 ` Christoph Hellwig
  2024-06-10  2:49 ` Chaitanya Kulkarni
@ 2024-06-18  5:32 ` Shinichiro Kawasaki
  2 siblings, 0 replies; 4+ messages in thread
From: Shinichiro Kawasaki @ 2024-06-18  5:32 UTC (permalink / raw)
  To: linux-block@vger.kernel.org; +Cc: hch

On Jun 07, 2024 / 13:52, Shin'ichiro Kawasaki wrote:
> As described in README, blktests requires some commands to run tests.
> Check them and warn if they are not available. Also confirm that the
> bash version is 4.2 or larger.

FYI, this patch has got applied.

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

end of thread, other threads:[~2024-06-18  5:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-07  4:52 [PATCH blktests] check: confirm dependent commands Shin'ichiro Kawasaki
2024-06-07  4:56 ` Christoph Hellwig
2024-06-10  2:49 ` Chaitanya Kulkarni
2024-06-18  5:32 ` Shinichiro Kawasaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).