summaryrefslogtreecommitdiff
path: root/test/Makefile.am
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-08-29 20:06:00 +0100
committerSimon McVittie <smcv@collabora.com>2018-12-11 12:47:22 +0000
commit0c9f9432770596ec77a83f7a302c46108a651979 (patch)
tree2bee6d85809e5386abb7ae8656c98701a8ec04e6 /test/Makefile.am
parent64f94d3f5bc4e1229abc5a9ec7ae089b3b259719 (diff)
downloaddbus-0c9f9432770596ec77a83f7a302c46108a651979.tar.gz
build: Add a way to set CFLAGS for AddressSanitizer etc.
We don't want to set these globally via the normal CFLAGS, because if we did, AddressSanitizer would catch test-segfault deliberately segfaulting, and "helpfully" turn it into exit status 1, which in turn makes our test fail because it asserts that the segfault is reported as a segfault. A typical use with gcc as compiler, on a reasonably recent Debian, would be: ./configure SANITIZE_CFLAGS="-fsanitize=address -fsanitize=undefined -fPIE -pie" Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'test/Makefile.am')
-rw-r--r--test/Makefile.am7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 2f649837..b8df15ac 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -23,6 +23,7 @@ AM_LDFLAGS = @R_DYNAMIC_LDFLAG@
AM_CFLAGS = \
$(CODE_COVERAGE_CFLAGS) \
+ $(SANITIZE_CFLAGS) \
$(NULL)
noinst_LTLIBRARIES = libdbus-testutils.la
@@ -91,6 +92,12 @@ endif !DBUS_ENABLE_EMBEDDED_TESTS
noinst_PROGRAMS= $(TEST_BINARIES)
+# This helper is meant to crash, so if we're compiling the rest with
+# AddressSanitizer, we need to stop it from catching the SIGSEGV and
+# turning it into _exit(1); so don't give it SANITIZE_CFLAGS.
+# CODE_COVERAGE_CFLAGS are fairly pointless here, too.
+test_segfault_CFLAGS =
+
test_service_LDADD = libdbus-testutils.la
test_names_LDADD = libdbus-testutils.la
## break_loader_LDADD = $(top_builddir)/dbus/libdbus-internal.la