[LTP] [PATCH v2 6/7] net/test: Add basic testing for tst_rhost_run

Petr Vorel pvorel@suse.cz
Mon Jul 20 19:36:06 CEST 2020


Hi Yang,

> > > Hi Petr,
> > > 1) Do you want to discard stderr as well? For example:
> > > -------------------------------------------------
> > > # which gre >/dev/null
> > > /usr/bin/which: no gre in
> > > (/opt/ltp/testcases/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin)
> > That's not needed because tst_rhost_run already redirect stderr to stdout.

> Hi Petr,

> I think you means tst_rhost_run -c 'which grep' >/dev/null rather than
> tst_rhost_run -c 'which grep > /dev/null'

> The current code just discard stdout, for example:

> -------------------------------------------------------

> [root@Fedora-30-workstation net]# ./tst_rhost_run.sh
> ...
> tst_rhost_run 1 TINFO: NETNS: ns_exec 3079 net,mnt sh -c " which gre >
> /dev/null || echo RTERR" 2>&1
> which: no gre in (./../../../../testcases/lib/:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/root/bin:/opt/ltp/testcases/bin)
I'm sorry, I accidentally tested on which version from debianutils which prints
also errors to stdout. which from GNU which (used in openSUSE/SLES, Fedora/RHEL)
prints errors to stderr => you're right stderr should be redirected.
On the other hand when not redirected, you can see PATH.


Kind regards,
Petr


More information about the ltp mailing list