public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] tst_net.sh: Print output on unexpected PASS/FAIL
Date: Wed, 20 May 2020 22:25:25 +0800	[thread overview]
Message-ID: <5EC53DD5.9000506@cn.fujitsu.com> (raw)
In-Reply-To: <20200518211514.20445-1-pvorel@suse.cz>

Hi Petr,

I tested the patchset and it also looks good to me.
BTW: These outputs are useful to locate the issue.

Reviewed-by: Xiao Yang <yangx.jy@cn.fujitsu.com>

Best Regards,
Xiao Yang
On 2020/5/19 5:15, Petr Vorel wrote:
> This helps debugging.
>
> Use $TMPDIR and PID to guarantee writable directory and unique file
> without the need to require TST_NEEDS_TMPDIR=1.
>
> Signed-off-by: Petr Vorel<pvorel@suse.cz>
> ---
>   testcases/lib/tst_net.sh | 14 ++++++++++++--
>   1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
> index 011b62267..bfed4a44d 100644
> --- a/testcases/lib/tst_net.sh
> +++ b/testcases/lib/tst_net.sh
> @@ -250,22 +250,32 @@ tst_net_run()
>
>   EXPECT_RHOST_PASS()
>   {
> -	tst_rhost_run -c "$*">  /dev/null
> +	local log="$TMPDIR/log.$$"
> +
> +	tst_rhost_run -c "$*">  $log
>   	if [ $? -eq 0 ]; then
>   		tst_res_ TPASS "$* passed as expected"
>   	else
>   		tst_res_ TFAIL "$* failed unexpectedly"
> +		cat $log
>   	fi
> +
> +	rm -f $log
>   }
>
>   EXPECT_RHOST_FAIL()
>   {
> -	tst_rhost_run -c "$* 2>  /dev/null"
> +	local log="$TMPDIR/log.$$"
> +
> +	tst_rhost_run -c "$*">  $log
>   	if [ $? -ne 0 ]; then
>   		tst_res_ TPASS "$* failed as expected"
>   	else
>   		tst_res_ TFAIL "$* passed unexpectedly"
> +		cat $log
>   	fi
> +
> +	rm -f $log
>   }
>
>   # Get test interface names for local/remote host.




  parent reply	other threads:[~2020-05-20 14:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 21:15 [LTP] [PATCH 1/2] tst_net.sh: Print output on unexpected PASS/FAIL Petr Vorel
2020-05-18 21:15 ` [LTP] [PATCH 2/2] rpc_test.sh: Print used TI-RPC implementation Petr Vorel
2020-05-20 13:39   ` Alexey Kodanev
2020-05-20 13:39 ` [LTP] [PATCH 1/2] tst_net.sh: Print output on unexpected PASS/FAIL Alexey Kodanev
2020-05-20 14:25 ` Xiao Yang [this message]
2020-05-20 14:44   ` Petr Vorel

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=5EC53DD5.9000506@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --cc=ltp@lists.linux.it \
    /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