[LTP] [PATCH 1/1] tst_test.sh: Add test cmd helper tst_test_cmds()
Petr Vorel
pvorel@suse.cz
Mon Apr 9 20:52:59 CEST 2018
Hi,
...
> > +'tst_test_cmds()' can be used for requirements just for a particular test
> > +as it doesn't exit. Supposed usage is:
> ^
> Expected
> Also we really should say that the call will issue TCONF here, because
> it's not clear that it would.
...
> > +tst_cmd_available()
> > +{
> > + if type command > /dev/null 2>&1; then
> > + command -v $1 > /dev/null 2>&1 || return 1
> > + else
> > + which $1 > /dev/null 2>&1 || return 1
> > + fi
> > +}
> We are falling back to which if command is not available here?
> Are you aware of any shell that is lacking command?
Busybox configured with CONFIG_WHICH=n (but default is 'y') => corner case.
> Also we should probably add return 0 at the end of the function, as it
> is the code is correct, since the return value would be return value of
> the last executed line, which is guaranteed to be 0 because of the
> || return 1 but it's kind of confusing to omit it.
Sure, I'll do. (I've learned to avoid 'return 0' from test_net.sh, but it can be
dangerous).
Kind regards,
Petr
More information about the ltp
mailing list