On Wed, Oct 30, 2019 at 11:49 AM Andrew Ilijic <[email protected]> wrote: > > Thank you Jarno & enh, > > I ended up using the following: > ``` > testing "with -w - Fail if negative" \ > "$IN && ls -w -5 2> /dev/null ; echo \$? && $OUT" "1\n" "" "" > ``` > enh, I knew I needed to delay the evaluation of `$?` I just could not > remember or figure out how to do it. > > > cmd1 && cmd2 && echo success || echo epic fail > Jarno, I had forgotten that usage of the `&&` and `||` operators. I will use > it in the future. > > Let me know if the following should be its own thread. > > As someone who likes to see the specific exit value (because it's less > > ambiguous when you see it in a failure than "yes" or "ok" or > > whatever)... > I am with you enh. In this case, I wanted the error code because > GNU `ls` says the command can exit with { 0, 1, 2 }. > https://linux.die.net/man/1/ls > POSIX says exit status is { 0, >0 } > https://pubs.opengroup.org/onlinepubs/9699919799/ > In this case which specification wins?
they're both true, but the GNU ls is more specific :-) > enh, the other week you mentioned Android will not use the build if > there are failing tests. correct. that's why i'm a bit behind --- xargs is still failing. > Does the above apply to `TEST_HOST=1 > make tests`? If so, then I will rewrite the test. not at the moment, no, but you probably want `SKIP_HOST=1` before the affected `testing` (but on the same line so it doesn't apply to later instances)? or fix ls to behave like the host. see grep for a similar example. (or, generally, grep for `exitval`.) > ~Andrew _______________________________________________ Toybox mailing list [email protected] http://lists.landley.net/listinfo.cgi/toybox-landley.net
