[PATCH] xfstests: print missing utility name
Lukáš Czerner
lczerner at redhat.com
Fri Jun 14 09:08:41 CDT 2013
On Thu, 13 Jun 2013, Dave Chinner wrote:
> Date: Thu, 13 Jun 2013 12:53:50 +1000
> From: Dave Chinner <david at fromorbit.com>
> To: Lukáš Czerner <lczerner at redhat.com>
> Cc: xfs-oss <xfs at oss.sgi.com>
> 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 at redhat.com>
> > ---
> > 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
>
>
More information about the xfs
mailing list