In iproute2 whose version is earlier than v3.0.0, ip
command doesn't support netns object. In this condition,
running three cases (netns_devices.sh, netns_devices2.sh
and netns_isolation.sh) will exit with TFAIL. It is not
suitable, so fix these cases' exit status with TCONF.

Signed-off-by: Xing Gu <gux.f...@cn.fujitsu.com>
---
 testcases/kernel/containers/netns/netns_devices.sh |  2 ++
 .../kernel/containers/netns/netns_devices2.sh      |  2 ++
 testcases/kernel/containers/netns/netns_helper.sh  | 39 ++++++++++++++++++++++
 .../kernel/containers/netns/netns_isolation.sh     |  2 ++
 4 files changed, 45 insertions(+)
 create mode 100755 testcases/kernel/containers/netns/netns_helper.sh

diff --git a/testcases/kernel/containers/netns/netns_devices.sh 
b/testcases/kernel/containers/netns/netns_devices.sh
index 7126267..750ffcc 100755
--- a/testcases/kernel/containers/netns/netns_devices.sh
+++ b/testcases/kernel/containers/netns/netns_devices.sh
@@ -29,6 +29,7 @@
 TCID=netns_devices
 TST_TOTAL=3
 . test.sh
+. netns_helper.sh
 IP0=192.168.0.1
 IP1=192.168.0.2
 
@@ -46,6 +47,7 @@ cleanup()
 # SETUP
 tst_require_root
 tst_check_cmds ip
+tst_check_iproute 111010
 TST_CLEANUP=cleanup
 
 # creates a new network namespace "myns0" (man 8 ip-netns)
diff --git a/testcases/kernel/containers/netns/netns_devices2.sh 
b/testcases/kernel/containers/netns/netns_devices2.sh
index f0d0651..8dfc6c6 100755
--- a/testcases/kernel/containers/netns/netns_devices2.sh
+++ b/testcases/kernel/containers/netns/netns_devices2.sh
@@ -29,6 +29,7 @@
 TCID=netns_devices2
 TST_TOTAL=3
 . test.sh
+. netns_helper.sh
 IP0=192.168.0.1
 IP1=192.168.0.2
 
@@ -46,6 +47,7 @@ cleanup()
 # SETUP
 tst_require_root
 tst_check_cmds ip ifconfig
+tst_check_iproute 111010
 TST_CLEANUP=cleanup
 
 # creates a new network namespace "myns0" (man 8 ip-netns)
diff --git a/testcases/kernel/containers/netns/netns_helper.sh 
b/testcases/kernel/containers/netns/netns_helper.sh
new file mode 100755
index 0000000..70415d2
--- /dev/null
+++ b/testcases/kernel/containers/netns/netns_helper.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# Copyright (c) Linux Test Project, 2014
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# This is a LTP shell test library for iproute.
+#
+
+. test.sh
+
+tst_check_iproute()
+{
+       local cur_ipver=`ip -V`
+       local spe_ipver=$1
+
+       cur_ipver=${cur_ipver##*s}
+
+       if [ -z $cur_ipver ] || [ -z $spe_ipver ]; then
+               tst_brkm TBROK "don't obtain valid iproute version"
+       fi
+
+       if [ $cur_ipver -lt $spe_ipver ]; then
+               tst_brkm TCONF \
+                       "The commands in iproute tools do not support required 
objects"
+       fi
+}
diff --git a/testcases/kernel/containers/netns/netns_isolation.sh 
b/testcases/kernel/containers/netns/netns_isolation.sh
index f1ddf2c..78dc081 100755
--- a/testcases/kernel/containers/netns/netns_isolation.sh
+++ b/testcases/kernel/containers/netns/netns_isolation.sh
@@ -24,6 +24,7 @@
 TCID=netns_isolation
 TST_TOTAL=3
 . test.sh
+. netns_helper.sh
 IP=192.168.0.2
 
 
@@ -40,6 +41,7 @@ cleanup()
 # SETUP
 tst_require_root
 tst_check_cmds ip
+tst_check_iproute 111010
 TST_CLEANUP=cleanup
 
 
-- 
1.9.3


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to