On 06/12/2015 09:08 AM, Cui Bixuan wrote:
> Add cases in test01 for iptables -L -t raw/security
>
> Signed-off-by: Cui Bixuan <[email protected]>
> ---
> testcases/network/iptables/iptables_tests.sh | 18 ++++++++++++++++++
> 1 files changed, 18 insertions(+), 0 deletions(-)
>
> diff --git a/testcases/network/iptables/iptables_tests.sh
> b/testcases/network/iptables/iptables_tests.sh
> index ad426bf..5da5c94 100755
> --- a/testcases/network/iptables/iptables_tests.sh
> +++ b/testcases/network/iptables/iptables_tests.sh
> @@ -78,6 +78,24 @@ test01()
> tst_resm TINFO "iptables -L -t mangle lists rules."
> fi
>
> + iptables -L -t raw > tst_iptables.out 2>&1
> + if [ $? -ne 0 ]; then
> + tst_resm TFAIL "iptables -L -t raw failed to list rules."
> + cat tst_iptables.out
> + return
> + else
> + tst_resm TINFO "iptables -L -t raw lists rules."
> + fi
> +
> + iptables -L -t security > tst_iptables.out 2>&1
> + if [ $? -ne 0 ]; then
> + tst_resm TFAIL "iptables -L -t security failed to list rules."
> + cat tst_iptables.out
> + return
> + else
> + tst_resm TINFO "iptables -L -t security lists rules."
> + fi
> +
You don't need 'else' block here, it might be as follows:
if [ ... ]; then
...
return
fi
tst_resm TINFO ...
And if you have some common code as above, you could do it in the loop:
tables="raw security mangle ..."
for tbl in $tables; do
iptables -L -t $tbl
if [ $? -ne 0 ]; then
tst_rems TFAIL 'iptables -L -t $tbl failed'
return
fi
...
done
Thanks,
Alexey
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list