Xiaoguang Wang <wangxg.f...@cn.fujitsu.com> wrote on 09/18/2014 08:31:16
AM:
> Xiaoguang Wang <wangxg.f...@cn.fujitsu.com>
> 09/18/2014 08:31 AM
>
> To
>
> <ltp-list@lists.sourceforge.net>
>
> cc
>
> Subject
>
> [LTP] [PATCH] runtest/containers: fix errors in netns_par_chld_ftp
> testcase that takes TCONF as TFAIL
>
> In test case 'testcases/kernel/containers/netns/
> netns_par_chld_ftp.sh', if iproute tools
> do not support setting network namespaces, child process will return
> TCONF, but parent
> process took this as TFAIL wrongly.
>
> So in testcases/lib/test.sh, we introduce tst_record_childstatus()'s
> shell version, please
> see doc/test-writing-guidelines.txt for detailed information this
> function, it helps to
> propagate child process result(child exit status) to the parent
> process correctly.
>
> In this patch, we fix this issue by using this function.
>
> Signed-off-by: Xiaoguang Wang <wangxg.f...@cn.fujitsu.com>
> ---
> .../kernel/containers/netns/netns_par_chld_ftp.sh | 8 ++------
> testcases/lib/test.sh | 19 ++++++++
> +++++++++++
> 2 files changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/testcases/kernel/containers/netns/netns_par_chld_ftp.sh
> b/testcases/kernel/containers/netns/netns_par_chld_ftp.sh
> index 9370a54..67b86bb 100755
> --- a/testcases/kernel/containers/netns/netns_par_chld_ftp.sh
> +++ b/testcases/kernel/containers/netns/netns_par_chld_ftp.sh
> @@ -40,12 +40,8 @@ if [ $? -ne 0 ]; then
> flag=1
> fi
>
> -netns_par_chld_ftp
> -if [ $? -eq 0 ]; then
> - tst_resm TPASS "netns_par_child_ftp"
> -else
> - tst_resm TFAIL "netns_par_child_ftp"
> -fi
> +netns_par_chld_ftp &
> +tst_record_childstatus $!
>
> if [ $flag -eq 1 ]; then
> stop_daemon vsftpd
> diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> index 5b9e576..0d16894 100644
> --- a/testcases/lib/test.sh
> +++ b/testcases/lib/test.sh
> @@ -66,6 +66,25 @@ tst_brkm()
> tst_exit
> }
>
> +tst_record_childstatus()
> +{
> + if [ $# -ne 1 ];then
> + tst_resm TWARN "child process id is not valid"
> + return
> + fi
> +
> + local child=$1
> + local ret=0
> +
> + wait $child
> + ret=$?
> + if [ $ret -eq 127 ];then
> + tst_resm TWARN "child process($child) does not exist"
> + return
> + fi
> + LTP_RET_VAL=$((LTP_RET_VAL|ret))
> +}
> +
> tst_require_root()
> {
> if [ "$(id -ru)" != 0 ]; then
> --
> 1.8.2.1
>
Patch looks good
>
>
------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
>
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list