diff options
author | Andrew Bartlett <abartlet@samba.org> | 2018-05-03 15:47:45 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-05-03 08:17:44 +0200 |
commit | 61244998048111e2100e7fb535b3c9338853cbed (patch) | |
tree | 7cb8d87f2521f9daa5b4dd4cb44cfa685fe41c15 /selftest/wscript | |
parent | 7e091e505156381e385235ab4518b4d133a98497 (diff) | |
download | samba-61244998048111e2100e7fb535b3c9338853cbed.tar.gz |
selftest: Allow make test to run with --address-sanitizer
Recent GCC versions enforce that the library must be in LD_PRELOAD if linked to a plugin
(like a python module).
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'selftest/wscript')
-rw-r--r-- | selftest/wscript | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/selftest/wscript b/selftest/wscript index 8264d96c8a2..6a6dcb5c644 100644 --- a/selftest/wscript +++ b/selftest/wscript @@ -249,9 +249,32 @@ def cmd_testonly(opt): # GSS_KRB5_CRED_NO_CI_FLAGS_X env.OPTIONS += " --exclude=${srcdir}/selftest/skip.no-GSS_KRB5_CRED_NO_CI_FLAGS_X" + if env.ADDRESS_SANITIZER: + # We try to find the correct libasan automatically + libasan = Utils.cmd_output('ldd bin/texpect | grep libasan| cut -f 3 -d \ ', + silent=True).strip() + + # Have the selftest.pl LD_PRELOAD libasan in the right spot + env.OPTIONS += " --asan_so_path=" + libasan + subunit_cache = None # We use the full path rather than relative path to avoid problems on some platforms (ie. solaris 8). env.CORE_COMMAND = '${PERL} ${srcdir}/selftest/selftest.pl --target=${SELFTEST_TARGET} --prefix=${SELFTEST_PREFIX} --srcdir=${srcdir} --exclude=${srcdir}/selftest/skip ${TESTLISTS} ${OPTIONS} ${TESTS}' + + if env.ADDRESS_SANITIZER: + # For now we cannot run with leak detection + no_leak_check = "ASAN_OPTIONS=detect_leaks=0" + env.CORE_COMMAND = no_leak_check + " " + env.CORE_COMMAND + + # We need to have the subunit filter and formatter preload + # libasan otherwise the tests fail at startup. + # + # Also, we do not care about leaks in python + + asan_envs = no_leak_check + " LD_PRELOAD=" + libasan + ' ' + env.FILTER_OPTIONS = asan_envs + env.FILTER_OPTIONS + env.SUBUNIT_FORMATTER = asan_envs + env.SUBUNIT_FORMATTER + if Options.options.LIST: cmd = '${CORE_COMMAND} --list' else: @@ -263,6 +286,7 @@ def cmd_testonly(opt): cmd += ' | tee %s | ${FORMAT_TEST_OUTPUT}' % subunit_cache else: cmd += ' | ${FILTER_OPTIONS}' + runcmd = EXPAND_VARIABLES(opt, cmd) print("test: running %s" % runcmd) |