> +     local cmd="iptables -L -t raw"
> +     tst_resm TINFO "$cmd will list all rules in table raw."
> +     $cmd > tst_iptables.out 2>&1

Why do we do this indirectly via the cmd variable?

> +     if [ $? -ne 0 ]; then
> +             tst_resm TFAIL "$cmd failed to list rules."
> +             cat tst_iptables.out
> +             return
> +     else

You do return before the else so there is no need for the else branch.

> +             chaincnt=$(grep -c Chain tst_iptables.out)
> +             if [ $chaincnt -lt 2 ]; then
> +                     tst_resm TFAIL "$cmd failed to list rules."
> +                     cat tst_iptables.out
> +             else
> +                     tst_resm TINFO "$cmd lists rules."

It would be better to print PASS here.

> +             fi
> +     fi
> +
> +     local cmd="iptables -L -t security"
> +     tst_resm TINFO "$cmd will list all rules in table security."
> +     $cmd > tst_iptables.out 2>&1
> +     if [ $? -ne 0 ]; then
> +             tst_resm TFAIL "$cmd failed to list rules."
> +             cat tst_iptables.out
> +             return
> +     else
> +             chaincnt=$(grep -c Chain tst_iptables.out)
> +             if [ $chaincnt -lt 3 ]; then
> +                     tst_resm TFAIL "$cmd failed to list rules."
> +                     cat tst_iptables.out
> +             else
> +                     tst_resm TINFO "$cmd lists rules."

And to print PASS here.

> +             fi
> +     fi
> +
>       tst_resm TPASS "iptables -L lists rules."

And remove this line.

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

-- 
Cyril Hrubis
chru...@suse.cz

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

Reply via email to