Add new testcase for testing 'iptables -N/E'

Signed-off-by: Cui Bixuan <cuibix...@huawei.com>
---
 testcases/network/iptables/iptables_tests.sh |   46 +++++++++++++++++++++++++-
 1 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/testcases/network/iptables/iptables_tests.sh 
b/testcases/network/iptables/iptables_tests.sh
index a464240..a2128c2 100755
--- a/testcases/network/iptables/iptables_tests.sh
+++ b/testcases/network/iptables/iptables_tests.sh
@@ -22,7 +22,7 @@
 #                                     <hubertnospa...@symbio.com.tw>

 export TCID="iptables"
-export TST_TOTAL=8
+export TST_TOTAL=9

 . test.sh

@@ -501,6 +501,49 @@ test08()
         tst_resm TPASS "iptables can DROP packets from particular network 
card."
 }

+test09()
+{
+        tst_resm TINFO "iptables -N/E test."
+
+        iptables -N chains > tst_iptables.out 2>&1
+        if [ $? -ne 0 ]; then
+                tst_resm TFAIL "iptables command failed to append new chains."
+                cat tst_iptables.out
+                return
+        fi
+
+        iptables -L -v |grep chains > tst_iptables.out 2>&1
+        if [ $? -ne 0 ]; then
+                tst_resm TFAIL "iptables append new chains failed."
+                cat tst_iptables.err
+                return
+        fi
+
+       iptables -E chains newchains > tst_iptables.out 2>&1
+        if [ $? -ne 0 ]; then
+                tst_resm TFAIL "iptables command failed to change chains to" \
+                       "newchains."
+                cat tst_iptables.out
+                return
+        fi
+
+       iptables -L -v |grep newchains > tst_iptables.out 2>&1
+        if [ $? -ne 0 ]; then
+                tst_resm TFAIL "iptables change chains failed."
+                cat tst_iptables.err
+                return
+        fi
+
+        iptables -X > tst_iptables.out 2>&1
+        if [ $? -ne 0 ]; then
+                tst_resm TFAIL "iptables did not remove the rule."
+                cat tst_iptables.out
+                return
+        fi
+
+        tst_resm TPASS "iptables -N/E test succeed."
+}
+
 init
 TST_CLEANUP=cleanup

@@ -512,5 +555,6 @@ test05
 test06
 test07
 test08
+test09

 tst_exit
-- 
1.6.0.2 .


------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to