Re: [PATCH] xfstests: print missing utility name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 12, 2013 at 04:02:19PM +0200, Lukáš Czerner wrote:
> 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().
> 
> Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx>
> ---
>  common/rc | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/common/rc b/common/rc
> index fe6bbfc..984cef1 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -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.

-- 
Dave Chinner
david@xxxxxxxxxxxxx

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs





[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux