summaryrefslogtreecommitdiffstats
path: root/mk/unittest.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:39:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:39:28 +0000
commit924f5ea83e48277e014ebf0d19a27187cb93e2f7 (patch)
tree75920a275bba045f6d108204562c218a9a26ea15 /mk/unittest.mk
parentAdding upstream version 2.1.7. (diff)
downloadpacemaker-upstream.tar.xz
pacemaker-upstream.zip
Adding upstream version 2.1.8~rc1.upstream/2.1.8_rc1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mk/unittest.mk')
-rw-r--r--mk/unittest.mk15
1 files changed, 12 insertions, 3 deletions
diff --git a/mk/unittest.mk b/mk/unittest.mk
index ea397f2..f563ea3 100644
--- a/mk/unittest.mk
+++ b/mk/unittest.mk
@@ -1,5 +1,5 @@
#
-# Copyright 2022 the Pacemaker project contributors
+# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
@@ -12,8 +12,17 @@ AM_CPPFLAGS = -I$(top_builddir)/include \
-I$(top_srcdir)/lib/common
AM_CFLAGS = -DPCMK__UNIT_TESTING
+# Add -fno-builtin and -fno-inline to allow mocking realloc.
+AM_CFLAGS += -fno-builtin
+AM_CFLAGS += -fno-inline
AM_LDFLAGS = $(LDFLAGS_WRAP)
-LDADD = $(top_builddir)/lib/common/libcrmcommon_test.la \
- -lcmocka
+LDADD = $(top_builddir)/lib/common/libcrmcommon_test.la
+if BUILD_COVERAGE
+LDADD += -lgcov
+endif
+LDADD += -lcmocka
+# When -fno-builtin is used, -lm also needs to be added. See the comments in
+# lib/common/Makefile.am for libcrmcommon_test_la_CFLAGS.
+LDADD += -lm