public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Lukáš Czerner" <lczerner@redhat.com>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfstests: print missing utility name
Date: Thu, 13 Jun 2013 12:53:50 +1000	[thread overview]
Message-ID: <20130613025350.GJ29338@dastard> (raw)
In-Reply-To: <alpine.LFD.2.00.1306121558030.14273@localhost.localdomain>

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@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.

-- 
Dave Chinner
david@fromorbit.com

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

  reply	other threads:[~2013-06-13  2:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12 14:02 [PATCH] xfstests: print missing utility name Lukáš Czerner
2013-06-13  2:53 ` Dave Chinner [this message]
2013-06-14 14:08   ` Lukáš Czerner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130613025350.GJ29338@dastard \
    --to=david@fromorbit.com \
    --cc=lczerner@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox