summaryrefslogtreecommitdiffstats
path: root/mk/unittest.mk
diff options
context:
space:
mode:
Diffstat (limited to '')
-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