HomeClusterLabs Projects

Test: libcrmcommon: Build a special libcrmcommon_test.a library.

Description

Test: libcrmcommon: Build a special libcrmcommon_test.a library.

This library is like libcrmcommon except:

  • It does not get installed.
  • It includes the mock.c file from the previous commit.
  • It marks several functions as wrapped, which means they will only be resolved by the weak references in mock.c or by strong references in a unit test.

Note that this library will always be built, essentially doubling the
build time for the lib/common directory. It is possible to
conditionalize building this library, but because we always do "make
check" in the RPM build process, I'm not sure how useful doing so really
is.

It may be useful to have a conditional for day-to-day development, but
that means you'd have to re-run ./configure with the right options in
order to run the test cases. That seems likely to just discourage the
use of "make check".

Also, note the addition of the mock.mk file here - this is a Makefile
chunk that can be included in other Makefiles. It includes the special
LDFLAGS necessary to tell the linker to do the wrapping. It is
intended that all mocked functions in libcrmcommon will be listed in
this file, and it will be included in all Makefiles that use any mocked
functions.

Details

Provenance
clumensAuthored on Sep 1 2021, 2:49 PM
Parents
rPfb3086744a71: Test: libcrmcommon: Add a file of mocked function stubs.
Branches
Unknown
Tags
Unknown