Blame build-aux/glib-tap.mk

Packit cfa437
# GLIB - Library of useful C routines
Packit cfa437
Packit cfa437
AM_TESTS_ENVIRONMENT= \
Packit cfa437
	G_TEST_SRCDIR="$(abs_srcdir)/tests" 		\
Packit cfa437
	G_TEST_BUILDDIR="$(abs_builddir)/tests" 	\
Packit cfa437
	G_DEBUG="gc-friendly cleanup"		\
Packit cfa437
	MALLOC_CHECK_=2 			\
Packit cfa437
	MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
Packit cfa437
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/build-aux/tap-driver.sh
Packit cfa437
LOG_COMPILER = $(top_srcdir)/build-aux/tap-test
Packit cfa437
Packit cfa437
NULL =
Packit cfa437
Packit cfa437
# initialize variables for unconditional += appending
Packit cfa437
BUILT_SOURCES =
Packit cfa437
BUILT_EXTRA_DIST =
Packit cfa437
CLEANFILES = *.log *.trs
Packit cfa437
DISTCLEANFILES =
Packit cfa437
MAINTAINERCLEANFILES =
Packit cfa437
EXTRA_DIST =
Packit cfa437
TESTS =
Packit cfa437
Packit cfa437
installed_test_LTLIBRARIES =
Packit cfa437
installed_test_PROGRAMS =
Packit cfa437
installed_test_SCRIPTS =
Packit cfa437
nobase_installed_test_DATA =
Packit cfa437
Packit cfa437
noinst_LTLIBRARIES =
Packit cfa437
noinst_PROGRAMS =
Packit cfa437
noinst_SCRIPTS =
Packit cfa437
noinst_DATA =
Packit cfa437
Packit cfa437
check_LTLIBRARIES =
Packit cfa437
check_PROGRAMS =
Packit cfa437
check_SCRIPTS =
Packit cfa437
check_DATA =
Packit cfa437
Packit cfa437
# We support a fairly large range of possible variables.  It is expected that all types of files in a test suite
Packit cfa437
# will belong in exactly one of the following variables.
Packit cfa437
#
Packit cfa437
# First, we support the usual automake suffixes, but in lowercase, with the customary meaning:
Packit cfa437
#
Packit cfa437
#   test_programs, test_scripts, test_data, test_ltlibraries
Packit cfa437
#
Packit cfa437
# The above are used to list files that are involved in both uninstalled and installed testing.  The
Packit cfa437
# test_programs and test_scripts are taken to be actual testcases and will be run as part of the test suite.
Packit cfa437
# Note that _data is always used with the nobase_ automake variable name to ensure that installed test data is
Packit cfa437
# installed in the same way as it appears in the package layout.
Packit cfa437
#
Packit cfa437
# In order to mark a particular file as being only for one type of testing, use 'installed' or 'uninstalled',
Packit cfa437
# like so:
Packit cfa437
#
Packit cfa437
#   installed_test_programs, uninstalled_test_programs
Packit cfa437
#   installed_test_scripts, uninstalled_test_scripts
Packit cfa437
#   installed_test_data, uninstalled_test_data
Packit cfa437
#   installed_test_ltlibraries, uninstalled_test_ltlibraries
Packit cfa437
#
Packit cfa437
# Additionally, we support 'extra' infixes for programs and scripts.  This is used for support programs/scripts
Packit cfa437
# that should not themselves be run as testcases (but exist to be used from other testcases):
Packit cfa437
#
Packit cfa437
#   test_extra_programs, installed_test_extra_programs, uninstalled_test_extra_programs
Packit cfa437
#   test_extra_scripts, installed_test_extra_scripts, uninstalled_test_extra_scripts
Packit cfa437
#
Packit cfa437
# Additionally, for _scripts and _data, we support the customary dist_ prefix so that the named script or data
Packit cfa437
# file automatically end up in the tarball.
Packit cfa437
#
Packit cfa437
#   dist_test_scripts, dist_test_data, dist_test_extra_scripts
Packit cfa437
#   dist_installed_test_scripts, dist_installed_test_data, dist_installed_test_extra_scripts
Packit cfa437
#   dist_uninstalled_test_scripts, dist_uninstalled_test_data, dist_uninstalled_test_extra_scripts
Packit cfa437
#
Packit cfa437
# Note that no file is automatically disted unless it appears in one of the dist_ variables.  This follows the
Packit cfa437
# standard automake convention of not disting programs scripts or data by default.
Packit cfa437
#
Packit cfa437
# test_programs, test_scripts, uninstalled_test_programs and uninstalled_test_scripts (as well as their disted
Packit cfa437
# variants) will be run as part of the in-tree 'make check'.  These are all assumed to be runnable under
Packit cfa437
# gtester.  That's a bit strange for scripts, but it's possible.
Packit cfa437
Packit cfa437
TESTS += $(test_programs) $(test_scripts) $(uninstalled_test_programs) $(uninstalled_test_scripts) \
Packit cfa437
         $(dist_test_scripts) $(dist_uninstalled_test_scripts)
