xfs
[Top] [All Lists]

Re: [PATCH] xfstests: print missing utility name

To: LukÃÅ Czerner <lczerner@xxxxxxxxxx>
Subject: Re: [PATCH] xfstests: print missing utility name
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 13 Jun 2013 12:53:50 +1000
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <alpine.LFD.2.00.1306121558030.14273@xxxxxxxxxxxxxxxxxxxxx>
References: <alpine.LFD.2.00.1306121558030.14273@xxxxxxxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
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

<Prev in Thread] Current Thread [Next in Thread>