From: David Sommerseth <[email protected]> Commit 40cb4cfc5d01110 added infrastructure to write unit tests using cmocka. This was implemented using a git submodule to fetch an up-to-date cmocka test framework.
The issue which appeared was that 'make check' stopped working if the cmocka submodule was not initialized and updated. As we do not want this to be a hard depenency, this patch makes running these unit tests conditional. If cmocka has not been initialized, skip them or if it has been initialized all unit tests will be run. Signed-off-by: David Sommerseth <[email protected]> --- configure.ac | 3 +++ tests/unit_tests/Makefile.am | 2 ++ vendor/Makefile.am | 2 ++ 3 files changed, 7 insertions(+) diff --git a/configure.ac b/configure.ac index 5e69f91..fa0f868 100644 --- a/configure.ac +++ b/configure.ac @@ -1211,6 +1211,9 @@ TEST_CFLAGS="-I\$(top_srcdir)/include -I\$(abs_top_builddir)/vendor/dist/include AC_SUBST([TEST_LDFLAGS]) AC_SUBST([TEST_CFLAGS]) +# Check if cmocka git submodule is initialized +AM_CONDITIONAL([CMOCKA_INITIALIZED], [test -f vendor/cmocka/CMakeLists.txt]) + AC_CONFIG_FILES([ version.sh Makefile diff --git a/tests/unit_tests/Makefile.am b/tests/unit_tests/Makefile.am index e076db8..8868c1c 100644 --- a/tests/unit_tests/Makefile.am +++ b/tests/unit_tests/Makefile.am @@ -1,3 +1,5 @@ AUTOMAKE_OPTIONS = foreign +if CMOCKA_INITIALIZED SUBDIRS = example_test plugins +endif diff --git a/vendor/Makefile.am b/vendor/Makefile.am index f68240e..84656a1 100644 --- a/vendor/Makefile.am +++ b/vendor/Makefile.am @@ -15,7 +15,9 @@ distdir: libcmocka: distdir mkdir -p $(cmockabuild) +if CMOCKA_INITIALIZED (cd $(cmockabuild) && cmake -DCMAKE_INSTALL_PREFIX=$(cmockainstall) $(cmockasrc) && make && make install) +endif check: libcmocka -- 1.8.3.1