Packit cfa437
Packit cfa437
# Note: build even the installed-only targets during 'make check' to ensure that they still work.
Packit cfa437
# We need to do a bit of trickery here and manage disting via EXTRA_DIST instead of using dist_ prefixes to
Packit cfa437
# prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were
Packit cfa437
# filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'.
Packit cfa437
all_test_programs     = $(test_programs) $(uninstalled_test_programs) $(installed_test_programs) \
Packit cfa437
                        $(test_extra_programs) $(uninstalled_test_extra_programs) $(installed_test_extra_programs)
Packit cfa437
all_test_scripts      = $(test_scripts) $(uninstalled_test_scripts) $(installed_test_scripts) \
Packit cfa437
                        $(test_extra_scripts) $(uninstalled_test_extra_scripts) $(installed_test_extra_scripts)
Packit cfa437
all_dist_test_scripts = $(dist_test_scripts) $(dist_uninstalled_test_scripts) $(dist_installed_test_scripts) \
Packit cfa437
                        $(dist_test_extra_scripts) $(dist_uninstalled_test_extra_scripts) $(dist_installed_test_extra_scripts)
Packit cfa437
all_test_scripts     += $(all_dist_test_scripts)
Packit cfa437
EXTRA_DIST           += $(all_dist_test_scripts)
Packit cfa437
all_test_data         = $(test_data) $(uninstalled_test_data) $(installed_test_data)
Packit cfa437
all_dist_test_data    = $(dist_test_data) $(dist_uninstalled_test_data) $(dist_installed_test_data)
Packit cfa437
all_test_data        += $(all_dist_test_data)
Packit cfa437
EXTRA_DIST           += $(all_dist_test_data)
Packit cfa437
all_test_ltlibs       = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installed_test_ltlibraries)
Packit cfa437
Packit cfa437
if ENABLE_ALWAYS_BUILD_TESTS
Packit cfa437
noinst_LTLIBRARIES += $(all_test_ltlibs)
Packit cfa437
noinst_PROGRAMS += $(all_test_programs)
Packit cfa437
noinst_SCRIPTS += $(all_test_scripts)
Packit cfa437
noinst_DATA += $(all_test_data)
Packit cfa437
else
Packit cfa437
check_LTLIBRARIES += $(all_test_ltlibs)
Packit cfa437
check_PROGRAMS += $(all_test_programs)
Packit cfa437
check_SCRIPTS += $(all_test_scripts)
Packit cfa437
check_DATA += $(all_test_data)
Packit cfa437
endif
Packit cfa437
Packit cfa437
if ENABLE_INSTALLED_TESTS
Packit cfa437
installed_test_PROGRAMS += $(test_programs) $(installed_test_programs) \
Packit cfa437
                          $(test_extra_programs) $(installed_test_extra_programs)
Packit cfa437
installed_test_SCRIPTS += $(test_scripts) $(installed_test_scripts) \
Packit cfa437
                          $(test_extra_scripts) $(test_installed_extra_scripts)
Packit cfa437
installed_test_SCRIPTS += $(dist_test_scripts) $(dist_test_extra_scripts) \
Packit cfa437
                          $(dist_installed_test_scripts) $(dist_installed_test_extra_scripts)
Packit cfa437
nobase_installed_test_DATA += $(test_data) $(installed_test_data)
Packit cfa437
nobase_installed_test_DATA += $(dist_test_data) $(dist_installed_test_data)
Packit cfa437
installed_test_LTLIBRARIES += $(test_ltlibraries) $(installed_test_ltlibraries)
Packit cfa437
installed_testcases = $(test_programs) $(installed_test_programs) \
Packit cfa437
                      $(test_scripts) $(installed_test_scripts) \
Packit cfa437
                      $(dist_test_scripts) $(dist_installed_test_scripts)
Packit cfa437
Packit cfa437
installed_test_meta_DATA = $(installed_testcases:=.test)
Packit cfa437
Packit cfa437
%.test: %$(EXEEXT) Makefile
Packit cfa437
	$(AM_V_GEN) (echo '[Test]' > $@.tmp; \
Packit cfa437
	echo 'Type=session' >> $@.tmp; \
Packit cfa437
	echo 'Exec=$(installed_testdir)/$(notdir $<) --tap' >> $@.tmp; \
Packit cfa437
	echo 'Output=TAP' >> $@.tmp; \
Packit cfa437
	mv $@.tmp $@)
Packit cfa437
Packit cfa437
CLEANFILES += $(installed_test_meta_DATA)
Packit cfa437
Packit cfa437
endif
Packit cfa437
Packit cfa437
VALGRIND_ARGS = \
Packit cfa437
	--leak-check=full \
Packit cfa437
	--child-silent-after-fork=yes \
Packit cfa437
	--suppressions=/usr/share/glib-2.0/valgrind/glib.supp \
Packit cfa437
	--suppressions=$(abs_top_srcdir)/build-aux/nss.supp \
Packit cfa437
	--num-callers=18 \
Packit cfa437
	$(NULL)
Packit cfa437
Packit cfa437
memcheck-local: $(all_test_programs)
Packit cfa437
	$(MAKE) check-am TESTS="$(all_test_programs)" \
Packit cfa437
		TESTS_ENVIRONMENT="G_DEBUG='gc-friendly cleanup'" \
Packit cfa437
		LOG_FLAGS="libtool --mode=execute valgrind $(VALGRIND_ARGS) --quiet --log-fd=7" \
Packit cfa437
		AM_TESTS_FD_REDIRECT="7>&2"