From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] netns_helper: Make iproute version check work correctly
Date: Wed, 10 Feb 2021 09:07:58 +0100 [thread overview]
Message-ID: <YCOUXtwBk0ZPjDL3@pevik> (raw)
In-Reply-To: <1612772078-29651-1-git-send-email-zhufy.jy@cn.fujitsu.com>
Hi Zhu,
thank you for working on this. I also started to work on this before LTP
release, trying to fix it in the API, because there are more tests affected by
this (there is also mc_cmds.sh).
My WIP is to create tst_iproute_version.c, which would be used by shell and C tests.
I actually wanted to go little bit further to have general C helper for getting
version (but that'd have to wait after this is fixed). But as you were faster
I'll let you to finish it.
...
> diff --git a/testcases/kernel/containers/netns/netns_helper.sh b/testcases/kernel/containers/netns/netns_helper.sh
> index a5b77a0..bec43ac 100755
> --- a/testcases/kernel/containers/netns/netns_helper.sh
> +++ b/testcases/kernel/containers/netns/netns_helper.sh
> @@ -50,6 +50,15 @@ tst_check_iproute()
> local cur_ipver="$(ip -V)"
> local spe_ipver="$1"
> + echo $cur_ipver | grep "ip utility, iproute2-ss" > /dev/null
> + ret1=$?
> + echo $cur_ipver | grep "ip utility, iproute2-" > /dev/null
> + ret2=$?
> +
> + if [ $ret1 -ne 0 -a $ret2 -eq 0 ]; then
> + return
> + fi
> +
FYI my shell version.
Kind regards,
Petr
--- testcases/kernel/containers/netns/netns_helper.sh
+++ testcases/kernel/containers/netns/netns_helper.sh
@@ -47,16 +47,21 @@ IFCONF_IN6_ARG=
tst_check_iproute()
{
- local cur_ipver="$(ip -V)"
- local spe_ipver="$1"
+ local current_ver="$(ip -V)"
+ local expected_ver="111010"
- cur_ipver=${cur_ipver##*s}
+ current_ver=${current_ver##*s}
- if [ -z "$cur_ipver" -o -z "$spe_ipver" ]; then
+ if [ -z "$current_ver" -o -z "$expected_ver" ]; then
tst_brk TBROK "failed to obtain valid iproute version"
fi
- if [ $cur_ipver -lt $spe_ipver ]; then
+ # new version scheme since v5.7.0-77-gb687d1067169
+ if echo "$current_ver" | grep -q 'iproute2-v\?[0-9]\+\.'; then
+ return
+ fi
+
+ if [ $current_ver -lt $expected_ver ]; then
tst_brk TCONF "too old iproute version"
fi
}
next prev parent reply other threads:[~2021-02-10 8:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-08 8:14 [LTP] [PATCH] netns_helper: Make iproute version check work correctly Feiyu Zhu
2021-02-09 14:56 ` Cyril Hrubis
2021-02-09 15:55 ` Cyril Hrubis
2021-02-10 8:07 ` Petr Vorel [this message]
2021-02-10 13:38 ` Petr Vorel
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=YCOUXtwBk0ZPjDL3@pevik \
--to=pvorel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.