summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Rutkovsky <vrutkovs@redhat.com>2014-08-06 18:15:12 +0200
committerVadim Rutkovsky <vrutkovs@redhat.com>2014-08-27 18:00:46 +0200
commit622024a88f842cb087306e81e886af850107149a (patch)
tree75ad871e548663a901a5ff9ec9eff9e2a9a4698f
parent7955e6333507b69a1d013c70376fb4b279df2556 (diff)
downloadgvfs-622024a88f842cb087306e81e886af850107149a.tar.gz
build: add --enable-installed-tests parameter
See https://live.gnome.org/GnomeGoals/InstalledTests for more information. Those tests will also be executed on http://build.gnome.org. For now we run all our suite as one big test It's still possible to run `make check` with locally uninstalled tests. https://bugzilla.gnome.org/show_bug.cgi?id=734370
-rw-r--r--configure.ac26
-rw-r--r--glib-tap.mk121
-rw-r--r--test/.gitignore1
-rw-r--r--test/Makefile.am42
4 files changed, 186 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index bc1312b2..ec4f6b03 100644
--- a/configure.ac
+++ b/configure.ac
@@ -879,6 +879,31 @@ else
AC_MSG_RESULT(no)
fi
+msg_installed_tests="no"
+AC_ARG_ENABLE(installed-tests,
+ AS_HELP_STRING([--enable-installed-tests],
+ [Enable installation of some test cases]),
+ [case ${enableval} in
+ yes) ENABLE_INSTALLED_TESTS="1" ;;
+ no) ENABLE_INSTALLED_TESTS="" ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-installed-tests]) ;;
+ esac])
+AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], test "$ENABLE_INSTALLED_TESTS" = "1")
+AC_ARG_ENABLE(always-build-tests,
+ AS_HELP_STRING([--enable-always-build-tests],
+ [Enable always building tests during 'make all']),
+ [case ${enableval} in
+ yes) ENABLE_ALWAYS_BUILD_TESTS="1" ;;
+ no) ENABLE_ALWAYS_BUILD_TESTS="" ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-always-build-tests]) ;;
+ esac])
+AM_CONDITIONAL([ENABLE_ALWAYS_BUILD_TESTS], test "$ENABLE_ALWAYS_BUILD_TESTS" = "1")
+if test "$ENABLE_INSTALLED_TESTS" = "1"; then
+ AC_SUBST(installed_test_metadir, [${datadir}/installed-tests/]AC_PACKAGE_NAME)
+ AC_SUBST(installed_testdir, [${libexecdir}/installed-tests/]AC_PACKAGE_NAME)
+ msg_installed_tests="yes"
+fi
+
AC_CONFIG_FILES([
Makefile
common/Makefile
@@ -929,6 +954,7 @@ echo "
GNOME Keyring support: $msg_keyring
GTK+ support: $msg_gtk
Bash-completion support: $msg_bash_completion
+ Installed tests: $msg_installed_tests
"
# The gudev gphoto monitor needs a recent libgphoto; point to the required patch if the version is too old
diff --git a/glib-tap.mk b/glib-tap.mk
new file mode 100644
index 00000000..e586122a
--- /dev/null
+++ b/glib-tap.mk
@@ -0,0 +1,121 @@
+# GLIB - Library of useful C routines
+
+TESTS_ENVIRONMENT= \
+ G_TEST_SRCDIR="$(abs_srcdir)" \
+ G_TEST_BUILDDIR="$(abs_builddir)" \
+ G_DEBUG=gc-friendly \
+ MALLOC_CHECK_=2 \
+ MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
+LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/tap-driver.sh
+LOG_COMPILER = $(top_srcdir)/tap-test
+
+# initialize variables for unconditional += appending
+BUILT_SOURCES =
+BUILT_EXTRA_DIST =
+CLEANFILES = *.log *.trs
+DISTCLEANFILES =
+MAINTAINERCLEANFILES =
+EXTRA_DIST =
+TESTS =
+
+installed_test_LTLIBRARIES =
+installed_test_PROGRAMS =
+installed_test_SCRIPTS =
+nobase_installed_test_DATA =
+
+noinst_LTLIBRARIES =
+noinst_PROGRAMS =
+noinst_SCRIPTS =
+noinst_DATA =
+
+check_LTLIBRARIES =
+check_PROGRAMS =
+check_SCRIPTS =
+check_DATA =
+
+# We support a fairly large range of possible variables. It is expected that all types of files in a test suite
+# will belong in exactly one of the following variables.
+#
+# First, we support the usual automake suffixes, but in lowercase, with the customary meaning:
+#
+# test_programs, test_scripts, test_data, test_ltlibraries
+#
+# The above are used to list files that are involved in both uninstalled and installed testing. The
+# test_programs and test_scripts are taken to be actual testcases and will be run as part of the test suite.
+# Note that _data is always used with the nobase_ automake variable name to ensure that installed test data is
+# installed in the same way as it appears in the package layout.
+#
+# In order to mark a particular file as being only for one type of testing, use 'installed' or 'uninstalled',
+# like so:
+#
+# installed_test_programs, uninstalled_test_programs
+# installed_test_scripts, uninstalled_test_scripts
+# installed_test_data, uninstalled_test_data
+# installed_test_ltlibraries, uninstalled_test_ltlibraries
+#
+# Additionally, we support 'extra' infixes for programs and scripts. This is used for support programs/scripts
+# that should not themselves be run as testcases (but exist to be used from other testcases):
+#
+# test_extra_programs, installed_test_extra_programs, uninstalled_test_extra_programs
+# test_extra_scripts, installed_test_extra_scripts, uninstalled_test_extra_scripts
+#
+# Additionally, for _scripts and _data, we support the customary dist_ prefix so that the named script or data
+# file automatically end up in the tarball.
+#
+# dist_test_scripts, dist_test_data, dist_test_extra_scripts
+# dist_installed_test_scripts, dist_installed_test_data, dist_installed_test_extra_scripts
+# dist_uninstalled_test_scripts, dist_uninstalled_test_data, dist_uninstalled_test_extra_scripts
+#
+# Note that no file is automatically disted unless it appears in one of the dist_ variables. This follows the
+# standard automake convention of not disting programs scripts or data by default.
+#
+# test_programs, test_scripts, uninstalled_test_programs and uninstalled_test_scripts (as well as their disted
+# variants) will be run as part of the in-tree 'make check'. These are all assumed to be runnable under
+# gtester. That's a bit strange for scripts, but it's possible.
+
+TESTS += $(test_programs) $(test_scripts) $(uninstalled_test_programs) $(uninstalled_test_scripts) \
+ $(dist_test_scripts) $(dist_uninstalled_test_scripts)
+
+# Note: build even the installed-only targets during 'make check' to ensure that they still work.
+# We need to do a bit of trickery here and manage disting via EXTRA_DIST instead of using dist_ prefixes to
+# prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were
+# filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'.
+all_test_programs = $(test_programs) $(uninstalled_test_programs) $(installed_test_programs) \
+ $(test_extra_programs) $(uninstalled_test_extra_programs) $(installed_test_extra_programs)
+all_test_scripts = $(test_scripts) $(uninstalled_test_scripts) $(installed_test_scripts) \
+ $(test_extra_scripts) $(uninstalled_test_extra_scripts) $(installed_test_extra_scripts)
+all_dist_test_scripts = $(dist_test_scripts) $(dist_uninstalled_test_scripts) $(dist_installed_test_scripts) \
+ $(dist_test_extra_scripts) $(dist_uninstalled_test_extra_scripts) $(dist_installed_test_extra_scripts)
+all_test_scripts += $(all_dist_test_scripts)
+EXTRA_DIST += $(all_dist_test_scripts)
+all_test_data = $(test_data) $(uninstalled_test_data) $(installed_test_data)
+all_dist_test_data = $(dist_test_data) $(dist_uninstalled_test_data) $(dist_installed_test_data)
+all_test_data += $(all_dist_test_data)
+EXTRA_DIST += $(all_dist_test_data)
+all_test_ltlibs = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installed_test_ltlibraries)
+
+if ENABLE_INSTALLED_TESTS
+installed_test_PROGRAMS += $(test_programs) $(installed_test_programs) \
+ $(test_extra_programs) $(installed_test_extra_programs)
+installed_test_SCRIPTS += $(test_scripts) $(installed_test_scripts) \
+ $(test_extra_scripts) $(test_installed_extra_scripts)
+installed_test_SCRIPTS += $(dist_test_scripts) $(dist_test_extra_scripts) \
+ $(dist_installed_test_scripts) $(dist_installed_test_extra_scripts)
+nobase_installed_test_DATA += $(test_data) $(installed_test_data)
+nobase_installed_test_DATA += $(dist_test_data) $(dist_installed_test_data)
+installed_test_LTLIBRARIES += $(test_ltlibraries) $(installed_test_ltlibraries)
+installed_testcases = $(test_programs) $(installed_test_programs) \
+ $(test_scripts) $(installed_test_scripts) \
+ $(dist_test_scripts) $(dist_installed_test_scripts)
+
+installed_test_meta_DATA = $(installed_testcases:=.test)
+
+#%.test: %$(EXEEXT) Makefile
+# $(AM_V_GEN) (echo '[Test]' > $@.tmp; \
+# echo 'Type=session' >> $@.tmp; \
+# echo 'Exec=$(installed_testdir)/$(notdir $<) --tap' >> $@.tmp; \
+# echo 'Output=TAP' >> $@.tmp; \
+# mv $@.tmp $@)
+
+CLEANFILES += $(installed_test_meta_DATA)
+endif
diff --git a/test/.gitignore b/test/.gitignore
index 18768c12..c361cbf2 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,5 +1,6 @@
*.monitor
*.service
+*.test
session.conf
benchmark-gvfs-big-files
benchmark-gvfs-small-files
diff --git a/test/Makefile.am b/test/Makefile.am
index 1922ff53..1cd7b0b4 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/glib-tap.mk
+
NULL =
AM_CFLAGS = \
@@ -8,7 +10,7 @@ AM_CFLAGS = \
AM_LDFLAGS = \
$(GLIB_LIBS)
-noinst_PROGRAMS = \
+noinst_PROGRAMS += \
test-query-info-stream \
benchmark-gvfs-small-files \
benchmark-gvfs-big-files \
@@ -60,7 +62,7 @@ org.gtk.Private.UDisks2VolumeMonitor.service: $(top_srcdir)/monitor/udisks2/org.
CONFIG_FILES+=org.gtk.Private.UDisks2VolumeMonitor.service udisks2.monitor
endif
-noinst_DATA= $(CONFIG_FILES)
+noinst_DATA += $(CONFIG_FILES)
# run tests against build tree
check: $(CONFIG_FILES) gvfs-test
@@ -75,9 +77,41 @@ installcheck-local: gvfs-test
$(srcdir)/gvfs-test $(TEST_NAMES); \
fi
-CLEANFILES=$(CONFIG_FILES)
+CLEANFILES += $(CONFIG_FILES)
+
+nobase_installed_test_DATA += $(CONFIG_FILES)
+nobase_installed_test_DATA += \
+ files/source-gphoto/IMG_0001.jpg \
+ files/source-gphoto/IMG_0002.jpg \
+ files/bogus-cd.iso.bz2 \
+ files/joliet.iso.bz2 \
+ files/mtp_xperia.ioctl.xz \
+ files/mtp_xperia.umockdev \
+ files/powershot.ioctl \
+ files/powershot.umockdev \
+ files/ssh_host_rsa_key \
+ files/ssh_host_rsa_key.pub \
+ files/testcert.pem \
+ files/vfat.img.bz2 \
+ $(NULL)
+
+test_extra_scripts = \
+ gvfs-test \
+ run-in-tree.sh \
+ $(NULL)
+
+test_scripts = gvfs-all-tests
+
+gvfs-all-tests.test: gvfs-test
+ $(AM_V_GEN) (echo '[Test]' > $@.tmp; \
+ echo 'Type=session' >> $@.tmp; \
+ echo 'Exec=$(installed_testdir)/gvfs-test' >> $@.tmp; \
+ echo 'Output=TAP' >> $@.tmp; \
+ mv $@.tmp $@)
+
+.PHONY: $(test_scripts)
-EXTRA_DIST = \
+EXTRA_DIST += \
benchmark-common.c \
session.conf.in \
gvfs-test \