summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2019-05-14 11:25:07 +1200
committerAndrew Bartlett <abartlet@samba.org>2019-05-14 07:20:28 +0000
commitb1a32dd7f50ed0aee3d0eea5a124cb8ddfa417ad (patch)
tree4447f92b73f3c345ffc0cb299347091772a7be04 /buildtools
parentb0cc6d217485c317b2138347216fac5d74684328 (diff)
downloadsamba-b1a32dd7f50ed0aee3d0eea5a124cb8ddfa417ad.tar.gz
selftest: enable undefined behaviour sanitizer
Add a --undefined-sanitizer option to configure, this causes the tests to be run with the undefined behaviout sanitizer enabled. Errors can be suppressed by adding entries to selftest/ubsan.supp Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue May 14 07:20:28 UTC 2019 on sn-devel-184
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/samba_autoconf.py9
-rw-r--r--buildtools/wafsamba/wscript5
2 files changed, 13 insertions, 1 deletions
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 0dbfd54393f..be179d8b29b 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -793,10 +793,17 @@ int main(void) {
if Options.options.pedantic:
conf.ADD_CFLAGS('-W', testflags=True)
+ if (Options.options.address_sanitizer or
+ Options.options.undefined_sanitizer):
+ conf.ADD_CFLAGS('-fno-omit-frame-pointer -O1', testflags=True)
if Options.options.address_sanitizer:
- conf.ADD_CFLAGS('-fno-omit-frame-pointer -O1 -fsanitize=address', testflags=True)
+ conf.ADD_CFLAGS('-fsanitize=address', testflags=True)
conf.ADD_LDFLAGS('-fsanitize=address', testflags=True)
conf.env['ADDRESS_SANITIZER'] = True
+ if Options.options.undefined_sanitizer:
+ conf.ADD_CFLAGS('-fsanitize=undefined', testflags=True)
+ conf.ADD_LDFLAGS('-fsanitize=undefined', testflags=True)
+ conf.env['UNDEFINED_SANITIZER'] = True
# Let people pass an additional ADDITIONAL_{CFLAGS,LDFLAGS}
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 2e14a326cb8..8014716e64e 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -128,6 +128,11 @@ def options(opt):
gr.add_option('--address-sanitizer',
help=("Enable address sanitizer compile and linker flags"),
action="store_true", dest='address_sanitizer', default=False)
+ gr.add_option('--undefined-sanitizer',
+ help=("Enable undefined behaviour sanitizer compile and linker flags"),
+ action="store_true",
+ dest='undefined_sanitizer',
+ default=False)
gr.add_option('--abi-check',
help=("Check ABI signatures for libraries"),