[Toybox] xargs

Rob Landley rob at landley.net
Tue Nov 19 21:32:47 PST 2019


On 11/19/19 10:16 PM, enh wrote:
> On Fri, Nov 15, 2019 at 5:56 PM Rob Landley <rob at landley.net> wrote:
>> Is there a "make airlock" style list of what darwin would need that's not in
>> defconfig yet? (Or needs fixing on darwin?)
> 
> it's kind of the opposite...
> 
> afaik toybox works fine on macOS. the AOSP build is currently using
> toybox on macOS in every case where we use toybox on linux. (modulo me
> getting a new prebuilt so i can switch back to toybox xargs(1) on the
> mac.)

Yay!

> what doesn't work is the tests. take the truncate(1) tests, say. afaik
> toybox truncate(1) works fine on macOS. but because the built-in
> stat(1) is junk, and the first lines of truncate.test are...
> 
>   SIZE='&& stat -c %s freep'
>   testing "0" "truncate -s 0 freep $SIZE" "0\n" "" ""
> 
> ...we "fail" the test with an error message about stat not having a -c option.
> 
> i think macOS would be better off if make test* just created a
> directory of symlinks to toybox and stuck that on the path.

It's got plumbing for that:

  PREFIX=$PWD/airlock make distclean defconfig toybox install_airlock
  PATH=$PWD/airlock # plus :$PATH if you like

But in theory when you do "make tests" every toybox command that's enabled in
the config already gets prepended to the $PATH for all tests, so each test is
using all the toybox commands you built (with fallback to host $PATH for any you
haven't built)?

I designed it that way from the start. Why isn't it working? (It only tests the
commands currently enabled in the .config: if you disable stat between the build
and the test it won't put that command in the $PATH. It's doing "make
install_flat" on scripts/test.sh line 20 which uses the config to get the list,
it doesn't try to run the ./toybox binary because cross compiling. But that's
intentional here: the commands you're TESTING are used in all tests, but the
ones you're NOT testing use the host versions even if you built them in the
toybox binary.)

> it's effectively how we're testing on Android, so i need to keep the tests
> passing on all-toybox anyway. (and it's not been much of an issue so
> far.)

Maybe install_airlock will fix scripts/test.sh on macos? It worked for me, but
I'm mostly just using it on Linux? Still, have you tried:

  PREFIX=$PWD/airlock make distclean defconfig toybox install_airlock
  PATH=$PWD/airlock:$PATH VERBOSE=nopass make tests

Rob



More information about the Toybox mailing list