Add core cmocka framework

Initial integration with cmocka.

The intent is to first apply this to the xrdp unit tests, but until
something uses it directly we'll hold off on updating the Makefile.
This commit is contained in:
Nexarian
2023-02-04 15:14:22 -05:00
parent 7542dfc4f2
commit ddba7a317a
3 changed files with 15 additions and 6 deletions
+11 -4
View File
@@ -519,14 +519,22 @@ AC_CHECK_HEADER([X11/extensions/Xrandr.h], [],
CFLAGS="$save_CFLAGS"
# perform unit tests if libcheck found
# perform unit tests if libcheck and libmocka found
perform_unit_tests=yes; # Assume packages will be found
if test "x$ensure_tests_deps" == "xyes"; then
PKG_CHECK_MODULES([CHECK], [check >= 0.10.0],
[perform_unit_tests=yes],
[],
[AC_MSG_ERROR([please install check, the unit test framework])])
# Check if cmocka is available - needed for unit testing
PKG_CHECK_MODULES([CMOCKA], [cmocka],
[],
[AC_MSG_ERROR([please install cmocka, the mocking framework])])
else
PKG_CHECK_MODULES([CHECK], [check >= 0.10.0],
[perform_unit_tests=yes],
[],
[perform_unit_tests=no])
PKG_CHECK_MODULES([CMOCKA], [cmocka],
[],
[perform_unit_tests=no])
fi
@@ -643,4 +651,3 @@ echo " LDFLAGS = $LDFLAGS"
echo '#define XRDP_CONFIGURE_OPTIONS \' > ./xrdp_configure_options.h
./config.status --config | xargs -n 1 | sed -e 's/^/" /' -e 's/$/\\n" \\/' >> ./xrdp_configure_options.h
echo '""' >> ./xrdp_configure_options.h