From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] test.sh and ROD redirection
Date: Fri, 22 Jan 2016 12:15:38 +0300 [thread overview]
Message-ID: <56A1F33A.4000807@oracle.com> (raw)
In-Reply-To: <20160121135150.GA18731@rei.lan>
Hi,
On 01/21/2016 04:51 PM, Cyril Hrubis wrote:
> Hi!
> As I've been doing last minute fixes to shell testcases I've stambled
> upon this problem. We have a couple of places that do:
>
> ROD echo foo > bar
>
> And while this works fine if the command executes successfully it writes
> the error message to the file bar on failure as well (since the part
> that gets to the ROD as $@ is the 'echo foo' while the '> bar' is parsed
> by the shell.
>
> One solution would be redirecting the messages from tst_* to stderr, so
> we would be able to at least see the error message, but this wouldn't
> catch errors when we cannot write to the 'bar' (since echo foo would
> executed successfully anyway).
This won't work in case of simple file creation: ROD >file. Quotation
marks seem to
help in this case with ROD.
./testcases/network/nfs/nfs_stress/nfs03: ROD >file$j$k
can be changed to ROD ">file$j$k"
> Another solution would be to create ROD_ECHO and ROD_CAT and change ROD
> to abort if anybody tries to use it with these two. Which solves our
> usage pattern but this is clumsy and still broken as anyone can redirect
> output from ROD anyway.
Could be just one ROD_RED that accepts parameters in this way: 1st for
exec and
the others to set after '>' redirection.
ROD_RED()
{
$1 > ${@:2}
if [ $? -ne 0 ]; then
....
}
ROD_RED "echo 0" "file"
Best regards,
Alexey
>
> Is there a elegant solution to this problem that I'm missing?
next prev parent reply other threads:[~2016-01-22 9:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-21 13:51 [LTP] test.sh and ROD redirection Cyril Hrubis
2016-01-22 9:15 ` Alexey Kodanev [this message]
2016-01-25 11:16 ` Cyril Hrubis
2016-01-25 13:45 ` Cyril Hrubis
2016-01-25 16:26 ` Alexey Kodanev
2016-01-25 16:41 ` Cyril Hrubis
2016-01-25 17:18 ` Cyril Hrubis
2016-01-25 17:51 ` Alexey Kodanev
2016-01-25 18:07 ` Cyril Hrubis
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=56A1F33A.4000807@oracle.com \
--to=alexey.kodanev@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.