[Toybox] [PATCH] Pass the parent make variables when invoking make in scripts/single.sh.
Rob Landley
rob at landley.net
Tue Mar 15 01:36:55 PDT 2016
On 03/12/2016 02:51 AM, Andy Chu wrote:
> single.sh is called when you do 'make test_$COMMAND'. For example, you
> can now run tests under a Clang ASAN build like this:
>
> make CC=clang CFLAGS=-fsanitize=address test_sed
I generally do:
CC=clang CFLAGS=-fsanitize=address make test_sed
Exporting environment variables lets them be inherited by child
processes. Setting them on the make command line only sets them as make
variables, which are not exported by default. (That said, I manually
exported them because people keep doing that because make is horrible
and I have an entire rant on how horrible it is I'll spare you from for
now.)
You can also persistently set them in "configure", which is the shell
script snippet responsible for setting default values if the variables
are empty.
> Without this patch, the binary will fail with runtime errors.
I don't understand what this patch does: make exported the variables it
had which should have passed them to its scripts/single.sh child
process, and then that child process called make which should have
inherited the exported variables...?
I just did a "make LDFLAGS=--static ls" and "file ls" said it was static...?
> (ASAN and afl-fuzz sort of go together, since you can find inputs that
> access uninitialized memory but don't necessarily crash the process.
> And ASAN is useful without afl-fuzz by just running tests with it.)
Understood. But under what environment is your patch needed? I just
tried it and it seemed to be working for me?
$ make CC=branmuffin ls
scripts/single.sh ls
ls:make[1]: Entering directory `/home/landley/toybox/clean2'
scripts/make.sh
Generate headers from toys/*/*.c...
generated/newtoys.h Library probe........
Make generated/config.h from .singleconfig.
generated/flags.h scripts/make.sh: line 177: branmuffin: command not found
scripts/make.sh: line 177: branmuffin: command not found
make[1]: *** [toybox] Error 1
make[1]: Leaving directory `/home/landley/toybox/clean2'
make: *** [ls] Error 1
Looks like it's getting passed through...?
> Andy
Rob
1458031015.0
More information about the Toybox
mailing list