diff --git a/Makefile.am b/Makefile.am
index 4be88d70a9..93ced17faf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,133 +1,134 @@
#
# Copyright 2003-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
+
# This directory must be same as in configure.ac's AC_CONFIG_MACRO_DIR
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = CONTRIBUTING.md \
GNUmakefile \
INSTALL.md \
README.markdown \
autogen.sh \
m4/CC_CHECK_LDFLAGS.m4 \
m4/CHECK_ENUM_VALUE.m4 \
m4/REQUIRE_HEADER.m4 \
m4/version.m4
DISTCLEANFILES = config.status
-MAINTAINERCLEANFILES = Makefile.in \
- aclocal.m4 \
+MAINTAINERCLEANFILES += aclocal.m4 \
config.guess \
config.sub \
configure \
depcomp \
install-sh \
ltmain.sh \
missing \
py-compile \
test-driver
# Don't try to install files outside build directory for "make distcheck".
AM_DISTCHECK_CONFIGURE_FLAGS = --prefix="$$dc_install_base/usr" \
--sysconfdir="$$dc_install_base/etc" \
--with-initdir="$$dc_install_base/etc/init.d" \
--with-ocfdir="$$dc_install_base/usr/lib/ocf" \
--with-systemdsystemunitdir="$$dc_install_base$(systemdsystemunitdir)"
# Only these will get built with a plain "make"
CORE = include \
lib \
daemons \
tools \
xml \
po \
python \
cts \
rpm
SUBDIRS = $(CORE) \
agents \
devel \
doc \
etc \
maint \
tests
doc_DATA = README.markdown \
COPYING
licensedir = $(docdir)/licenses/
dist_license_DATA = $(wildcard licenses/*)
# Directories that should be created on install and removed on uninstall
## owned by root:haclient, mode 0750
ROOT_DIRS = $(PACEMAKER_CONFIG_DIR)
## owned by hacluster:haclient, mode 0750
DAEMON_R_DIRS = $(CRM_CONFIG_DIR) \
$(CRM_CORE_DIR) \
$(CRM_BLACKBOX_DIR)
## owned by hacluster:haclient, mode 0770
DAEMON_RW_DIRS = $(CRM_BUNDLE_DIR) \
$(CRM_LOG_DIR)
.PHONY: core
core:
@echo "Building only core components and tests: $(CORE)"
@for subdir in $(CORE); do \
echo "Building $$subdir"; \
$(MAKE) $(AM_MAKEFLAGS) -C $$subdir all || exit 1; \
done
.PHONY: core-clean
core-clean:
@echo "Cleaning only core components and tests: $(CORE)"
@for subdir in $(CORE); do \
echo "Cleaning $$subdir"; \
$(MAKE) $(AM_MAKEFLAGS) -C $$subdir clean || exit 1; \
done
.PHONY: install-exec-local
install-exec-local:
for DIR in $(ROOT_DIRS) $(DAEMON_R_DIRS); do \
$(INSTALL) -d -m 750 "$(DESTDIR)/$$DIR"; \
done
for DIR in $(DAEMON_RW_DIRS); do \
$(INSTALL) -d -m 770 "$(DESTDIR)/$$DIR"; \
done
-for DIR in $(ROOT_DIRS); do \
chgrp $(CRM_DAEMON_GROUP) "$(DESTDIR)/$$DIR"; \
done
-for DIR in $(DAEMON_R_DIRS) $(DAEMON_RW_DIRS); do \
chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) "$(DESTDIR)/$$DIR"; \
done
# Remove created directories only if they're empty
.PHONY: uninstall-hook
uninstall-hook:
-for DIR in $(ROOT_DIRS) $(DAEMON_R_DIRS) $(DAEMON_RW_DIRS); do \
rmdir "$(DESTDIR)/$$DIR"; \
done
.PHONY: clean-generic
clean-generic:
-rm -f *.tar.bz2 *.sed
PACKAGE ?= pacemaker
.PHONY: clean-local
clean-local:
-rm -f $(builddir)/$(PACKAGE)-*.tar.gz
-if [ "x$(top_srcdir)" != "x$(top_builddir)" ]; then \
rm -rf $(top_builddir)/python; \
fi
.PHONY: distclean-local
distclean-local:
-rm -rf libltdl autom4te.cache
diff --git a/cts/Makefile.am b/cts/Makefile.am
index 1f04aaaff7..3e128dfc81 100644
--- a/cts/Makefile.am
+++ b/cts/Makefile.am
@@ -1,78 +1,77 @@
#
# Copyright 2001-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/python.mk
-MAINTAINERCLEANFILES = Makefile.in
-
# Test commands and globally applicable test files should be in $(testdir),
# and command-specific test data should be in a command-specific subdirectory.
testdir = $(datadir)/$(PACKAGE)/tests
test_SCRIPTS = cts-attrd \
cts-cli \
cts-exec \
cts-fencing \
cts-lab \
cts-regression \
cts-scheduler \
cts-schemas
dist_test_DATA = README.md \
valgrind-pcmk.suppressions
clidir = $(testdir)/cli
dist_cli_DATA = $(wildcard cli/*.xml cli/*.exp)
ctsdir = $(datadir)/$(PACKAGE)/tests/cts
cts_SCRIPTS = cts
schemasdir = $(testdir)/schemas
dist_schemas_DATA = $(wildcard schemas/*/ref/*.ref*) \
$(wildcard schemas/*/ref.err/*.ref.err*) \
$(wildcard schemas/*/xml/*.xml)
noinst_SCRIPTS = cluster_test
.PHONY: scheduler-list
scheduler-list:
@for T in "$(srcdir)"/scheduler/xml/*.xml; do \
echo $$(basename $$T .xml); \
done
CLEANFILES = $(builddir)/.regression.failed.diff
.PHONY: clean-local
clean-local:
rm -f scheduler/*/*.pe
rm -f schemas/*/*.up{,.err}
SUBDIRS = benchmark \
scheduler \
support
.PHONY: cts-support-install
cts-support-install:
$(MAKE) $(AM_MAKEFLAGS) -C support cts-support
$(builddir)/support/cts-support install
.PHONY: cts-support-uninstall
cts-support-uninstall:
$(MAKE) $(AM_MAKEFLAGS) -C support cts-support
$(builddir)/support/cts-support uninstall
# Everything listed here is a python script, typically generated from a .in file
# (though that is not a requirement). We want to run pylint on all of these
# things after they've been built.
python_files = cts-attrd \
cts-exec \
cts-fencing \
cts-lab \
cts-regression \
cts-scheduler
PYCHECKFILES ?= $(python_files)
diff --git a/cts/benchmark/Makefile.am b/cts/benchmark/Makefile.am
index 703f18dcf3..abbb66f319 100644
--- a/cts/benchmark/Makefile.am
+++ b/cts/benchmark/Makefile.am
@@ -1,14 +1,15 @@
#
-# Copyright 2001-2023 the Pacemaker project contributors
+# Copyright 2001-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
benchdir = $(datadir)/$(PACKAGE)/tests/cts/benchmark
dist_bench_DATA = README.benchmark \
control
bench_SCRIPTS = clubench
diff --git a/cts/scheduler/Makefile.am b/cts/scheduler/Makefile.am
index aed7714718..24d5a12b8d 100644
--- a/cts/scheduler/Makefile.am
+++ b/cts/scheduler/Makefile.am
@@ -1,24 +1,25 @@
#
-# Copyright 2001-2021 the Pacemaker project contributors
+# Copyright 2001-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
pedir = $(datadir)/$(PACKAGE)/tests/scheduler
.PHONY: list
list:
@for T in "$(srcdir)"/xml/*.xml; do \
echo $$(basename $$T .xml); \
done
SUBDIRS = dot \
exp \
scores \
stderr \
summary \
xml
diff --git a/cts/scheduler/dot/Makefile.am b/cts/scheduler/dot/Makefile.am
index 62dd075a5b..d10a175931 100644
--- a/cts/scheduler/dot/Makefile.am
+++ b/cts/scheduler/dot/Makefile.am
@@ -1,12 +1,13 @@
#
-# Copyright 2001-2021 the Pacemaker project contributors
+# Copyright 2001-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
dotdir = $(datadir)/$(PACKAGE)/tests/scheduler/dot
dist_dot_DATA = $(wildcard *.dot)
diff --git a/cts/scheduler/exp/Makefile.am b/cts/scheduler/exp/Makefile.am
index bfa19060a0..7f30c115be 100644
--- a/cts/scheduler/exp/Makefile.am
+++ b/cts/scheduler/exp/Makefile.am
@@ -1,12 +1,13 @@
#
-# Copyright 2001-2021 the Pacemaker project contributors
+# Copyright 2001-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
expdir = $(datadir)/$(PACKAGE)/tests/scheduler/exp
dist_exp_DATA = $(wildcard *.exp)
diff --git a/cts/scheduler/scores/Makefile.am b/cts/scheduler/scores/Makefile.am
index ab40629806..7f653227e2 100644
--- a/cts/scheduler/scores/Makefile.am
+++ b/cts/scheduler/scores/Makefile.am
@@ -1,12 +1,13 @@
#
-# Copyright 2001-2021 the Pacemaker project contributors
+# Copyright 2001-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
scoresdir = $(datadir)/$(PACKAGE)/tests/scheduler/scores
dist_scores_DATA = $(wildcard *.scores)
diff --git a/cts/scheduler/stderr/Makefile.am b/cts/scheduler/stderr/Makefile.am
index 5dbac99341..a59053b4e4 100644
--- a/cts/scheduler/stderr/Makefile.am
+++ b/cts/scheduler/stderr/Makefile.am
@@ -1,12 +1,13 @@
#
-# Copyright 2001-2021 the Pacemaker project contributors
+# Copyright 2001-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
scoresdir = $(datadir)/$(PACKAGE)/tests/scheduler/stderr
dist_scores_DATA = $(wildcard *.stderr)
diff --git a/cts/scheduler/summary/Makefile.am b/cts/scheduler/summary/Makefile.am
index f89c904825..951db33707 100644
--- a/cts/scheduler/summary/Makefile.am
+++ b/cts/scheduler/summary/Makefile.am
@@ -1,12 +1,13 @@
#
-# Copyright 2001-2021 the Pacemaker project contributors
+# Copyright 2001-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
summarydir = $(datadir)/$(PACKAGE)/tests/scheduler/summary
dist_summary_DATA = $(wildcard *.summary)
diff --git a/cts/scheduler/xml/Makefile.am b/cts/scheduler/xml/Makefile.am
index 4757fb4549..0f07cc2fed 100644
--- a/cts/scheduler/xml/Makefile.am
+++ b/cts/scheduler/xml/Makefile.am
@@ -1,12 +1,13 @@
#
-# Copyright 2001-2021 the Pacemaker project contributors
+# Copyright 2001-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
xmldir = $(datadir)/$(PACKAGE)/tests/scheduler/xml
dist_xml_DATA = $(wildcard *.xml)
diff --git a/cts/support/Makefile.am b/cts/support/Makefile.am
index 8071711a9f..ae39f3e968 100644
--- a/cts/support/Makefile.am
+++ b/cts/support/Makefile.am
@@ -1,25 +1,24 @@
#
# Copyright 2021-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/python.mk
-MAINTAINERCLEANFILES = Makefile.in
-
# Commands intended to be run only via other commands
halibdir = $(CRM_DAEMON_DIR)
dist_halib_SCRIPTS = cts-support
ctsdir = $(datadir)/$(PACKAGE)/tests/cts
cts_DATA = pacemaker-cts-dummyd@.service
dist_cts_DATA = cts.conf
cts_SCRIPTS = fence_dummy \
LSBDummy \
pacemaker-cts-dummyd
PYCHECKFILES ?= cts-support fence_dummy pacemaker-cts-dummyd
diff --git a/daemons/Makefile.am b/daemons/Makefile.am
index 30dd17ee6e..3e4c00eba7 100644
--- a/daemons/Makefile.am
+++ b/daemons/Makefile.am
@@ -1,17 +1,18 @@
#
-# Copyright 2018-2023 the Pacemaker project contributors
+# Copyright 2018-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+include $(top_srcdir)/mk/common.mk
+
SUBDIRS = based \
schedulerd \
attrd \
controld \
execd \
fenced \
pacemakerd
diff --git a/doc/sphinx/Pacemaker_Development/helpers.rst b/doc/sphinx/Pacemaker_Development/helpers.rst
index 69eddf35a1..e940721e31 100644
--- a/doc/sphinx/Pacemaker_Development/helpers.rst
+++ b/doc/sphinx/Pacemaker_Development/helpers.rst
@@ -1,634 +1,641 @@
C Development Helpers
---------------------
.. index::
single: unit testing
Refactoring
###########
Pacemaker uses an optional tool called `coccinelle `_
to do automatic refactoring. coccinelle is a very complicated tool that can be
difficult to understand, and the existing documentation makes it pretty tough
to get started. Much of the documentation is either aimed at kernel developers
or takes the form of grammars.
However, it can apply very complex transformations across an entire source tree.
This is useful for tasks like code refactoring, changing APIs (number or type of
arguments, etc.), catching functions that should not be called, and changing
existing patterns.
coccinelle is driven by input scripts called `semantic patches `_
written in its own language. These scripts bear a passing resemblance to source
code patches and tell coccinelle how to match and modify a piece of source
code. They are stored in ``devel/coccinelle`` and each script either contains
a single source transformation or several related transformations. In general,
we try to keep these as simple as possible.
In Pacemaker development, we use a couple targets in ``devel/Makefile.am`` to
control coccinelle. The ``cocci`` target tries to apply each script to every
Pacemaker source file, printing out any changes it would make to the console.
The ``cocci-inplace`` target does the same but also makes those changes to the
source files. A variety of warnings might also be printed. If you aren't working
on a new script, these can usually be ignored.
If you are working on a new coccinelle script, it can be useful (and faster) to
skip everything else and only run the new script. The ``COCCI_FILES`` variable
can be used for this:
.. code-block:: none
$ make -C devel COCCI_FILES=coccinelle/new-file.cocci cocci
This variable is also used for preventing some coccinelle scripts in the Pacemaker
source tree from running. Some scripts are disabled because they are not currently
fully working or because they are there as templates. When adding a new script,
remember to add it to this variable if it should always be run.
One complication when writing coccinelle scripts is that certain Pacemaker source
files may not use private functions (those whose name starts with ``pcmk__``).
Handling this requires work in both the Makefile and in the coccinelle scripts.
The Makefile deals with this by maintaining two lists of source files: those that
may use private functions and those that may not. For those that may, a special
argument (``-D internal``) is added to the coccinelle command line. This creates
a virtual dependency named ``internal``.
In the coccinelle scripts, those transformations that modify source code to use
a private function also have a dependency on ``internal``. If that dependency
was given on the command line, the transformation will be run. Otherwise, it will
be skipped.
This means that not all instances of an older style of code will be changed after
running a given transformation. Some developer intervention is still necessary
to know whether a source code block should have been changed or not.
Probably the easiest way to learn how to use coccinelle is by following other
people's scripts. In addition to the ones in the Pacemaker source directory,
there's several others on the `coccinelle website `_.
Sanitizers
##########
gcc supports a variety of run-time checks called sanitizers. These can be used to
catch programming errors with memory, race conditions, various undefined behavior
conditions, and more. Because these are run-time checks, they should only be used
during development and not in compiled packages or production code.
Certain sanitizers cannot be combined with others because their run-time checks
cause interfere. Instead of trying to figure out which combinations work, it is
simplest to just enable one at a time.
Each supported sanitizer requires an installed libray. In addition to just
enabling the sanitizer, their use can be configured with environment variables.
For example:
.. code-block:: none
$ ASAN_OPTIONS=verbosity=1:replace_str=true crm_mon -1R
Pacemaker supports the following subset of gcc's sanitizers:
+--------------------+-------------------------+----------+----------------------+
| Sanitizer | Configure Option | Library | Environment Variable |
+====================+=========================+==========+======================+
| Address | --with-sanitizers=asan | libasan | ASAN_OPTIONS |
+--------------------+-------------------------+----------+----------------------+
| Threads | --with-sanitizers=tsan | libtsan | TSAN_OPTIONS |
+--------------------+-------------------------+----------+----------------------+
| Undefined behavior | --with-sanitizers=ubsan | libubsan | UBSAN_OPTIONS |
+--------------------+-------------------------+----------+----------------------+
The undefined behavior sanitizer further supports suboptions that need to be
given as CFLAGS when configuring pacemaker:
.. code-block:: none
$ CFLAGS=-fsanitize=integer-divide-by-zero ./configure --with-sanitizers=ubsan
For more information, see the `gcc documentation `_
which also provides links to more information on each sanitizer.
Unit Testing
############
Where possible, changes to the C side of Pacemaker should be accompanied by unit
tests. Much of Pacemaker cannot effectively be unit tested (and there are other
testing systems used for those parts), but the ``lib`` subdirectory is pretty easy
to write tests for.
Pacemaker uses the `cmocka unit testing framework `_ which looks
a lot like other unit testing frameworks for C and should be fairly familiar. In
addition to regular unit tests, cmocka also gives us the ability to use
`mock functions `_ for unit testing
functions that would otherwise be difficult to test.
Organization
____________
Pay close attention to the organization and naming of test cases to ensure the
unit tests continue to work as they should.
Tests are spread throughout the source tree, alongside the source code they test.
For instance, all the tests for the source code in ``lib/common/`` are in the
``lib/common/tests`` directory. If there is no ``tests`` subdirectory, there are no
tests for that library yet.
Under that directory, there is a ``Makefile.am`` and additional subdirectories. Each
subdirectory contains the tests for a single library source file. For instance,
all the tests for ``lib/common/strings.c`` are in the ``lib/common/tests/strings``
directory. Note that the test subdirectory does not have a ``.c`` suffix. If there
is no test subdirectory, there are no tests for that file yet.
Finally, under that directory, there is a ``Makefile.am`` and then various source
files. Each of these source files tests the single function that it is named
after. For instance, ``lib/common/tests/strings/pcmk__btoa_test.c`` tests the
``pcmk__btoa()`` function in ``lib/common/strings.c``. If there is no test
source file, there are no tests for that function yet.
The ``_test`` suffix on the test source file is important. All tests have this
suffix, which means all the compiled test cases will also end with this suffix.
That lets us ignore all the compiled tests with a single line in ``.gitignore``:
.. code-block:: none
/lib/*/tests/*/*_test
Adding a test
_____________
Testing a new function in an already testable source file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Follow these steps if you want to test a function in a source file where there
are already other tested functions. For the purposes of this example, we will
add a test for the ``pcmk__scan_port()`` function in ``lib/common/strings.c``. As
you can see, there are already tests for other functions in this same file in
the ``lib/common/tests/strings`` directory.
* cd into ``lib/common/tests/strings``
* Add the new file to the ``check_PROGRAMS`` variable in ``Makefile.am``, making
it something like this:
.. code-block:: none
check_PROGRAMS = \
pcmk__add_word_test \
pcmk__btoa_test \
pcmk__scan_port_test
* Create a new ``pcmk__scan_port_test.c`` file, copying the copyright and include
boilerplate from another file in the same directory.
* Continue with the steps in `Writing the test`_.
Testing a function in a source file without tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Follow these steps if you want to test a function in a source file where there
are not already other tested functions, but there are tests for other files in
the same library. For the purposes of this example, we will add a test for the
``pcmk_acl_required()`` function in ``lib/common/acls.c``. At the time of this
documentation being written, no tests existed for that source file, so there
is no ``lib/common/tests/acls`` directory.
* Add to ``AC_CONFIG_FILES`` in the top-level ``configure.ac`` file so the build
process knows to use directory we're about to create. That variable would
now look something like:
.. code-block:: none
dnl Other files we output
AC_CONFIG_FILES(Makefile \
...
lib/common/tests/Makefile \
lib/common/tests/acls/Makefile \
lib/common/tests/agents/Makefile \
...
)
* cd into ``lib/common/tests``
* Add to the ``SUBDIRS`` variable in ``Makefile.am``, making it something like:
.. code-block:: none
SUBDIRS = agents acls cmdline flags operations strings utils xpath results
* Create a new ``acls`` directory, copying the ``Makefile.am`` from some other
directory. At this time, each ``Makefile.am`` is largely boilerplate with
very little that needs to change from directory to directory.
* cd into ``acls``
* Get rid of any existing values for ``check_PROGRAMS`` and set it to
``pcmk_acl_required_test`` like so:
.. code-block:: none
check_PROGRAMS = pcmk_acl_required_test
-* Double check that ``$(top_srcdir)/mk/tap.mk`` and ``$(top_srcdir)/mk/unittest.mk``
- are included in the ``Makefile.am``. These files contain all the flags necessary
- for most unit tests. If necessary, individual settings can be overridden like so:
+* Double check that the following includes are at the top of ``Makefile.am``:
.. code-block:: none
+ include $(top_srcdir)/mk/common.mk
+ include $(top_srcdir)/mk/tap.mk
+ include $(top_srcdir)/mk/unittest.mk
+
+* If necessary, settings from those includes can be overridden like so:
+
+ .. code-block:: none
+
+ AM_TESTS_ENVIRONMENT += PCMK_CTS_CLI_DIR=$(top_srcdir)/cts/cli
AM_CPPFLAGS += -I$(top_srcdir)
LDADD += $(top_builddir)/lib/pengine/libpe_status_test.la
* Follow the steps in `Testing a new function in an already testable source file`_
to create the new ``pcmk_acl_required_test.c`` file.
Testing a function in a library without tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Adding a test case for a function in a library that doesn't have any test cases
to begin with is only slightly more complicated. In general, the steps are the
same as for the previous section, except with an additional layer of directory
creation.
For the purposes of this example, we will add a test case for the
``lrmd_send_resource_alert()`` function in ``lib/lrmd/lrmd_alerts.c``. Note that this
may not be a very good function or even library to write actual unit tests for.
* Add to ``AC_CONFIG_FILES`` in the top-level ``configure.ac`` file so the build
process knows to use directory we're about to create. That variable would
now look something like:
.. code-block:: none
dnl Other files we output
AC_CONFIG_FILES(Makefile \
...
lib/lrmd/Makefile \
lib/lrmd/tests/Makefile \
lib/services/Makefile \
...
)
* cd into ``lib/lrmd``
* Create a ``SUBDIRS`` variable in ``Makefile.am`` if it doesn't already exist.
Most libraries should not have this variable already.
.. code-block:: none
SUBDIRS = tests
* Create a new ``tests`` directory and add a ``Makefile.am`` with the following
contents:
.. code-block:: none
SUBDIRS = lrmd_alerts
* Follow the steps in `Testing a function in a source file without tests`_ to create
the rest of the new directory structure.
* Follow the steps in `Testing a new function in an already testable source file`_
to create the new ``lrmd_send_resource_alert_test.c`` file.
Adding to an existing test case
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If all you need to do is add additional test cases to an existing file, none of
the above work is necessary. All you need to do is find the test source file
with the name matching your function and add to it and then follow the
instructions in `Writing the test`_.
Writing the test
________________
A test case file contains a fair amount of boilerplate. For this reason, it's
usually easiest to just copy an existing file and adapt it to your needs. However,
here's the basic structure:
.. code-block:: c
/*
* Copyright 2021 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
* This source code is licensed under the GNU Lesser General Public License
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
*/
#include
#include
/* Put your test-specific includes here */
/* Put your test functions here */
PCMK__UNIT_TEST(NULL, NULL,
/* Register your test functions here */)
Each test-specific function should test one aspect of the library function,
though it can include many assertions if there are many ways of testing that
one aspect. For instance, there might be multiple ways of testing regular
expression matching:
.. code-block:: c
static void
regex(void **state) {
const char *s1 = "abcd";
const char *s2 = "ABCD";
assert_true(pcmk__strcmp(NULL, "a..d", pcmk__str_regex) < 0);
assert_true(pcmk__strcmp(s1, NULL, pcmk__str_regex) > 0);
assert_int_equal(pcmk__strcmp(s1, "a..d", pcmk__str_regex), 0);
}
Each test-specific function must also be registered or it will not be called.
This is done with ``cmocka_unit_test()`` in the ``PCMK__UNIT_TEST`` macro:
.. code-block:: c
PCMK__UNIT_TEST(NULL, NULL,
cmocka_unit_test(regex))
Most unit tests do not require a setup and teardown function to be executed
around the entire group of tests. On occassion, this may be necessary. Simply
pass those functions in as the first two parameters to ``PCMK__UNIT_TEST``
instead of using NULL.
Assertions
__________
In addition to the `assertions provided by `_,
``unittest_internal.h`` also provides ``pcmk__assert_asserts``. This macro takes an
expression and verifies that the expression aborts due to a failed call to
``CRM_ASSERT`` or some other similar function. It can be used like so:
.. code-block:: c
static void
null_input_variables(void **state)
{
long long start, end;
pcmk__assert_asserts(pcmk__parse_ll_range("1234", NULL, &end));
pcmk__assert_asserts(pcmk__parse_ll_range("1234", &start, NULL));
}
Here, ``pcmk__parse_ll_range`` expects non-NULL for its second and third
arguments. If one of those arguments is NULL, ``CRM_ASSERT`` will fail and
the program will abort. ``pcmk__assert_asserts`` checks that the code would
abort and the test passes. If the code does not abort, the test fails.
Running
_______
If you had to create any new files or directories, you will first need to run
``./configure`` from the top level of the source directory. This will regenerate
the Makefiles throughout the tree. If you skip this step, your changes will be
skipped and you'll be left wondering why the output doesn't match what you
expected.
To run the tests, simply run ``make check`` after previously building the source
with ``make``. The test cases in each directory will be built and then run.
This should not take long. If all the tests succeed, you will be back at the
prompt. Scrolling back through the history, you should see lines like the
following:
.. code-block:: none
PASS: pcmk__strcmp_test 1 - same_pointer
PASS: pcmk__strcmp_test 2 - one_is_null
PASS: pcmk__strcmp_test 3 - case_matters
PASS: pcmk__strcmp_test 4 - case_insensitive
PASS: pcmk__strcmp_test 5 - regex
============================================================================
Testsuite summary for pacemaker 2.1.0
============================================================================
# TOTAL: 33
# PASS: 33
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
============================================================================
make[7]: Leaving directory '/home/clumens/src/pacemaker/lib/common/tests/strings'
The testing process will quit on the first failed test, and you will see lines
like these:
.. code-block:: none
PASS: pcmk__scan_double_test 3 - trailing_chars
FAIL: pcmk__scan_double_test 4 - typical_case
PASS: pcmk__scan_double_test 5 - double_overflow
PASS: pcmk__scan_double_test 6 - double_underflow
ERROR: pcmk__scan_double_test - exited with status 1
PASS: pcmk__starts_with_test 1 - bad_input
============================================================================
Testsuite summary for pacemaker 2.1.0
============================================================================
# TOTAL: 56
# PASS: 54
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 1
============================================================================
See lib/common/tests/strings/test-suite.log
Please report to users@clusterlabs.org
============================================================================
make[7]: *** [Makefile:1218: test-suite.log] Error 1
make[7]: Leaving directory '/home/clumens/src/pacemaker/lib/common/tests/strings'
The failure is in ``lib/common/tests/strings/test-suite.log``:
.. code-block:: none
ERROR: pcmk__scan_double_test
=============================
1..6
ok 1 - empty_input_string
PASS: pcmk__scan_double_test 1 - empty_input_string
ok 2 - bad_input_string
PASS: pcmk__scan_double_test 2 - bad_input_string
ok 3 - trailing_chars
PASS: pcmk__scan_double_test 3 - trailing_chars
not ok 4 - typical_case
FAIL: pcmk__scan_double_test 4 - typical_case
# 0.000000 != 3.000000
# pcmk__scan_double_test.c:80: error: Failure!
ok 5 - double_overflow
PASS: pcmk__scan_double_test 5 - double_overflow
ok 6 - double_underflow
PASS: pcmk__scan_double_test 6 - double_underflow
# not ok - tests
ERROR: pcmk__scan_double_test - exited with status 1
At this point, you need to determine whether your test case is incorrect or
whether the code being tested is incorrect. Fix whichever is wrong and continue.
Fuzz Testing
############
Pacemaker is integrated with the
`OSS-Fuzz `_ project. OSS-Fuzz calls
selected Pacemaker APIs with random argument values to catch edge cases that
might be missed by other forms of testing.
The OSS-Fuzz project has a contact address for Pacemaker in
projects/pacemaker/project.yaml that will receive bug reports. The address must
have been used to commit to Pacemaker, and should be tied to a Google account.
Open reports that aren't security-related can be seen at `OSS-Fuzz testcases
`_.
Fuzzers
_______
Each fuzz-tested library has a fuzzers subdirectory (for example,
``lib/common/fuzzers``). That directory has a file for each fuzzed source file,
named the same except ending in ``_fuzzer.c`` (for example,
``lib/common/fuzzers/strings_fuzzer.c`` has fuzzing for
``lib/common/strings.c``). Those files are not built or distributed as part of
Pacemaker but are used by OSS-Fuzz (see ``projects/pacemaker/build.sh`` in the
OSS-Fuzz repository).
By default, fuzzing uses `libFuzzer `_.
Only Pacemaker APIs that accept any input and do not exit can be fuzzed.
Ideally, fuzzed functions will not modify global state or vary code paths by
anything other than the fuzzed input (such as environment variable values,
date/time, etc.).
Local Fuzzing
_____________
You can use OSS-Fuzz locally to run fuzz testing or reproduce issues reported
by OSS-Fuzz.
To prep a test host:
1. If podman is installed, it will conflict with Docker, so remove it first.
Example for RHEL-like OSes:
* ``dnf remove runc``
1. Install and start Docker. Example for RHEL-like OSes:
* ``dnf config-manager --add-repo
https://download.docker.com/linux/rhel/docker-ce.repo``
* ``dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin
docker-compose-plugin``
* ``usermod -a -G docker $USER``
2. Clone the OSS-Fuzz repository:
* ``cd`` to wherever you want to put it
* ``git clone https://github.com/google/oss-fuzz.git``
* ``cd oss-fuzz``
3. Specify the Pacemaker source you want to test:
* Edit ``projects/pacemaker/Dockerfile`` and replace the last ``git clone``
with the source that you want to test. For example, if you have a branch
``my-fuzzing-branch`` that you've pushed to your GitHub account, you could
use: ``git clone -b my-fuzzing-branch --single-branch --depth 1
https://github.com/$USER/pacemaker``.
To fuzz the code:
1. Ensure Docker is running:
* ``systemctl start docker``
2. Build the necessary Docker containers:
* ``python3 infra/helper.py build_image pacemaker``
3. Build the fuzzers. Choose a sanitizer (for example, ``SANITIZER=address``).
There are three possible sanitizers: address, memory, and undefined. The
memory sanitizer requires special preparation and is generally not used. If
you are reproducing an OSS-Fuzz-reported issue, the issue will list the
sanitizer that was used.
* ``python3 infra/helper.py build_fuzzers --sanitizer $SANITIZER pacemaker``
4. Ensure the build succeeded (use the same sanitizer as the previous step):
* ``python3 infra/helper.py check_build --sanitizer $SANITIZER pacemaker``
5. If you want to run fuzzing yourself, choose a fuzzer (for example,
``FUZZER=iso8601_fuzzer``). Create a temporary directory for the fuzzer's
outputs, then run the fuzzing command, which will fuzz for 25 seconds then
time out:
* ``rm -rf /tmp/corpus >/dev/null 2>&/dev/null``
* ``mkdir /tmp/corpus``
* ``python3 infra/helper.py run_fuzzer --corpus-dir=/tmp/corpus pacemaker
$FUZZER``
* This can be repeated with different fuzzers. The ``build_fuzzers`` step
can also be repeated with a different sanitizer, and the fuzzers tested
again.
6. If you want to reproduce an OSS-Fuzz-reported issue, make a note of the
fuzzer that was used (``$FUZZER`` in this example) and download the provided
reproducer test case file (``$TESTCASE`` in this example), then run:
* ``python3 infra/helper.py reproduce pacemaker $FUZZER $TESTCASE``
For details, see the `OSS-Fuzz documentation
`_.
Code Coverage
#############
Figuring out what needs unit tests written is the purpose of a code coverage tool.
The Pacemaker build process uses ``lcov`` and special make targets to generate
an HTML coverage report that can be inspected with any web browser.
To start, you'll need to install the ``lcov`` package which is included in most
distributions. Next, reconfigure the source tree:
.. code-block:: none
$ ./configure --with-coverage
Then run ``make -C devel coverage``. This will do the same thing as ``make check``,
but will generate a bunch of intermediate files as part of the compiler's output.
Essentially, the coverage tools run all the unit tests and make a note if a given
line if code is executed as a part of some test program. This will include not
just things run as part of the tests but anything in the setup and teardown
functions as well.
Afterwards, the HTML report will be in ``coverage/index.html``. You can drill down
into individual source files to see exactly which lines are covered and which are
not, which makes it easy to target new unit tests. Note that sometimes, it is
impossible to achieve 100% coverage for a source file. For instance, how do you
test a function with a return type of void that simply returns on some condition?
Note that Pacemaker's overall code coverage numbers are very low at the moment.
One reason for this is the large amount of code in the ``daemons`` directory that
will be very difficult to write unit tests for. For now, it is best to focus
efforts on increasing the coverage on individual libraries.
Additionally, there is a ``coverage-cts`` target that does the same thing but
instead of testing ``make check``, it tests ``cts/cts-cli``. The idea behind this
target is to see what parts of our command line tools are covered by our regression
tests. It is probably best to clean and rebuild the source tree when switching
between these various targets.
Debugging
#########
gdb
___
If you use ``gdb`` for debugging, some helper functions are defined in
``devel/gdbhelpers``, which can be given to ``gdb`` using the ``-x`` option.
From within the debugger, you can then invoke the ``pcmk`` command that
will describe the helper functions available.
diff --git a/etc/Makefile.am b/etc/Makefile.am
index db0213bbc7..dd6bca2563 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -1,43 +1,43 @@
#
# Copyright 2021-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+include $(top_srcdir)/mk/common.mk
configdir = @CONFIGDIR@
CONFIGS = crm_mon \
pacemaker
if !BUILD_SYSTEMD
if BUILD_LSB
initdir = $(INITDIR)
init_SCRIPTS = init.d/pacemaker
endif
endif
logrotatedir = $(sysconfdir)/logrotate.d
logrotate_DATA = logrotate.d/pacemaker
EXTRA_DIST = $(foreach f,$(CONFIGS),sysconfig/$(f))
# Don't overwrite user's existing config files
.PHONY: install-data-local
install-data-local:
$(AM_V_at)$(MKDIR_P) $(DESTDIR)$(configdir)
$(AM_V_at)for f in $(CONFIGS); do \
dest="$(DESTDIR)$(configdir)/$$f"; \
[ -e "$$dest" ] && dest="$$dest.new"; \
$(INSTALL_DATA) "$(srcdir)/sysconfig/$$f" "$$dest"; \
done
.PHONY: uninstall-local
uninstall-local:
$(AM_V_at)for f in $(CONFIGS); do \
dest="$(DESTDIR)$(configdir)/$$f"; \
rm -f "$$dest" "$$dest.new"; \
done
diff --git a/include/Makefile.am b/include/Makefile.am
index eb27818a04..f8d27cc807 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,42 +1,43 @@
#
# Copyright 2003-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in \
- config.h.in
+include $(top_srcdir)/mk/common.mk
+
+MAINTAINERCLEANFILES += config.h.in
noinst_HEADERS = config.h \
crm_internal.h \
doxygen.h \
pacemaker-internal.h \
portability.h \
gettext.h
pkginclude_HEADERS = crm_config.h \
pacemaker.h
SUBDIRS = crm pcmki
# gettext.h is supplied by the gettext project
GETTEXT_H ?= $(datadir)/gettext/gettext.h
.PHONY: update-gettext
update-gettext:
@if [ ! -e "$(GETTEXT_H)" ]; then \
echo "$(GETTEXT_H) not found"; \
else \
cp "$(GETTEXT_H)" gettext.h; \
"$(GIT)" diff --quiet gettext.h 2>/dev/null; \
if [ $$? -eq 0 ]; then \
echo "No update needed"; \
else \
"$(GIT)" add gettext.h; \
echo 'Review changes then run:'; \
echo 'git commit -m "Low: NLS: update gettext.h from upstream"'; \
fi \
fi
diff --git a/include/crm/Makefile.am b/include/crm/Makefile.am
index 47fd80966a..5bdf6cc26c 100644
--- a/include/crm/Makefile.am
+++ b/include/crm/Makefile.am
@@ -1,32 +1,32 @@
#
# Copyright 2004-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+include $(top_srcdir)/mk/common.mk
headerdir=$(pkgincludedir)/crm
header_HEADERS = cib.h \
cib_compat.h \
cluster.h \
crm.h \
crm_compat.h \
lrmd.h \
lrmd_events.h \
msg_xml.h \
msg_xml_compat.h \
services.h \
stonith-ng.h
noinst_HEADERS = $(wildcard *_internal.h)
SUBDIRS = common \
pengine \
cib \
fencing \
cluster
diff --git a/include/crm/cib/Makefile.am b/include/crm/cib/Makefile.am
index 28b2df8666..f258a9e433 100644
--- a/include/crm/cib/Makefile.am
+++ b/include/crm/cib/Makefile.am
@@ -1,15 +1,16 @@
#
-# Copyright 2012-2021 the Pacemaker project contributors
+# Copyright 2012-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
headerdir=$(pkgincludedir)/crm/cib
noinst_HEADERS = internal.h
header_HEADERS = cib_types.h \
util.h
diff --git a/include/crm/cluster/Makefile.am b/include/crm/cluster/Makefile.am
index 2500a87581..ca92e95f96 100644
--- a/include/crm/cluster/Makefile.am
+++ b/include/crm/cluster/Makefile.am
@@ -1,15 +1,16 @@
#
-# Copyright 2012-2023 the Pacemaker project contributors
+# Copyright 2012-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
headerdir=$(pkgincludedir)/crm/cluster
noinst_HEADERS = internal.h \
$(wildcard *_internal.h)
header_HEADERS = compat.h
diff --git a/include/crm/common/Makefile.am b/include/crm/common/Makefile.am
index 69d42534be..be06b9217a 100644
--- a/include/crm/common/Makefile.am
+++ b/include/crm/common/Makefile.am
@@ -1,50 +1,50 @@
#
# Copyright 2004-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+include $(top_srcdir)/mk/common.mk
headerdir=$(pkgincludedir)/crm/common
header_HEADERS = acl.h \
actions.h \
agents.h \
cib.h \
ipc.h \
ipc_controld.h \
ipc_pacemakerd.h \
ipc_schedulerd.h \
iso8601.h \
logging.h \
logging_compat.h \
mainloop.h \
nodes.h \
nvpair.h \
nvpair_compat.h \
options.h \
output.h \
probes.h \
resources.h \
results.h \
results_compat.h \
roles.h \
rules.h \
scheduler.h \
scheduler_types.h \
schemas.h \
scores.h \
scores_compat.h \
strings.h \
util.h \
util_compat.h \
xml.h \
xml_compat.h \
xml_io.h \
xml_names.h
noinst_HEADERS = $(wildcard *internal.h)
diff --git a/include/crm/fencing/Makefile.am b/include/crm/fencing/Makefile.am
index 12b434db9c..bab1d9cc85 100644
--- a/include/crm/fencing/Makefile.am
+++ b/include/crm/fencing/Makefile.am
@@ -1,13 +1,14 @@
#
-# Copyright 2012-2021 the Pacemaker project contributors
+# Copyright 2012-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
headerdir=$(pkgincludedir)/crm/fencing
noinst_HEADERS = internal.h
diff --git a/include/crm/pengine/Makefile.am b/include/crm/pengine/Makefile.am
index 52e48240ed..64275be01c 100644
--- a/include/crm/pengine/Makefile.am
+++ b/include/crm/pengine/Makefile.am
@@ -1,22 +1,23 @@
#
# Copyright 2006-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
headerdir=$(pkgincludedir)/crm/pengine
noinst_HEADERS = internal.h \
$(wildcard *_internal.h)
header_HEADERS = common.h \
complex.h \
pe_types.h \
rules.h \
status.h \
pe_types_compat.h \
rules_compat.h \
status_compat.h
diff --git a/include/pcmki/Makefile.am b/include/pcmki/Makefile.am
index b9475af13f..45af519432 100644
--- a/include/pcmki/Makefile.am
+++ b/include/pcmki/Makefile.am
@@ -1,14 +1,14 @@
#
-# Copyright 2019-2023 the Pacemaker project contributors
+# Copyright 2019-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+include $(top_srcdir)/mk/common.mk
noinst_HEADERS = $(wildcard *.h)
.PHONY: $(ARCHIVE_VERSION)
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 493ebaa93c..a1f5fe7585 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,32 +1,33 @@
#
# Copyright 2003-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
LIBS = cib \
lrmd \
service \
fencing \
cluster
pkgconfig_DATA = $(LIBS:%=pacemaker-%.pc) \
libpacemaker.pc \
pacemaker.pc \
pacemaker-pe_rules.pc \
pacemaker-pe_status.pc
EXTRA_DIST = $(pkgconfig_DATA:%=%.in)
SUBDIRS = common \
pengine \
cib \
services \
fencing \
lrmd \
cluster \
pacemaker
diff --git a/lib/cib/Makefile.am b/lib/cib/Makefile.am
index 1950744ff8..b8c80ff13f 100644
--- a/lib/cib/Makefile.am
+++ b/lib/cib/Makefile.am
@@ -1,30 +1,29 @@
#
# Copyright 2004-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
include $(top_srcdir)/mk/common.mk
## libraries
lib_LTLIBRARIES = libcib.la
## Library sources (*must* use += format for bumplibs)
libcib_la_SOURCES = cib_attrs.c
libcib_la_SOURCES += cib_client.c
libcib_la_SOURCES += cib_file.c
libcib_la_SOURCES += cib_native.c
libcib_la_SOURCES += cib_ops.c
libcib_la_SOURCES += cib_remote.c
libcib_la_SOURCES += cib_utils.c
libcib_la_LDFLAGS = -version-info 33:0:6
-libcib_la_CPPFLAGS = $(AM_CPPFLAGS)
+libcib_la_LDFLAGS += $(LDFLAGS_HARDENED_LIB)
libcib_la_CFLAGS = $(CFLAGS_HARDENED_LIB)
-libcib_la_LDFLAGS += $(LDFLAGS_HARDENED_LIB)
libcib_la_LIBADD = $(top_builddir)/lib/pengine/libpe_rules.la \
$(top_builddir)/lib/common/libcrmcommon.la
diff --git a/lib/cluster/tests/Makefile.am b/lib/cluster/tests/Makefile.am
index f4f5658a54..8b79476371 100644
--- a/lib/cluster/tests/Makefile.am
+++ b/lib/cluster/tests/Makefile.am
@@ -1,12 +1,14 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
+
SUBDIRS = \
cluster \
cpg
diff --git a/lib/cluster/tests/cluster/Makefile.am b/lib/cluster/tests/cluster/Makefile.am
index 072a4ee0f5..64d5e99cfe 100644
--- a/lib/cluster/tests/cluster/Makefile.am
+++ b/lib/cluster/tests/cluster/Makefile.am
@@ -1,18 +1,19 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
LDADD += $(top_builddir)/lib/cluster/libcrmcluster.la
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk_cluster_set_destroy_fn_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/cluster/tests/cpg/Makefile.am b/lib/cluster/tests/cpg/Makefile.am
index 625f943144..3ff4fecdeb 100644
--- a/lib/cluster/tests/cpg/Makefile.am
+++ b/lib/cluster/tests/cpg/Makefile.am
@@ -1,19 +1,20 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
LDADD += $(top_builddir)/lib/cluster/libcrmcluster.la
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk_cpg_set_confchg_fn_test \
pcmk_cpg_set_deliver_fn_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/Makefile.am b/lib/common/tests/Makefile.am
index b6a61136d5..e4898a5a21 100644
--- a/lib/common/tests/Makefile.am
+++ b/lib/common/tests/Makefile.am
@@ -1,41 +1,43 @@
#
# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
+
SUBDIRS = \
acl \
actions \
agents \
cmdline \
digest \
flags \
health \
io \
iso8601 \
lists \
messages \
nodes \
nvpair \
options \
output \
patchset \
probes \
resources \
results \
rules \
scheduler \
schemas \
scores \
strings \
utils \
xml \
xpath
if SUPPORT_PROCFS
SUBDIRS += procfs
endif
diff --git a/lib/common/tests/acl/Makefile.am b/lib/common/tests/acl/Makefile.am
index 19903dbc76..d8b8b06cbe 100644
--- a/lib/common/tests/acl/Makefile.am
+++ b/lib/common/tests/acl/Makefile.am
@@ -1,20 +1,21 @@
#
-# Copyright 2021-2023 the Pacemaker project contributors
+# Copyright 2021-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__is_user_in_group_test \
pcmk_acl_required_test \
xml_acl_denied_test \
xml_acl_enabled_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/actions/Makefile.am b/lib/common/tests/actions/Makefile.am
index 0dfe52194e..4f30585a7d 100644
--- a/lib/common/tests/actions/Makefile.am
+++ b/lib/common/tests/actions/Makefile.am
@@ -1,16 +1,17 @@
#
# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = parse_op_key_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/agents/Makefile.am b/lib/common/tests/agents/Makefile.am
index b3837d734f..ed30aaffad 100644
--- a/lib/common/tests/agents/Makefile.am
+++ b/lib/common/tests/agents/Makefile.am
@@ -1,20 +1,21 @@
#
-# Copyright 2020-2023 the Pacemaker project contributors
+# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = crm_generate_ra_key_test \
crm_parse_agent_spec_test \
pcmk__effective_rc_test \
pcmk_get_ra_caps_test \
pcmk_stonith_param_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/cmdline/Makefile.am b/lib/common/tests/cmdline/Makefile.am
index 792425b9f8..c4c174a3c6 100644
--- a/lib/common/tests/cmdline/Makefile.am
+++ b/lib/common/tests/cmdline/Makefile.am
@@ -1,18 +1,19 @@
#
-# Copyright 2020-2023 the Pacemaker project contributors
+# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__cmdline_preproc_test \
pcmk__new_common_args_test \
pcmk__quote_cmdline_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/digest/Makefile.am b/lib/common/tests/digest/Makefile.am
index ad1d9306e8..223a5053d3 100644
--- a/lib/common/tests/digest/Makefile.am
+++ b/lib/common/tests/digest/Makefile.am
@@ -1,16 +1,17 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = crm_md5sum_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/flags/Makefile.am b/lib/common/tests/flags/Makefile.am
index 22a101ab1b..6af5dd3213 100644
--- a/lib/common/tests/flags/Makefile.am
+++ b/lib/common/tests/flags/Makefile.am
@@ -1,19 +1,20 @@
#
-# Copyright 2020-2023 the Pacemaker project contributors
+# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__clear_flags_as_test \
pcmk__set_flags_as_test \
pcmk_all_flags_set_test \
pcmk_any_flags_set_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/health/Makefile.am b/lib/common/tests/health/Makefile.am
index ad2a2dad1f..ee02f7e2e8 100644
--- a/lib/common/tests/health/Makefile.am
+++ b/lib/common/tests/health/Makefile.am
@@ -1,17 +1,18 @@
#
-# Copyright 2022 the Pacemaker project contributors
+# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__parse_health_strategy_test \
pcmk__validate_health_strategy_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/io/Makefile.am b/lib/common/tests/io/Makefile.am
index f7519d8f3f..096466a229 100644
--- a/lib/common/tests/io/Makefile.am
+++ b/lib/common/tests/io/Makefile.am
@@ -1,17 +1,18 @@
#
-# Copyright 2020-2023 the Pacemaker project contributors
+# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__full_path_test \
pcmk__get_tmpdir_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/iso8601/Makefile.am b/lib/common/tests/iso8601/Makefile.am
index c57afef52f..eeef170445 100644
--- a/lib/common/tests/iso8601/Makefile.am
+++ b/lib/common/tests/iso8601/Makefile.am
@@ -1,22 +1,23 @@
#
# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = crm_time_add_days_test \
crm_time_add_years_test \
crm_time_parse_duration_test \
pcmk__add_time_from_xml_test \
pcmk__readable_interval_test \
pcmk__set_time_if_earlier_test \
pcmk__time_format_hr_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/lists/Makefile.am b/lib/common/tests/lists/Makefile.am
index 0fa1e153bd..519ee82c41 100644
--- a/lib/common/tests/lists/Makefile.am
+++ b/lib/common/tests/lists/Makefile.am
@@ -1,19 +1,20 @@
#
-# Copyright 2022-2023 the Pacemaker project contributors
+# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__list_of_1_test \
pcmk__list_of_multiple_test \
pcmk__subtract_lists_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/messages/Makefile.am b/lib/common/tests/messages/Makefile.am
index c6b387fdda..2b4182ddf8 100644
--- a/lib/common/tests/messages/Makefile.am
+++ b/lib/common/tests/messages/Makefile.am
@@ -1,17 +1,18 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__new_message_as_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/nodes/Makefile.am b/lib/common/tests/nodes/Makefile.am
index 6c4964e1d0..a7884658d1 100644
--- a/lib/common/tests/nodes/Makefile.am
+++ b/lib/common/tests/nodes/Makefile.am
@@ -1,24 +1,25 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__find_node_in_list_test \
pcmk__xe_add_node_test \
pcmk_cib_node_shutdown_test \
pcmk_foreach_active_resource_test \
pcmk_node_is_clean_test \
pcmk_node_is_in_maintenance_test \
pcmk_node_is_online_test \
pcmk_node_is_pending_test \
pcmk_node_is_shutting_down_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/nvpair/Makefile.am b/lib/common/tests/nvpair/Makefile.am
index 59d3788242..935460199d 100644
--- a/lib/common/tests/nvpair/Makefile.am
+++ b/lib/common/tests/nvpair/Makefile.am
@@ -1,22 +1,23 @@
#
# Copyright 2021-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = crm_meta_name_test \
crm_meta_value_test \
pcmk__xe_attr_is_true_test \
pcmk__xe_get_bool_attr_test \
pcmk__xe_get_datetime_test \
pcmk__xe_get_flags_test \
pcmk__xe_set_bool_attr_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/options/Makefile.am b/lib/common/tests/options/Makefile.am
index cc1008e587..539ace57be 100644
--- a/lib/common/tests/options/Makefile.am
+++ b/lib/common/tests/options/Makefile.am
@@ -1,18 +1,19 @@
#
-# Copyright 2022-2023 the Pacemaker project contributors
+# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__env_option_test \
pcmk__set_env_option_test \
pcmk__env_option_enabled_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/output/Makefile.am b/lib/common/tests/output/Makefile.am
index 30f149463f..0abe4d4683 100644
--- a/lib/common/tests/output/Makefile.am
+++ b/lib/common/tests/output/Makefile.am
@@ -1,24 +1,25 @@
#
-# Copyright 2021-2023 the Pacemaker project contributors
+# Copyright 2021-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__call_message_test \
pcmk__output_and_clear_error_test \
pcmk__output_free_test \
pcmk__output_new_test \
pcmk__register_format_test \
pcmk__register_formats_test \
pcmk__register_message_test \
pcmk__register_messages_test \
pcmk__unregister_formats_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/patchset/Makefile.am b/lib/common/tests/patchset/Makefile.am
index f027a16880..44f76c297b 100644
--- a/lib/common/tests/patchset/Makefile.am
+++ b/lib/common/tests/patchset/Makefile.am
@@ -1,16 +1,17 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__cib_element_in_patchset_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/probes/Makefile.am b/lib/common/tests/probes/Makefile.am
index f5a3fb4f81..5bb3c11914 100644
--- a/lib/common/tests/probes/Makefile.am
+++ b/lib/common/tests/probes/Makefile.am
@@ -1,18 +1,19 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk_is_probe_test \
pcmk_xe_is_probe_test \
pcmk_xe_mask_probe_failure_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/procfs/Makefile.am b/lib/common/tests/procfs/Makefile.am
index 75511f5c13..58555f64be 100644
--- a/lib/common/tests/procfs/Makefile.am
+++ b/lib/common/tests/procfs/Makefile.am
@@ -1,18 +1,19 @@
#
-# Copyright 2022 the Pacemaker project contributors
+# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__procfs_has_pids_false_test \
pcmk__procfs_has_pids_true_test \
pcmk__procfs_pid2path_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/resources/Makefile.am b/lib/common/tests/resources/Makefile.am
index 91e29a6f3a..934b985016 100644
--- a/lib/common/tests/resources/Makefile.am
+++ b/lib/common/tests/resources/Makefile.am
@@ -1,17 +1,18 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk_resource_id_test \
pcmk_resource_is_managed_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/results/Makefile.am b/lib/common/tests/results/Makefile.am
index a7d566362e..ec02619ebe 100644
--- a/lib/common/tests/results/Makefile.am
+++ b/lib/common/tests/results/Makefile.am
@@ -1,16 +1,17 @@
#
-# Copyright 2021-2023 the Pacemaker project contributors
+# Copyright 2021-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__results_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/rules/Makefile.am b/lib/common/tests/rules/Makefile.am
index 41630371da..0ad54d0cb1 100644
--- a/lib/common/tests/rules/Makefile.am
+++ b/lib/common/tests/rules/Makefile.am
@@ -1,29 +1,30 @@
#
# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__cmp_by_type_test \
pcmk__evaluate_attr_expression_test \
pcmk__evaluate_date_expression_test \
pcmk__evaluate_date_spec_test \
pcmk__evaluate_condition_test \
pcmk__evaluate_op_expression_test \
pcmk__evaluate_rsc_expression_test \
pcmk__parse_combine_test \
pcmk__parse_comparison_test \
pcmk__parse_source_test \
pcmk__parse_type_test \
pcmk__replace_submatches_test \
pcmk__unpack_duration_test \
pcmk_evaluate_rule_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/scheduler/Makefile.am b/lib/common/tests/scheduler/Makefile.am
index 6d5f4f8004..51bde6235e 100644
--- a/lib/common/tests/scheduler/Makefile.am
+++ b/lib/common/tests/scheduler/Makefile.am
@@ -1,19 +1,20 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk_get_dc_test \
pcmk_get_no_quorum_policy_test \
pcmk_has_quorum_test \
pcmk_set_scheduler_cib_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/schemas/Makefile.am b/lib/common/tests/schemas/Makefile.am
index 4b6ac2a5a5..4fb825aee5 100644
--- a/lib/common/tests/schemas/Makefile.am
+++ b/lib/common/tests/schemas/Makefile.am
@@ -1,86 +1,87 @@
#
# Copyright 2023-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
CFLAGS += -DPCMK__TEST_SCHEMA_DIR='"$(abs_builddir)/schemas"'
# Add "_test" to the end of all test program names to simplify .gitignore.
# These tests share a schema subdirectory
SHARED_SCHEMA_TESTS = pcmk__build_schema_xml_node_test \
pcmk__cmp_schemas_by_name_test \
pcmk__get_schema_test \
pcmk__schema_files_later_than_test \
pcmk__schema_init_test
# This test has its own schema directory
FIND_X_0_SCHEMA_TEST = pcmk__find_x_0_schema_test
check_PROGRAMS = $(SHARED_SCHEMA_TESTS) $(FIND_X_0_SCHEMA_TEST)
TESTS = $(check_PROGRAMS)
$(SHARED_SCHEMA_TESTS): setup-schema-dir
$(FIND_X_0_SCHEMA_TEST): setup-find_x_0-schema-dir
# Set up a temporary schemas/ directory containing only some of the full set of
# pacemaker schema files. This lets us know exactly how many schemas are present,
# allowing us to write tests without having to make changes when new schemas are
# added.
#
# This directory contains the following:
#
# * upgrade-*.xsl - Required by various schema versions
# * pacemaker-[0-9]*.rng - We're only pulling in 15 schemas, which is enough
# to get everything through pacemaker-3.0.rng. This
# includes 2.10, needed so we can check that versions
# are compared as numbers instead of strings.
# * other RNG files - This catches everything except the pacemaker-*rng
# files. These files are included by the top-level
# pacemaker-*rng files, so we need them for tests.
# This will glob more than we need, but the extra ones
# won't get in the way.
LINK_FILES = $(abs_top_builddir)/xml/upgrade-*.xsl
ROOT_RNGS = $(shell ls -1v $(abs_top_builddir)/xml/pacemaker-[0-9]*.rng | head -15)
INCLUDED_RNGS = $(shell ls -1 $(top_srcdir)/xml/*.rng | grep -v pacemaker-[0-9])
# Most tests share a common, read-only schema directory
.PHONY: setup-schema-dir
setup-schema-dir:
$(MKDIR_P) schemas
( cd schemas ; \
ln -sf $(LINK_FILES) . ; \
for f in $(ROOT_RNGS); do \
ln -sf $$f $$(basename $$f); \
done ; \
for f in $(INCLUDED_RNGS); do \
ln -sf ../$$f $$(basename $$f); \
done )
# pcmk__find_x_0_schema_test moves schema files around, so it needs its
# own directory, otherwise other tests run in parallel could fail.
.PHONY: setup-find_x_0-schema-dir
setup-find_x_0-schema-dir:
$(MKDIR_P) schemas/find_x_0
( cd schemas/find_x_0 ; \
ln -sf $(LINK_FILES) . ; \
for f in $(ROOT_RNGS); do \
ln -sf $$f $$(basename $$f); \
done ; \
for f in $(INCLUDED_RNGS); do \
ln -sf ../$$f $$(basename $$f); \
done )
.PHONY: clean-local
clean-local:
-rm -rf schemas
diff --git a/lib/common/tests/scores/Makefile.am b/lib/common/tests/scores/Makefile.am
index 5b9ddfbe57..a0895b181a 100644
--- a/lib/common/tests/scores/Makefile.am
+++ b/lib/common/tests/scores/Makefile.am
@@ -1,20 +1,21 @@
#
# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__add_scores_test \
pcmk_parse_score_test \
pcmk_readable_score_test \
pcmk_str_is_infinity_test \
pcmk_str_is_minus_infinity_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/strings/Makefile.am b/lib/common/tests/strings/Makefile.am
index 439b6bf392..e61f41f51d 100644
--- a/lib/common/tests/strings/Makefile.am
+++ b/lib/common/tests/strings/Makefile.am
@@ -1,40 +1,41 @@
#
# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = crm_get_msec_test \
crm_is_true_test \
crm_str_to_boolean_test \
pcmk__add_word_test \
pcmk__btoa_test \
pcmk__compress_test \
pcmk__ends_with_test \
pcmk__g_strcat_test \
pcmk__guint_from_hash_test \
pcmk__numeric_strcasecmp_test \
pcmk__parse_ll_range_test \
pcmk__s_test \
pcmk__scan_double_test \
pcmk__scan_ll_test \
pcmk__scan_min_int_test \
pcmk__scan_port_test \
pcmk__starts_with_test \
pcmk__str_any_of_test \
pcmk__str_in_list_test \
pcmk__str_table_dup_test \
pcmk__str_update_test \
pcmk__strcmp_test \
pcmk__strkey_table_test \
pcmk__strikey_table_test \
pcmk__trim_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/utils/Makefile.am b/lib/common/tests/utils/Makefile.am
index c4b81c115f..147f6d7b3b 100644
--- a/lib/common/tests/utils/Makefile.am
+++ b/lib/common/tests/utils/Makefile.am
@@ -1,23 +1,24 @@
#
# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = compare_version_test \
crm_user_lookup_test \
pcmk_daemon_user_test \
pcmk__fail_attr_name_test \
pcmk__failcount_name_test \
pcmk__getpid_s_test \
pcmk__lastfailure_name_test \
pcmk__realloc_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/xml/Makefile.am b/lib/common/tests/xml/Makefile.am
index 45dee0884c..94efcac42d 100644
--- a/lib/common/tests/xml/Makefile.am
+++ b/lib/common/tests/xml/Makefile.am
@@ -1,30 +1,31 @@
#
# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__xc_create_test \
pcmk__xe_copy_attrs_test \
pcmk__xe_first_child_test \
pcmk__xe_foreach_child_test \
pcmk__xe_get_score_test \
pcmk__xe_set_id_test \
pcmk__xe_set_score_test \
pcmk__xe_sort_attrs_test \
pcmk__xml_escape_test \
pcmk__xml_init_test \
pcmk__xml_is_name_char_test \
pcmk__xml_is_name_start_char_test \
pcmk__xml_needs_escape_test \
pcmk__xml_new_doc_test \
pcmk__xml_sanitize_id_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/common/tests/xpath/Makefile.am b/lib/common/tests/xpath/Makefile.am
index d4c504b63b..6fe9adc839 100644
--- a/lib/common/tests/xpath/Makefile.am
+++ b/lib/common/tests/xpath/Makefile.am
@@ -1,16 +1,17 @@
#
-# Copyright 2021-2023 the Pacemaker project contributors
+# Copyright 2021-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__xpath_node_id_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/pacemaker/tests/Makefile.am b/lib/pacemaker/tests/Makefile.am
index ad48fdd266..a0db39c182 100644
--- a/lib/pacemaker/tests/Makefile.am
+++ b/lib/pacemaker/tests/Makefile.am
@@ -1,11 +1,13 @@
#
-# Copyright 2020-2023 the Pacemaker project contributors
+# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
+
SUBDIRS = pcmk_resource \
pcmk_ticket
diff --git a/lib/pacemaker/tests/pcmk_resource/Makefile.am b/lib/pacemaker/tests/pcmk_resource/Makefile.am
index bed9a0ed18..b85a0cf8d2 100644
--- a/lib/pacemaker/tests/pcmk_resource/Makefile.am
+++ b/lib/pacemaker/tests/pcmk_resource/Makefile.am
@@ -1,20 +1,21 @@
#
# Copyright 2023-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
LDADD += $(top_builddir)/lib/pacemaker/libpacemaker.la
LDADD += $(top_builddir)/lib/cib/libcib.la
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk_resource_delete_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/pacemaker/tests/pcmk_ticket/Makefile.am b/lib/pacemaker/tests/pcmk_ticket/Makefile.am
index d9660a08ad..ec8aec27b8 100644
--- a/lib/pacemaker/tests/pcmk_ticket/Makefile.am
+++ b/lib/pacemaker/tests/pcmk_ticket/Makefile.am
@@ -1,27 +1,28 @@
#
# Copyright 2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
LDADD += $(top_builddir)/lib/pacemaker/libpacemaker.la
LDADD += $(top_builddir)/lib/cib/libcib.la
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pcmk__get_ticket_state_test \
pcmk_ticket_constraints_test \
pcmk_ticket_delete_test \
pcmk_ticket_get_attr_test \
pcmk_ticket_info_test \
pcmk_ticket_remove_attr_test \
pcmk_ticket_set_attr_test \
pcmk_ticket_state_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/pengine/tests/Makefile.am b/lib/pengine/tests/Makefile.am
index 52a0ff6304..7f156e85b7 100644
--- a/lib/pengine/tests/Makefile.am
+++ b/lib/pengine/tests/Makefile.am
@@ -1,14 +1,15 @@
#
# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+
+include $(top_srcdir)/mk/common.mk
SUBDIRS = native \
status \
unpack \
utils
diff --git a/lib/pengine/tests/native/Makefile.am b/lib/pengine/tests/native/Makefile.am
index 0b5106ea1a..bbd6cc51b8 100644
--- a/lib/pengine/tests/native/Makefile.am
+++ b/lib/pengine/tests/native/Makefile.am
@@ -1,21 +1,22 @@
#
# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
LDADD += $(top_builddir)/lib/pengine/libpe_status_test.la
AM_TESTS_ENVIRONMENT += PCMK_CTS_CLI_DIR=$(top_srcdir)/cts/cli
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = native_find_rsc_test \
pe_base_name_eq_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/pengine/tests/status/Makefile.am b/lib/pengine/tests/status/Makefile.am
index f91d150b6d..e95f51a74a 100644
--- a/lib/pengine/tests/status/Makefile.am
+++ b/lib/pengine/tests/status/Makefile.am
@@ -1,21 +1,22 @@
#
# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
LDADD += $(top_builddir)/lib/pengine/libpe_status_test.la
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pe_find_node_any_test \
pe_find_node_id_test \
pe_new_working_set_test \
set_working_set_defaults_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/pengine/tests/unpack/Makefile.am b/lib/pengine/tests/unpack/Makefile.am
index baa8633984..3d48cf8b50 100644
--- a/lib/pengine/tests/unpack/Makefile.am
+++ b/lib/pengine/tests/unpack/Makefile.am
@@ -1,18 +1,19 @@
#
-# Copyright 2022 the Pacemaker project contributors
+# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
LDADD += $(top_builddir)/lib/pengine/libpe_status_test.la
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pe_base_name_end_test
TESTS = $(check_PROGRAMS)
diff --git a/lib/pengine/tests/utils/Makefile.am b/lib/pengine/tests/utils/Makefile.am
index 64421e261f..4f15ae4ef8 100644
--- a/lib/pengine/tests/utils/Makefile.am
+++ b/lib/pengine/tests/utils/Makefile.am
@@ -1,20 +1,21 @@
#
-# Copyright 2022-2023 the Pacemaker project contributors
+# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/tap.mk
include $(top_srcdir)/mk/unittest.mk
AM_CPPFLAGS += -I$(top_srcdir)/lib/pengine
LDADD += $(top_builddir)/lib/pengine/libpe_status_test.la
# Add "_test" to the end of all test program names to simplify .gitignore.
check_PROGRAMS = pe__cmp_node_name_test \
pe__cmp_rsc_priority_test
TESTS = $(check_PROGRAMS)
diff --git a/maint/Makefile.am b/maint/Makefile.am
index ca9a0392cd..47c29a8c8a 100644
--- a/maint/Makefile.am
+++ b/maint/Makefile.am
@@ -1,79 +1,80 @@
#
-# Copyright 2019-2023 the Pacemaker project contributors
+# Copyright 2019-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
# Define release-related variables
include $(abs_srcdir)/../mk/release.mk
+include $(top_srcdir)/mk/common.mk
noinst_SCRIPTS = bumplibs
EXTRA_DIST = README
#
# Change log generation
#
# Count changes in these directories
CHANGELOG_DIRS = ../include \
../lib \
../daemons \
../tools \
../xml
.PHONY: require_last_release
require_last_release:
@if [ -z "$(CHECKOUT)" ]; then \
echo "This target must be run from a git checkout"; \
exit 1; \
elif ! "$(GIT)" rev-parse $(LAST_RELEASE) >/dev/null 2>&1; then \
echo "LAST_RELEASE must be set to a valid git tag"; \
exit 1; \
fi
.PHONY: summary
summary: require_last_release
@printf "* %s %s <%s> %s\n" "$$(date +'%a %b %d %Y')" \
"$$("$(GIT)" config user.name)" \
"$$("$(GIT)" config user.email)" \
"$(NEXT_RELEASE)"
@printf "\055 %d commits with%s\n" \
"$$("$(GIT)" log --pretty=oneline --no-merges \
$(LAST_RELEASE)..HEAD | wc -l)" \
"$$("$(GIT)" diff $(LAST_RELEASE)..HEAD --shortstat \
$(CHANGELOG_DIRS))"
.PHONY: changes
changes: summary
@printf "\n- Features added since $(LAST_RELEASE)\n"
@"$(GIT)" log --pretty=format:'%s' --no-merges \
--abbrev-commit $(LAST_RELEASE)..HEAD \
| sed -n -e 's/^ *Feature: */ + /p' | sort -uf
@printf "\n- Fixes since $(LAST_RELEASE)\n"
@"$(GIT)" log --pretty=format:'%s' --no-merges \
--abbrev-commit $(LAST_RELEASE)..HEAD \
| sed -n -e 's/^ *\(Fix\|High\|Bug\): */ + /p' | sed \
-e 's/\(cib\|pacemaker-based\|based\):/CIB:/' \
-e 's/\(lrmd\|pacemaker-execd\|execd\):/executor:/' \
-e 's/\(crmd\|pacemaker-controld\|controld\):/controller:/' \
-e 's/\(Fencing\|stonithd?\|pacemaker-fenced\|fenced\):/fencing:/' \
-e 's/\(PE\|pengine\|pacemaker-schedulerd\|schedulerd\):/scheduler:/' \
| sort -uf
@printf "\n- Public API changes since $(LAST_RELEASE)\n"
@"$(GIT)" log --pretty=format:'%s' --no-merges \
--abbrev-commit $(LAST_RELEASE)..HEAD \
| sed -n -e 's/^ *API: */ + /p' | sort -uf
.PHONY: changelog
changelog: require_last_release
@printf "%s\n\n%s\n" \
"$$($(MAKE) $(AM_MAKEFLAGS) changes \
| grep -v 'make\(\[[0-9]*\]\)\?:')" \
"$$(cat ../ChangeLog)" > ../ChangeLog
.PHONY: authors
authors: require_last_release
"$(GIT)" log $(LAST_RELEASE)..$(COMMIT) --format='%an' | sort -u
diff --git a/mk/unittest.mk b/mk/unittest.mk
index f563ea3fd4..53e20fb68b 100644
--- a/mk/unittest.mk
+++ b/mk/unittest.mk
@@ -1,28 +1,26 @@
#
# Copyright 2022-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-AM_CPPFLAGS = -I$(top_builddir)/include \
- -I$(top_srcdir)/include \
- -I$(top_srcdir)/lib/common
+AM_CPPFLAGS += -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
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
diff --git a/python/Makefile.am b/python/Makefile.am
index 558c2e91f9..7d2508434f 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -1,26 +1,25 @@
#
# Copyright 2023-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/python.mk
-MAINTAINERCLEANFILES = Makefile.in
-
EXTRA_DIST = pylintrc
SUBDIRS = pacemaker \
tests
PYCHECKFILES ?= $(SUBDIRS)
.PHONY: check-local
check-local:
if [ "x$(top_srcdir)" != "x$(top_builddir)" ]; then \
cp -r $(top_srcdir)/python/* $(abs_top_builddir)/python/; \
fi
PYTHONPATH=$(top_builddir)/python $(PYTHON) -m unittest discover -v -s $(top_builddir)/python/tests
diff --git a/python/pacemaker/Makefile.am b/python/pacemaker/Makefile.am
index 99a137ad78..27e6d6888f 100644
--- a/python/pacemaker/Makefile.am
+++ b/python/pacemaker/Makefile.am
@@ -1,18 +1,18 @@
#
# Copyright 2023-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+include $(top_srcdir)/mk/common.mk
pkgpython_PYTHON = __init__.py \
_library.py \
exitstatus.py
nodist_pkgpython_PYTHON = buildoptions.py
SUBDIRS = _cts
diff --git a/python/pacemaker/_cts/Makefile.am b/python/pacemaker/_cts/Makefile.am
index efb00193ca..45997ccea9 100644
--- a/python/pacemaker/_cts/Makefile.am
+++ b/python/pacemaker/_cts/Makefile.am
@@ -1,16 +1,16 @@
#
-# Copyright 2023 the Pacemaker project contributors
+# Copyright 2023-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+include $(top_srcdir)/mk/common.mk
pkgpythondir = $(pythondir)/$(PACKAGE)/_cts
pkgpython_PYTHON = $(wildcard *.py)
SUBDIRS = tests
diff --git a/python/pacemaker/_cts/tests/Makefile.am b/python/pacemaker/_cts/tests/Makefile.am
index 0dba74ba40..28ce9908a5 100644
--- a/python/pacemaker/_cts/tests/Makefile.am
+++ b/python/pacemaker/_cts/tests/Makefile.am
@@ -1,14 +1,14 @@
#
-# Copyright 2023 the Pacemaker project contributors
+# Copyright 2023-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+include $(top_srcdir)/mk/common.mk
pkgpythondir = $(pythondir)/$(PACKAGE)/_cts/tests
pkgpython_PYTHON = $(wildcard *.py)
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am
index 219812cc5d..b0d46c0e80 100644
--- a/python/tests/Makefile.am
+++ b/python/tests/Makefile.am
@@ -1,13 +1,13 @@
#
-# Copyright 2023 the Pacemaker project contributors
+# Copyright 2023-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
-MAINTAINERCLEANFILES = Makefile.in
+include $(top_srcdir)/mk/common.mk
EXTRA_DIST = $(wildcard test_*) \
__init__.py
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8601e1ba09..fd68f9ea40 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,22 +1,24 @@
#
-# Copyright 2020-2023 the Pacemaker project contributors
+# Copyright 2020-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
# This source code is licensed under the GNU General Public License version 2
# or later (GPLv2+) WITHOUT ANY WARRANTY.
#
+include $(top_srcdir)/mk/common.mk
+
# tap-test is copied from /usr/share/automake-*/tap-driver.sh.
EXTRA_DIST = tap-driver.sh \
tap-test \
test-headers.sh
.PHONY: check
check: check-headers
.PHONY: check-headers
check-headers:
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CC="$(CC)" \
CXX="$(CXX)" CPPFLAGS="$(CPPFLAGS) -I$(top_builddir)/include" LIBS="$(LIBS)" \
SRCDIR="$(top_srcdir)" sh "$(srcdir)/test-headers.sh"