On 2015/6/9 21:38, Cyril Hrubis wrote:

> 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.
> 
I change "tst_resm TINFO" to "tst_resm TPASS" after "iptables -L -t ..."
in test01 and remove the TPASS at end of it.Then run the case and find the
print of test01:

iptables 1 TPASS : iptables -L -t filter lists rules.
iptables 2 TPASS : iptables -L -t nat lists rules.
iptables 3 TPASS : iptables -L -t mangle lists rules.
...

That leads to the numbers of test incorrect(TST_TOTAL=6, but print iptables 10).
So my patch v2 does not do it :-) .
>>  }
>>  
>> -- 
>> 1.6.0.2
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Ltp-list mailing list
>> Ltp-list@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
> 


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

Reply via email to