public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Cui Bixuan <cuibixuan@huawei.com>
Cc: zhuyanpeng@huawei.com, ltp-list@lists.sourceforge.net,
	zhanyongming@huawei.com
Subject: Re: [LTP] [PATCH 1/5] iptables/iptables_tests.sh: Add test cases for iptables -L
Date: Tue, 9 Jun 2015 15:38:53 +0200	[thread overview]
Message-ID: <20150609133853.GC27378@rei.suse.de> (raw)
In-Reply-To: <1432688360-179350-1-git-send-email-cuibixuan@huawei.com>

> +	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
chrubis@suse.cz

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

      parent reply	other threads:[~2015-06-09 13:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27  0:59 [LTP] [PATCH 1/5] iptables/iptables_tests.sh: Add test cases for iptables -L Cui Bixuan
2015-05-27  1:01 ` [LTP] [PATCH 2/5] iptables/iptables_tests.sh: Add new testcases for iptables -c Cui Bixuan
2015-06-09 14:01   ` Cyril Hrubis
2015-05-27  1:02 ` [LTP] [PATCH 3/5] iptables/iptables_tests.sh: Add new testcases for iptables -o Cui Bixuan
2015-06-09 14:13   ` Cyril Hrubis
2015-06-09 14:17   ` Cyril Hrubis
2015-05-27  1:03 ` [LTP] [PATCH 4/5] iptables/iptables_tests.sh: Add new testcases for iptables -N/E Cui Bixuan
2015-05-27  1:04 ` [LTP] [PATCH 5/5] iptables/iptables_tests.sh: Add new testcases for iptables -R Cui Bixuan
2015-06-09 13:33 ` [LTP] [PATCH 1/5] iptables/iptables_tests.sh: Add test cases for iptables -L Cyril Hrubis
2015-06-09 13:38 ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150609133853.GC27378@rei.suse.de \
    --to=chrubis@suse.cz \
    --cc=cuibixuan@huawei.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=zhanyongming@huawei.com \
    --cc=zhuyanpeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox