public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check
Date: Mon, 31 Oct 2016 10:28:25 +0100	[thread overview]
Message-ID: <20161031092825.GB30590@rei.lan> (raw)
In-Reply-To: <ed067bc2-ab8e-3b7e-476c-d24e39560700@redhat.com>

Hi!
> > +tst_kvercmp 2 6 35
> > +if [ $? -eq 0 ]; then
> 
> Just out of curiosity - I see this used on more places, but can't
> understand why would you use this instead of simply
> 
>   if tst_kvercmp 2 6 35; then
> 
> Any reason behind that? Am I missing a test writing rule?

The most probable reason would be that the tst_kvercmp actually returns
ternary result (older than, equal or newer is mapped to 0, 1, 2) so if
you want to anything else than "kernel is older" check you have to
examine the $?.

Maybe I sould write a new tst_kvercmp for the new shell library that
would work similar to the test shell buildin so that we can do something
as:

if tst_kvercmp -nq "2.6.35" -o "3.8"; then
	...
fi

where the modifiers would stand for:

n  newer
nq newer or equal
o  older
oq older or equal

-- 
Cyril Hrubis
chrubis@suse.cz

  parent reply	other threads:[~2016-10-31  9:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-30  8:01 [LTP] [PATCH] containers/netns/netns_sysfs.sh: add kernel version check Guangwen Feng
2016-10-25  7:24 ` Guangwen Feng
2016-10-26 18:17 ` Jiri Jaburek
2016-10-27  7:55   ` Guangwen Feng
2016-10-31  9:28   ` Cyril Hrubis [this message]
2016-10-31 14:05     ` Jiri Jaburek
2016-10-31 14:36       ` Cyril Hrubis
2016-11-01 14:30       ` Cyril Hrubis
2016-10-31  9:31 ` Cyril Hrubis

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=20161031092825.GB30590@rei.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /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