HomeClusterLabs Projects

Build: Don't build the hostname unit test if it can't be mocked.

Description

Build: Don't build the hostname unit test if it can't be mocked.

FreeBSD doesn't let me wrap the uname function so it can't be mocked.
uname is defined as a static inline function in sys/utsname.h, which
means including that header in the unit test puts the uname function
into the unit test as well. You can't wrap a function that's in the
same compilation unit, so this won't work.

And then there's also a uname function in the c library as well, but
that's deprecated and there for backwards compatibility. So, there's
not really any good way to wrap uname.

Instead, disable pcmk_hostname_test on FreeBSD. But because we don't
want to rely on checking OS, instead add an autoconf test that sees if
__wrap_uname would even be called. If not, don't add
pcmk_hostname_test to the list of unit tests to be run.

Details

Provenance
clumensAuthored on Sep 9 2021, 4:04 PM
Parents
rPcfbd7c02b0eb: Test: Define assert_float_equal if it doesn't already exist.
Branches
Unknown
Tags
Unknown

Event Timeline