Disable cmocka tests on non-Linux hosts

pull/22/head
nirenjan 2020-06-17 16:00:25 -07:00
parent 3afe999fe8
commit e9167b4c20
2 changed files with 16 additions and 2 deletions

View File

@ -17,6 +17,17 @@ LT_INIT
PKG_PROG_PKG_CONFIG
PKG_INSTALLDIR
AX_COMPILER_FLAGS
AC_CANONICAL_HOST
AC_MSG_NOTICE([Detected host OS is ${host_os}])
build_linux=no
# Detect target system
case "${host_os}" in
linux*)
build_linux=yes
;;
esac
AM_CONDITIONAL([LINUX], [test "x${build_linux}" = "xyes"])
# Internationalization
AM_GNU_GETTEXT([external])
@ -62,10 +73,11 @@ AM_COND_IF([HAVE_DOXYGEN],
[AC_CONFIG_FILES([Doxyfile])],
[AC_MSG_WARN(["Doxygen not found; continuing without doxygen support"])])
# cmocka unit tests
# cmocka unit tests, currently only supported on Linux
AX_PKG_CHECK_MODULES([CMOCKA], [cmocka], [], [have_cmocka=yes], [have_cmocka=no])
AM_CONDITIONAL([HAVE_CMOCKA], [test "x$have_cmocka" = xyes])
AM_COND_IF([HAVE_CMOCKA], [],
AM_COND_IF([HAVE_CMOCKA], [AM_COND_IF([LINUX], [],
[AC_MSG_WARN(["cmocka found, but cannot build on ${host_os}])])],
[AC_MSG_WARN(["cmocka not found; disabling unit test build"])])
# Check for the presence of tm_gmtoff in struct tm. If we have this, then we

View File

@ -31,6 +31,7 @@ x52include_HEADERS = libx52.h
# pkg-config files
pkgconfig_DATA = libx52.pc
if LINUX
if HAVE_CMOCKA
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
TESTS = libx52test
@ -47,6 +48,7 @@ CLEANFILES = test_libx52.c
test_libx52.c: $(srcdir)/x52_test_gen.py $(srcdir)/x52_tests.json
$(AM_V_GEN) $(PYTHON) $(srcdir)/x52_test_gen.py $(srcdir)/x52_tests.json > $@
endif
endif
# Extra files that need to be in the distribution
EXTRA_DIST = libx52.h x52_commands.h x52_common.h README.md