Rework the build system for a new tests approach

Perform a substantial cleanup of the build system with respect to
building and installing testcases.

First, Makefile.decl has been renamed glib.mk and substantially
expanded.  We intend to add more stuff here in the future, like canned
rules for mkenums, marshallers, resources, etc.

By default, tests are no longer compiled as part of 'make'.  They will
be built when 'make check' is run.  The old behaviour can be obtained
with --enable-always-build-tests.

--disable-modular-tests is gone (because tests are no longer built by
default).  There is no longer any way to cause 'make check' to be a
no-op, but that's not very useful anyway.

A new glibtests.m4 file is introduced.  Along with glib.mk, this
provides for consistent handling of --enable-installed-tests and
--enable-always-build-tests (mentioned above).

Port our various test-installing Makefiles to the new framework.

This patch substantially improves the situation in the toplevel tests/
directory.  Things are now somewhat under control there.  There were
some tests being built that weren't even being run and we run those now.
The long-running GObject performance tests in this directory have been
removed from 'make check' because they take too long.

As an experiment, 'make check' now runs the testcases on win32 builds,
by default.  We can't run them under gtester (since it uses a pipe to
communicate with the subprocess) so just toss them in TESTS.  Most of
them are passing on win32.

Things are not quite done here, but this patch is already a substantial
improvement.  More to come.
This commit is contained in:
Ryan Lortie
2013-05-30 00:07:32 -04:00
parent 210b1f8b42
commit f9eb9eed10
38 changed files with 996 additions and 1141 deletions

View File

@@ -1,31 +1,50 @@
include $(top_srcdir)/Makefile.decl
include $(top_srcdir)/glib.mk
AM_CPPFLAGS = \
$(gmodule_INCLUDES) \
-DGLIB_DISABLE_DEPRECATION_WARNINGS \
$(GLIB_DEBUG_FLAGS)
LDADD = $(top_builddir)/glib/libglib-2.0.la $(top_builddir)/gobject/libgobject-2.0.la
AM_CPPFLAGS = $(gmodule_INCLUDES) $(GLIB_DEBUG_FLAGS)
DEFS = -DGLIB_DISABLE_DEPRECATION_WARNINGS -DG_LOG_DOMAIN=\"GLib\"
AM_CFLAGS = -g
libglib = $(top_builddir)/glib/libglib-2.0.la
libgthread = $(top_builddir)/gthread/libgthread-2.0.la
libgmodule = $(top_builddir)/gmodule/libgmodule-2.0.la
libgobject = $(top_builddir)/gobject/libgobject-2.0.la
# So far, only two gtester-ified cases
test_programs = \
gvalue-test \
paramspec-test \
$(NULL)
# These are not yet gtester-ified, so mark them as for 'installed' only so we
# don't run them under the framework. We will handle them manually below.
installed_test_programs = \
deftype \
accumulator \
defaultiface \
dynamictype \
override \
singleton \
references \
$(NULL)
# libtool dependency tracking seems broken. this is currently
# required to get the tests to dynamic link against the in-tree
# libglib instead of the system one
libgobject += $(libglib)
# Don't install these ones, and keep them out of 'make check' because they take too long...
noinst_PROGRAMS += \
performance \
performance-threaded \
$(NULL)
########################################################################
# Run the 'installed' tests manually in-tree.
# This will cause them to be built even if installed tests are disabled.
check_PROGRAMS += $(installed_test_programs) $(installed_test_extra_programs)
TESTS = $(installed_test_programs)
TESTS_ENVIRONMENT = \
LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset \
MALLOC_CHECK_=2 \
MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
noinst_LTLIBRARIES = libtestgobject.la
accumulator_SOURCES = accumulator.c testmarshal.c testmarshal.h
defaultiface_SOURCES = defaultiface.c testmodule.c testmodule.h
dynamictype_SOURCES = dynamictype.c testmodule.c testmodule.h
libtestgobject_la_SOURCES = \
testcommon.h \
testmarshal.h \
testmarshal.c \
testmodule.c \
testmodule.h
if ENABLE_TIMELOOP
installed_test_programs += timeloop-closure
endif
if CROSS_COMPILING
glib_genmarshal=$(GLIB_GENMARSHAL)
@@ -45,63 +64,14 @@ testmarshal.c: @REBUILD@ testmarshal.h testmarshal.list $(glib_genmarshal)
&& cp xgen-gmc testmarshal.c \
&& rm -f xgen-gmc xgen-gmc~
BUILT_SOURCES = testmarshal.h testmarshal.c
CLEANFILES = stamp-testmarshal.h
BUILT_SOURCES += testmarshal.h testmarshal.c
CLEANFILES += stamp-testmarshal.h
########################################################################
LDADD = libtestgobject.la $(libgobject)
test_programs = \
deftype \
gvalue-test \
paramspec-test \
accumulator \
defaultiface \
dynamictype \
override \
singleton \
references
performance_programs = \
performance \
performance-threaded
performance_LDADD = $(libgobject) $(libgthread)
performance_threaded_LDADD = $(libgobject) $(libgthread)
check_PROGRAMS = $(test_programs)
noinst_PROGRAMS = $(performance_programs) testgobject
if ENABLE_TIMELOOP
noinst_PROGRAMS += timeloop-closure
endif
TESTS = $(test_programs) $(performance_programs)
TESTS_ENVIRONMENT = srcdir=$(srcdir) \
LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset \
MALLOC_CHECK_=2 \
MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
if BUILDOPT_INSTALL_TESTS
insttestdir = $(pkglibexecdir)/installed-tests
insttest_PROGRAMS = $(test_programs)
testmetadir = $(datadir)/installed-tests/$(PACKAGE)
testmeta_DATA = $(test_programs:=.test)
%.test: %$(EXEEXT) Makefile
$(AM_V_GEN) (echo '[Test]' > $@.tmp; \
echo 'Type=session' >> $@.tmp; \
echo 'Exec=env G_TEST_DATA=$(pkglibexecdir)/installed-tests $(pkglibexecdir)/installed-tests/$<' >> $@.tmp; \
mv $@.tmp $@)
endif
########################################################################
EXTRA_DIST += \
EXTRA_DIST += \
testcommon.h \
testmarshal.list
BUILT_EXTRA_DIST = \
BUILT_EXTRA_DIST += \
testmarshal.h \
testmarshal.c
@@ -115,5 +85,3 @@ distclean-local:
if test $(srcdir) = .; then :; else \
rm -f $(BUILT_EXTRA_DIST); \
fi