Skip to contentSkip to conversation

xfstests: print missing utility name

PATCH In review Lukáš Czerner 2 participants 3 messages Jun 12, 2013 – Jun 14, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: print missing utility name

Currently when the utility such as fio or dmsetup is missing user does not get the information about the utility name which is actually missing. Fix it by providing second argument to the _require_command().

---
 common/rc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
common/rc +3 -2
index fe6bbfc..984cef1 100644
@@ -1054,6 +1054,7 @@ _require_realtime()
 _require_command()
 {
     [ -n "$1" ] && _cmd="$1" || _cmd="$2"
+    [ -z $_cmd ] && _cmd="<fill utility name>"
     [ -n "$1" -a -x "$1" ] || _notrun "$_cmd utility required, skipped this test"
 }
 
@@ -1061,7 +1062,7 @@ _require_command()
 #
 _require_dm_flakey()
 {
-    _require_command $DMSETUP_PROG
+    _require_command $DMSETUP_PROG dmsetup
 
     modprobe dm-flakey >/dev/null 2>&1
     $DMSETUP_PROG targets | grep flakey >/dev/null 2>&1
@@ -2036,7 +2037,7 @@ _require_fio()
 {
 	job=$1
 
-	_require_command $FIO_PROG
+	_require_command $FIO_PROG fio
 	if [ -z "$1" ]; then
 		return 1;
 	fi
Signature · 6 lines
1.8.2.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 14 lines · Lukáš Czerner

Currently when the utility such as fio or dmsetup is missing user does not get the information about the utility name which is actually missing. Fix it by providing second argument to the _require_command().

---
 common/rc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
common/rc +0 -0
index fe6bbfc..984cef1 100644

common/rc _require_realtime() · line 1057

Quoted 4 lines
common/rc +1 -0
@@ -1054,6 +1054,7 @@ _require_realtime()
 _require_command()
 {
     [ -n "$1" ] && _cmd="$1" || _cmd="$2"
+    [ -z $_cmd ] && _cmd="<fill utility name>"

The problem here is that the command will be empty if it doesn't exist, so it's difficult to tell if one or two parameters is valid.

So, I'd suggest that _require_command should be changed to:

_require_command()

{
	_name=$1
	_cmd=$2

	[ $# -ge 1 ] || _fatal "Brainfart! What command is required?"
	[ -n $_cmd -a -x $_cmd ] || _notrun "$_name not found, skipping test."
}

And all the callers have their parameters swapped to avoid this confusion about what exists and what doesn't....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw
Quoted 41 lines · Dave Chinner

Date: Thu, 13 Jun 2013 12:53:50 +1000
From: Dave Chinner <[email protected]>
To: Lukáš Czerner <[email protected]>
Cc: xfs-oss <[email protected]>
Subject: Re: [PATCH] xfstests: print missing utility name

Quoted 14 lines · Lukáš Czerner

Currently when the utility such as fio or dmsetup is missing user does not get the information about the utility name which is actually missing. Fix it by providing second argument to the _require_command().

---
 common/rc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
common/rc +0 -0
index fe6bbfc..984cef1 100644

common/rc _require_realtime() · line 1057

Quoted 4 lines
common/rc +1 -0
@@ -1054,6 +1054,7 @@ _require_realtime()
 _require_command()
 {
     [ -n "$1" ] && _cmd="$1" || _cmd="$2"
+    [ -z $_cmd ] && _cmd="<fill utility name>"

The problem here is that the command will be empty if it doesn't exist, so it's difficult to tell if one or two parameters is valid.

So, I'd suggest that _require_command should be changed to:

_require_command()

{
	_name=$1
	_cmd=$2

	[ $# -ge 1 ] || _fatal "Brainfart! What command is required?"
	[ -n $_cmd -a -x $_cmd ] || _notrun "$_name not found, skipping test."
}
Quoted 6 lines

And all the callers have their parameters swapped to avoid this confusion about what exists and what doesn't....

Cheers,

Dave.

Fair enough.

-Lukas

Quoted 2 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs