Hi!
> +test07()
> +{
> + local logcnt=0
> + tst_resm TINFO "iptables -c test."
> +
> + iptables -A INPUT -s 127.0.0.1 -j DROP -c 10 500 \
> + > tst_iptables.out 2>&1
> + if [ $? -ne 0 ]; then
> + tst_resm TFAIL "iptables command failed to append new rule."
> + cat tst_iptables.out
> + return
> + fi
> +
> + logcnt=`iptables -L -v |grep localhost |awk '{print $2}'` \
> + > tst_iptables.out 2>&1
grep can do regular expressions as well, why can't we
match this with single grep command?
i.e.
if iptables -L -v |grep -q ".*10.*500.*localhost.*"; then
PASSED
else
FAILED
fi
> + if [ $logcnt -ne 500 ]; then
> + tst_resm TFAIL "iptables -c 10 500 failed."
> + cat tst_iptables.err
^
Where is this file created?
> + return
> + fi
> +
> + logcnt=`iptables -L -v |grep localhost |awk '{print $1}'` \
> + > tst_iptables.out 2>&1
> + if [ $logcnt -ne 10 ]; then
> + tst_resm TFAIL "iptables -c 10 500 failed."
> + cat tst_iptables.err
> + return
> + fi
> +
> + tst_resm TINFO "Deleting rule."
> + iptables -D INPUT 1 > tst_iptables.out 2>&1
> + if [ $? -ne 0 ]; then
> + tst_resm TFAIL "iptables did not remove the rule."
This should rather be TBROK, but that is minor.
> + cat tst_iptables.out
> + return
> + fi
> +
> + tst_resm TPASS "iptables -c test succeed."
> +}
> +
> init
> TST_CLEANUP=cleanup
>
> @@ -419,5 +459,6 @@ test03
> test04
> test05
> test06
> +test07
>
> tst_exit
> --
> 1.6.0.2 .
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Ltp-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ltp-list
--
Cyril Hrubis
[email protected]
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list