xfs
[Top] [All Lists]

Re: [PATCH] xfstests: print missing utility name

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH] xfstests: print missing utility name
From: Lukáš Czerner <lczerner@xxxxxxxxxx>
Date: Fri, 14 Jun 2013 16:08:41 +0200 (CEST)
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20130613025350.GJ29338@dastard>
References: <alpine.LFD.2.00.1306121558030.14273@xxxxxxxxxxxxxxxxxxxxx> <20130613025350.GJ29338@dastard>
User-agent: Alpine 2.00 (LFD 1167 2008-08-23)
On Thu, 13 Jun 2013, Dave Chinner wrote:

> Date: Thu, 13 Jun 2013 12:53:50 +1000
> From: Dave Chinner <david@xxxxxxxxxxxxx>
> To: LukÃÅ Czerner <lczerner@xxxxxxxxxx>
> Cc: xfs-oss <xfs@xxxxxxxxxxx>
> Subject: Re: [PATCH] xfstests: print missing utility name
> 
> 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.

Fair enough.

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