[Toybox] [PATCH] Add ASAN=1 to the build system.

enh enh at google.com
Thu Jul 18 19:02:54 PDT 2019


Just use `ASAN=1 make test_grep` or whatever.

You'll probably want to set $ASAN_SYMBOLIZER_PATH to point to
llvm-symbolizer, but Debian makes that annoying by calling the
symbolizer /usr/bin/llvm-symbolizer-4.0 or whatever, and ASan refuses to
use it:

  ==43370==ERROR: External symbolizer path is set to
  '/usr/bin/llvm-symbolizer-4.0' which isn't a known symbolizer. Please
  set the path to the llvm-symbolizer binary or other known tool.

My usual workaround for this is to drop an llvm-symbolizer symlink in
the current directory, and I'm happy to automate that in the script to
make it require no knowledge of any of this nonsense, but haven't done
so in this initial patch.

This patch also fixes the -Wstring-plus-int check, because ASan requires
clang, and clang defaults to having that warning on, so things get quite
noisy.

I've also fixed (and modernized) the "are we root?" check in the
hostname test, found when I manually ran through all the existing tests
checking that we don't have any other memory issues covered by existing
tests. I wasn't expecting to find any, because the HWASan build should
have found them already, but you never know...

I tested that this is actually working by reverting the grep fix and
running `ASAN=1 make test_grep`.
---
 scripts/genconfig.sh |  2 +-
 scripts/make.sh      | 10 ++++++++++
 tests/hostname.test  |  8 +-------
 3 files changed, 12 insertions(+), 8 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-ASAN-1-to-the-build-system.patch
Type: text/x-patch
Size: 3404 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20190718/823a571a/attachment-0002.bin>


More information about the Toybox mailing list