[Toybox] make tests

Rob Landley rob at landley.net
Thu Dec 27 12:14:52 PST 2018


On 12/27/18 12:36 PM, enh wrote:
> what Linux is that? it's reproduceable for me on my two debian
> testing-based work machines and my personal xubuntu 18.04. (that's
> bash 4.4.12 and 4.4.19.)

I think my laptop is still running ubuntu 14.04. (Last non-systemd version.) I
downloaded a devuan install iso but haven't inflicted it upon anything yet...

The shell is bash 4.3.11.

> seems like the `continue` here isn't working:
> 
> if [ "$(id -u)" -ne 0 ]
> then
>   echo "$SHOWSKIP: chattr (not root)"
>   continue 2>/dev/null
>   exit
> fi
> 
> if i comment out the `exit`, all the chattr tests run regardless.

Which says the continue is falling through. (Try removing the 2>/dev/null to see
why?)

If we're not in a loop, continue should throw an error, then fall through to the
exit. (That's what it does here...) You don't want to exit out of a loop because
the loop will stop, but continue's a noisy NOP if you're not in a loop...

Did bash grow a bug where redirecting stderr of continue breaks?

> does `continue` not have an "enclosing" loop if there's a function
> call like do_test in between? doesn't explain why this works for you
> though unless you have a version of bash that behaves differently
> here...

It used to be called from two different contexts, one with a loop one without a
loop. That's why there's to ways to exit out of it.

But it looks like scripts/test.sh is always calling it in a loop now, whether
you specify things on the command line or not? Because I taught it to
"scripts/test.sh sed ls". So it should just have the continue now, I think?

But the continue's what's failing for you...? (I haz a confused.)

> (i also notice that i get a `cp: cannot stat 'toybox': No such file or
> directory` if i do `make tests` without the `make` before it.)

Because it's testing the currently built toybox. (If you TEST_HOST=1 it doesn't
need to build toybox, but teaching make about that was nonobvious to me. A use
case I had in mind from the start was running the tests on an arbitrary host
system, including mkroot and android and so on. That way I could compare ubuntu,
busybox, and toybox behavior in the same test suite...)

Rob



More information about the Toybox mailing list