[gstreamermm] tests: download gtest sources from its website
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] tests: download gtest sources from its website
- Date: Fri, 31 Jul 2015 11:47:18 +0000 (UTC)
commit f4e3b7aaf95fb51f768436ef163a95c015a594d4
Author: Marcin Kolny <marcin kolny flytronic pl>
Date: Fri Jul 31 12:38:19 2015 +0200
tests: download gtest sources from its website
Quote from bug report:
> According to Google Test FAQ [1], linking with pre-compiled gtest is no
> longer recommended. Autoconf script bundled with gtest [2] is considered
> deprecated and thus system package maintainers use it as an excuse to make
> it unusable (at least Ubuntu 14.04 does so - they don't provide a proper
> gtest-config file).
https://bugzilla.gnome.org/show_bug.cgi?id=750602
* .gitignore: add downloaded files to ignore list.
* configure.ac: add --disable-unittests flag to configuration script.
* tests/Makefile.am: add gtest sources to test builds.
.gitignore | 8 +++-
configure.ac | 23 +++++++++++++
tests/Makefile.am | 95 +++++++++++++++++++++++++++++++++-------------------
3 files changed, 89 insertions(+), 37 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 5df7680..a011f66 100644
--- a/.gitignore
+++ b/.gitignore
@@ -530,12 +530,16 @@ gst-plugins-bad/gstreamermm-plugins-bad/glfilter.h
gst-plugins-bad/gstreamermm-plugins-bad/wrap_init.cc
gst-plugins-bad/gstreamermm-*.pc
+#tests/ gtest files
+tests/gtest.zip
+tests/gtest
+
#tests/
tests/test-allocator
tests/test-atomicqueue
tests/test-bin
-tests/test-buffert
-ests/test-bus
+tests/test-buffer
+tests/test-bus
tests/test-caps
tests/test-capsfeatures
tests/test-ghostpad
diff --git a/configure.ac b/configure.ac
index 9e6a3ae..14e00b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,28 @@ MM_ARG_WITH_TAGFILE_DOC([glibmm-2.4.tag], [glibmm-2.4])
MM_ARG_WITH_TAGFILE_DOC([cairomm-1.0.tag], [cairomm-1.0])
MM_ARG_WITH_TAGFILE_DOC([pangomm-1.4.tag], [pangomm-1.4])
+enable_unittests=yes
+AC_ARG_ENABLE(unittests,
+ AS_HELP_STRING([--disable-unittests],
+ [Disable unit tests]),
+ [enable_unittests = no])
+
+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
#########################################################################
@@ -222,5 +244,6 @@ ${PACKAGE}-${VERSION}
Extra features
GUI Examples: ${gstmm_enable_gui_examples}
+ Unit Tests: ${enable_unittests}
EOF
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4cdc224..e961d5b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,10 +15,10 @@
gstreamermm_includes = -I$(top_builddir)/gstreamer $(if $(srcdir:.=),-I$(top_srcdir)/gstreamer)
local_libgstreamermm = $(top_builddir)/gstreamer/gstreamermm/libgstreamermm-$(GSTREAMERMM_API_VERSION).la
-
-AM_CPPFLAGS = -I$(top_builddir) $(gstreamermm_includes) $(GSTREAMERMM_CFLAGS) -std=c++0x -Wall -Werror
-Wextra
-AM_CXXFLAGS = $(GSTREAMERMM_WXXFLAGS) -g
-LDADD = $(GSTREAMERMM_LIBS) $(local_libgstreamermm) -lgtest -lpthread
+gtest_includes = -I$(srcdir)/gtest/gtest-1.7.0 -I$(srcdir)/gtest/gtest-1.7.0/include
+AM_CPPFLAGS = -I$(top_builddir) $(gstreamermm_includes) $(gtest_includes) $(GSTREAMERMM_CFLAGS) -std=c++0x
-Wall -Werror -Wextra
+AM_CXXFLAGS = $(GSTREAMERMM_WXXFLAGS) -g -Wno-missing-field-initializers
+LDADD = $(GSTREAMERMM_LIBS) $(local_libgstreamermm) -lpthread
check_PROGRAMS = \
test-allocator \
@@ -58,38 +58,63 @@ check_PROGRAMS = \
# Include run of test programs in check:
TESTS = $(check_PROGRAMS)
-TEST_MAIN_SOURCE = main.cc
+TEST_GTEST_SOURCES = main.cc gtest/gtest-1.7.0/src/gtest-all.cc
TEST_REGRESSION_UTILS = regression/utils.cc
-test_allocator_SOURCES = test-allocator.cc
$(TEST_MAIN_SOURCE)
-test_atomicqueue_SOURCES = test-atomicqueue.cc
$(TEST_MAIN_SOURCE)
-test_bin_SOURCES = test-bin.cc
$(TEST_MAIN_SOURCE)
-test_buffer_SOURCES = test-buffer.cc
$(TEST_MAIN_SOURCE)
-test_bus_SOURCES = test-bus.cc
$(TEST_MAIN_SOURCE)
-test_capsfeatures_SOURCES = test-capsfeatures.cc
$(TEST_MAIN_SOURCE)
-test_caps_SOURCES = test-caps.cc
$(TEST_MAIN_SOURCE)
-test_ghostpad_SOURCES = test-ghostpad.cc
$(TEST_MAIN_SOURCE)
-test_init_SOURCES = test-init.cc
$(TEST_MAIN_SOURCE)
-test_memory_SOURCES = test-memory.cc
$(TEST_MAIN_SOURCE)
-test_message_SOURCES = test-message.cc
$(TEST_MAIN_SOURCE)
-test_miniobject_SOURCES = test-miniobject.cc
$(TEST_MAIN_SOURCE)
-test_pad_SOURCES = test-pad.cc
$(TEST_MAIN_SOURCE)
-test_pipeline_SOURCES = test-pipeline.cc
$(TEST_MAIN_SOURCE)
-test_query_SOURCES = test-query.cc
$(TEST_MAIN_SOURCE)
-test_structure_SOURCES = test-structure.cc
$(TEST_MAIN_SOURCE)
-test_taglist_SOURCES = test-taglist.cc
$(TEST_MAIN_SOURCE)
-test_urihandler_SOURCES = test-urihandler.cc
$(TEST_MAIN_SOURCE)
+$(TEST_GTEST_SOURCES): gtest
+
+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
+test_buffer_SOURCES = $(TEST_GTEST_SOURCES) test-buffer.cc
+test_bus_SOURCES = $(TEST_GTEST_SOURCES) test-bus.cc
+test_capsfeatures_SOURCES = $(TEST_GTEST_SOURCES) test-capsfeatures.cc
+test_caps_SOURCES = $(TEST_GTEST_SOURCES) test-caps.cc
+test_ghostpad_SOURCES = $(TEST_GTEST_SOURCES) test-ghostpad.cc
+test_init_SOURCES = $(TEST_GTEST_SOURCES) test-init.cc
+test_memory_SOURCES = $(TEST_GTEST_SOURCES) test-memory.cc
+test_message_SOURCES = $(TEST_GTEST_SOURCES) test-message.cc
+test_miniobject_SOURCES = $(TEST_GTEST_SOURCES) test-miniobject.cc
+test_pad_SOURCES = $(TEST_GTEST_SOURCES) test-pad.cc
+test_pipeline_SOURCES = $(TEST_GTEST_SOURCES) test-pipeline.cc
+test_query_SOURCES = $(TEST_GTEST_SOURCES) test-query.cc
+test_structure_SOURCES = $(TEST_GTEST_SOURCES) test-structure.cc
+test_taglist_SOURCES = $(TEST_GTEST_SOURCES) test-taglist.cc
+test_urihandler_SOURCES = $(TEST_GTEST_SOURCES) test-urihandler.cc
+
+test_plugin_appsink_SOURCES = $(TEST_GTEST_SOURCES) plugins/test-plugin-appsink.cc
+test_plugin_appsrc_SOURCES = $(TEST_GTEST_SOURCES) plugins/test-plugin-appsrc.cc
+test_plugin_derivedfromappsink_SOURCES = $(TEST_GTEST_SOURCES)
plugins/test-plugin-derivedfromappsink.cc
+test_plugin_derivedfromappsrc_SOURCES = $(TEST_GTEST_SOURCES)
plugins/test-plugin-derivedfromappsrc.cc
+test_plugin_derivedfrombasetransform_SOURCES = $(TEST_GTEST_SOURCES)
plugins/test-plugin-derivedfrombasetransform.cc
+test_plugin_pushsrc_SOURCES = $(TEST_GTEST_SOURCES) plugins/test-plugin-pushsrc.cc
+test_plugin_register_SOURCES = $(TEST_GTEST_SOURCES) plugins/test-plugin-register.cc
+
+test_regression_bininpipeline_SOURCES = $(TEST_GTEST_SOURCES) $(TEST_REGRESSION_UTILS)
regression/test-regression-bininpipeline.cc
+test_regression_binplugin_SOURCES = $(TEST_GTEST_SOURCES)
regression/test-regression-binplugin.cc
+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://googletest.googlecode.com/files/gtest-1.7.0.zip
+
+gtest.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 $@)))
-test_plugin_appsink_SOURCES = plugins/test-plugin-appsink.cc
$(TEST_MAIN_SOURCE)
-test_plugin_appsrc_SOURCES = plugins/test-plugin-appsrc.cc
$(TEST_MAIN_SOURCE)
-test_plugin_derivedfromappsink_SOURCES = plugins/test-plugin-derivedfromappsink.cc
$(TEST_MAIN_SOURCE)
-test_plugin_derivedfromappsrc_SOURCES = plugins/test-plugin-derivedfromappsrc.cc
$(TEST_MAIN_SOURCE)
-test_plugin_derivedfrombasetransform_SOURCES = plugins/test-plugin-derivedfrombasetransform.cc
$(TEST_MAIN_SOURCE)
-test_plugin_pushsrc_SOURCES = plugins/test-plugin-pushsrc.cc
$(TEST_MAIN_SOURCE)
-test_plugin_register_SOURCES = plugins/test-plugin-register.cc
$(TEST_MAIN_SOURCE)
+gtest: gtest.zip
+ unzip -nq -d gtest gtest.zip
-test_regression_bininpipeline_SOURCES = regression/test-regression-bininpipeline.cc
$(TEST_MAIN_SOURCE) $(TEST_REGRESSION_UTILS)
-test_regression_binplugin_SOURCES = regression/test-regression-binplugin.cc
$(TEST_MAIN_SOURCE)
-test_regression_rewritefile_SOURCES = regression/test-regression-rewritefile.cc
$(TEST_MAIN_SOURCE) $(TEST_REGRESSION_UTILS)
-test_regression_seekonstartup_SOURCES = regression/test-regression-seekonstartup.cc
$(TEST_MAIN_SOURCE) $(TEST_REGRESSION_UTILS)
-test_regression_videoduration_SOURCES = regression/test-regression-videoduration.cc
$(TEST_MAIN_SOURCE) $(TEST_REGRESSION_UTILS)
+check_DATA = gtest
+CLEANFILES = gtest.zip
+clean-local:
+ rm -rf gtest
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]