[LTP] [PATCH 1/1] tst_test.sh: Add test cmd helper tst_test_cmds()

Petr Vorel pvorel@suse.cz
Mon Apr 9 20:44:59 CEST 2018


Hi Cyril,

> > > +		which $1 > /dev/null 2>&1 || return 1
> > Pedantic version would check $? for 127 (indicating which itself it's not found).
> > Probably worth of adding it.

> Are you sure?

> $ which foo
> ...
> $ echo $?
> 1

> Also:

> $ busybox which foo
> $ echo $?
> 1

Yes, exit code 1 is when 'which' command doesn't find command.
Exit code 127 at least some shells use when command not found (in this case when 'which'
command itself is not found.

$ busybox foo; echo $?
foo: applet not found
127

Missing which IMHO only the case of busybox build with CONFIG_WHICH=n (but default is 'y')
=> corner case. I understand if we want to ignore it.

(+ Android - at least old versions had 'toolbox' instead of busybox => we'd ignore this
Android it's special and currently not fully supported anyway.


Kind regards,
Petr


More information about the ltp mailing list