[gstreamermm] Tests: fix build and dist unittests



commit b46d8872ba1b382bd2857ba1e941e1ce2d8ff2dc
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Mon Sep 26 20:08:02 2016 +0200

    Tests: fix build and dist unittests

 Makefile.am       |   11 ++++++++++-
 configure.ac      |   27 ++++++++++-----------------
 tests/Makefile.am |   30 +++---------------------------
 3 files changed, 23 insertions(+), 45 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 7d8209e..1e55607 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,7 +16,16 @@
 ACLOCAL_AMFLAGS = -I build ${ACLOCAL_FLAGS}
 DISTCHECK_CONFIGURE_FLAGS = --enable-warnings=fatal
 
-EXTRA_DIST =  tests/plugins/foo.h tests/regression/utils.h tests/regression/pluginbin.h 
tests/resources/input-image.png
+EXTRA_DIST = \
+       tests/plugins/foo.h \
+       tests/regression/utils.h \
+       tests/regression/pluginbin.h \
+       tests/resources/input-image.png \
+       tests/mmtest.h \
+       tests/plugins/derivedfromappsink.h \
+       tests/plugins/derivedfromappsrc.h \
+       tests/plugins/derivedfrombasetransform.h
+
 srcmm_subdirs = gstreamer/gstreamermm
 pkgconfig_files = gstreamer/$(GSTREAMERMM_MODULE_NAME).pc
 gstreamermm_include_HEADERS = gstreamer/gstreamermm.h
diff --git a/configure.ac b/configure.ac
index faa36be..82474f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,26 +97,19 @@ MM_ARG_WITH_TAGFILE_DOC([cairomm-1.0.tag], [cairomm-1.0])
 MM_ARG_WITH_TAGFILE_DOC([pangomm-1.4.tag], [pangomm-1.4])
 
 AC_ARG_ENABLE(unittests,
-       AS_HELP_STRING([--disable-unittests], 
-       [Disable unit tests]),
-       [enable_unittests=no],
-       [enable_unittests=yes])
+       AS_HELP_STRING([--enable-unittests=@<:@yes/no/auto@:>@], 
+       [Enable unit tests]),
+       [enable_unittests=$enableval],
+       [enable_unittests=auto])
+
+AS_IF([test "$enable_unittests" != no],[
+       AC_CHECK_LIB([gtest_main], [main], [have_gtest=yes],[have_gtest=no])
+       AS_IF([test "$enable_unittests" = "yes" && test "$have_gtest" = "no"],
+               AC_MSG_FAILURE([Unit tests are enabled so gtest library is required for building unit 
tests.])], [enable_unittests=$have_gtest)
+])
 
 AC_SUBST([ENABLE_UNITTESTS], ["$enable_unittests"])
 
-if test "x$enable_unittests" = xyes; then
-  AC_CHECK_PROG([CURL], [curl], [curl])
-  AC_CHECK_PROG([WGET], [wget], [wget])
-  AC_CHECK_PROG([UNZIP], [unzip], [unzip])
-  AS_VAR_IF([UNZIP], [], [AC_MSG_FAILURE([[Unit tests are enabled so unzip is required for building unit 
tests.]])])
-  AS_VAR_IF([CURL], [], [
-    AS_VAR_IF([WGET], [],[
-      AC_MSG_FAILURE([[
-        Unit tests are enabled so either curl or wget is required for building unit tests.
-        ]])
-    ])
-  ])
-fi
 
 #########################################################################
 #  Plug-in processing
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 80e08d7..6bcdf05 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,10 +15,9 @@
 
 gstreamermm_includes = -I$(top_builddir)/gstreamer $(if $(srcdir:.=),-I$(top_srcdir)/gstreamer)
 local_libgstreamermm = $(top_builddir)/gstreamer/gstreamermm/libgstreamermm-$(GSTREAMERMM_API_VERSION).la
-gtest_includes = -I$(srcdir)/gtest/googletest-release-1.7.0 
-I$(srcdir)/gtest/googletest-release-1.7.0/include
-AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir) $(gstreamermm_includes) $(gtest_includes) $(GSTREAMERMM_CFLAGS) 
-std=c++0x -Wall -Werror -Wextra
+AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir) $(gstreamermm_includes) $(GSTREAMERMM_CFLAGS) -std=c++0x -Wall 
-Werror -Wextra
 AM_CXXFLAGS = $(GSTREAMERMM_WXXFLAGS) -g -Wno-missing-field-initializers
-LDADD = $(GSTREAMERMM_LIBS) $(local_libgstreamermm) -lpthread
+LDADD = $(GSTREAMERMM_LIBS) $(local_libgstreamermm) -lgtest -lpthread
 
 check_PROGRAMS =                                \
         test-allocator                          \
@@ -62,11 +61,9 @@ check_PROGRAMS =                                \
 
 # Include run of test programs in check:
 TESTS = $(check_PROGRAMS)
-TEST_GTEST_SOURCES = main.cc gtest/googletest-release-1.7.0/src/gtest-all.cc
+TEST_GTEST_SOURCES = main.cc
 TEST_REGRESSION_UTILS = regression/utils.cc
 
-$(TEST_GTEST_SOURCES): release-1.7.0.zip
-
 test_allocator_SOURCES                          = $(TEST_GTEST_SOURCES) test-allocator.cc
 test_atomicqueue_SOURCES                        = $(TEST_GTEST_SOURCES) test-atomicqueue.cc
 test_bin_SOURCES                                = $(TEST_GTEST_SOURCES) test-bin.cc
@@ -103,24 +100,3 @@ test_regression_binplugin_SOURCES               = $(TEST_GTEST_SOURCES) regressi
 test_regression_rewritefile_SOURCES             = $(TEST_GTEST_SOURCES) $(TEST_REGRESSION_UTILS) 
regression/test-regression-rewritefile.cc
 test_regression_seekonstartup_SOURCES           = $(TEST_GTEST_SOURCES) $(TEST_REGRESSION_UTILS) 
regression/test-regression-seekonstartup.cc
 test_regression_videoduration_SOURCES           = $(TEST_GTEST_SOURCES) $(TEST_REGRESSION_UTILS) 
regression/test-regression-videoduration.cc 
-
-download_curl = $(CURL) --compressed --connect-timeout 300 -g -L -m 3600 -R --retry 5 \
-               $(if $(wildcard $@),-z $@) -o $@
-download_wget = $(WGET) -N -nd -T 300 -t 5 -P $(dir $@)
-gtest_url = https://github.com/google/googletest/archive/release-1.7.0.zip
-
-release-1.7.0.zip:
-       $(AM_V_GEN)$(if $(filter no,$(ENABLE_UNITTESTS)),\
-       echo 'Error: $@ does not exist.';\
-       echo 'Unit tests are disabled.';\
-       echo 'Please run configure script without --disable-unittests flag.' >&2;\
-       exit 1;,\
-       $(if\
-       $(CURL),$(download_curl) '$(gtest_url)',$(if\
-       $(WGET),$(download_wget) '$(gtest_url)',test -f $@))); \
-       $(AM_V_GEN)unzip -nq -d gtest release-1.7.0.zip
-
-check_DATA = gtest
-CLEANFILES = release-1.7.0.zip
-clean-local:
-       rm -rf gtest


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]