diff options
author | Ryan Lortie <desrt@desrt.ca> | 2013-05-30 00:07:32 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2013-05-31 23:12:15 -0400 |
commit | f9eb9eed10b7123ef000e49be1290755b2d6ae8f (patch) | |
tree | dffb3fdb91e25915ca5f67d9af508b541b1d720c /tests | |
parent | 210b1f8b4230b881d1c2e4a9e7dac571c967e091 (diff) |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 296 | ||||
-rw-r--r-- | tests/gobject/Makefile.am | 124 | ||||
-rw-r--r-- | tests/refcount/Makefile.am | 33 |
3 files changed, 178 insertions, 275 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 5a342c529..b6b3ebd70 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,220 +1,164 @@ -include $(top_srcdir)/Makefile.decl +include $(top_srcdir)/glib.mk -insttestdir = $(pkglibexecdir)/installed-tests - -SUBDIRS=gobject refcount - -AM_CPPFLAGS = \ - $(gmodule_INCLUDES) \ - -DGLIB_DISABLE_DEPRECATION_WARNINGS \ - -DG_LOG_DOMAIN=\"GLib\" \ - -DSRCDIR=\"$(srcdir)\" \ - $(GLIB_DEBUG_FLAGS) +SUBDIRS = gobject refcount +LDADD = $(top_builddir)/glib/libglib-2.0.la +AM_CPPFLAGS = $(gmodule_INCLUDES) $(GLIB_DEBUG_FLAGS) +DEFS = -DGLIB_DISABLE_DEPRECATION_WARNINGS -DG_LOG_DOMAIN=\"GLib\" AM_CFLAGS = -g -EFENCE= - -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 - -libadd_libgmodule = $(libgmodule) -libadd_libglib = $(libglib) -if PLATFORM_WIN32 -no_undefined = -no-undefined - -module_test_exp = module-test.exp - -module-test.exp: module-test.o - $(DLLTOOL) --output-exp module-test.exp module-test.o - -spawn_test_win32_gui = spawn-test-win32-gui - -spawn_test_win32_gui_LDFLAGS = -mwindows - -endif - -EXTRA_DIST += \ - $(test_scripts) \ - makefile.msc.in \ - casefold.txt \ - casemap.txt \ - gen-casefold-txt.pl \ - gen-casemap-txt.pl \ - iochannel-test-infile \ - utf8.txt \ - timeloop-basic.c \ - assert-msg-test.gdb - -BUILT_EXTRA_DIST = \ - makefile.msc - -if HAVE_CXX -CXX_TEST = cxx-test -cxx_test_LDADD = $(progs_ldadd) -cxx_test_SOURCES = cxx-test.C -else -CXX_TEST = -endif +# Some random programs that appear not to be testcases and not used from any testcases +check_PROGRAMS += \ + testgdateparser \ + unicode-normalize \ + $(NULL) -if ENABLE_TIMELOOP -timeloop = timeloop -endif -noinst_PROGRAMS = $(TEST_PROGS) \ - testgdate \ - testgdateparser \ - unicode-normalize \ - unicode-collate \ - $(timeloop) \ - assert-msg-test \ - datetime - -TEST_PROGS += testglib -testglib_SOURCES = testglib.c -testglib_LDADD = $(libglib) - - -testgdate_LDADD = $(libglib) -testgdateparser_LDADD = $(libglib) -unicode_normalize_LDADD = $(libglib) -unicode_collate_LDADD = $(libglib) -assert_msg_test_LDADD = $(libglib) -if ENABLE_TIMELOOP -timeloop_LDADD = $(libglib) -endif -datetime_LDADD = $(libglib) +# So far, this is the only gtester-ified testcase here +test_programs = \ + testglib \ + $(NULL) -test_programs = \ +# 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 = \ + testgdate \ + datetime \ atomic-test \ bit-test \ - $(CXX_TEST) \ child-test \ completion-test \ dirname-test \ file-test \ env-test \ gio-test \ - iochannel-test \ mainloop-test \ mapping-test \ - module-test \ onceinit \ asyncqueue-test \ qsort-test \ relation-test \ - slice-test \ - slice-color \ slice-concurrent \ slice-threadinit \ sources \ - spawn-test \ - $(spawn_test_win32_gui) \ thread-test \ threadpool-test \ type-test \ unicode-caseconv \ - unicode-encoding - -test_scripts = run-collate-tests.sh run-assert-msg-test.sh + unicode-encoding \ + $(NULL) -test_script_support_programs = unicode-collate +test_extra_programs = \ + slice-test \ + slice-color \ + assert-msg-test \ + unicode-collate \ + $(NULL) -check_PROGRAMS = $(test_programs) $(test_script_support_programs) +if OS_UNIX +test_programs += \ + spawn-test \ + iochannel-test \ + $(NULL) -TESTS = $(test_programs) $(test_scripts) -TESTS_ENVIRONMENT = srcdir=$(srcdir) \ - LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset \ - MALLOC_CHECK_=2 \ - MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) +# These don't appear to work installed and we don't want to run them under gtester either... +dist_uninstalled_test_extra_scripts = \ + run-collate-tests.sh \ + run-assert-msg-test.sh \ + $(NULL) +endif -test_data = \ - iochannel-test-infile \ - casemap.txt \ - casefold.txt \ - utf8.txt \ +dist_test_data = \ + iochannel-test-infile \ + casemap.txt \ + casefold.txt \ + utf8.txt \ $(NULL) -if BUILDOPT_INSTALL_TESTS -insttest_PROGRAMS = $(test_programs) +# 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) +check_SCRIPTS += $(installed_test_scripts) +TESTS += $(installed_test_programs) $(dist_uninstalled_test_extra_scripts) +TESTS_ENVIRONMENT = \ + G_TEST_SRCDIR=$(abs_srcdir) \ + G_TEST_BUILDDIR=$(abs_builddir) \ + LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset \ + MALLOC_CHECK_=2 \ + MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) + +test_programs += module-test +module_test_DEPENDENCIES = libmoduletestplugin_a.la libmoduletestplugin_b.la +module_test_LDADD = $(LDADD) $(top_builddir)/gmodule/libgmodule-2.0.la +module_test_LDFLAGS = $(G_MODULE_LDFLAGS) +slice_test_SOURCES = slice-test.c memchunks.c +slice_color_SOURCES = slice-color.c memchunks.c +slice_threadinit_LDADD = $(LDADD) $(top_builddir)/gthread/libgthread-2.0.la -testmetadir = $(datadir)/installed-tests/$(PACKAGE) -testmeta_DATA = $(test_programs:=.test) +test_ltlibraries = libmoduletestplugin_a.la libmoduletestplugin_b.la -insttest_DATA = $(test_data) +libmoduletestplugin_a_la_SOURCES = libmoduletestplugin_a.c +libmoduletestplugin_a_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) +libmoduletestplugin_a_la_LIBADD = $(G_MODULE_LIBS) ../glib/libglib-2.0.la ../gmodule/libgmodule-2.0.la -%.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 $@) +libmoduletestplugin_b_la_SOURCES = libmoduletestplugin_b.c +libmoduletestplugin_b_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) +libmoduletestplugin_b_la_LIBADD = $(G_MODULE_LIBS) ../glib/libglib-2.0.la ../gmodule/libgmodule-2.0.la +if !ENABLE_INSTALLED_TESTS +# see http://lists.gnu.org/archive/html/bug-libtool/2013-05/msg00009.html and gio/tests/Makefile.am +libmoduletestplugin_a_la_LDFLAGS += -rpath / +libmoduletestplugin_b_la_LDFLAGS += -rpath / endif -progs_ldadd = $(EFENCE) $(libglib) $(EFENCE) -thread_ldadd = $(libgthread) $(G_THREAD_LIBS) $(progs_ldadd) -module_ldadd = $(libgmodule) $(G_MODULE_LIBS) $(progs_ldadd) - -atomic_test_LDADD = $(progs_ldadd) -bit_test_LDADD = $(progs_ldadd) -child_test_LDADD = $(thread_ldadd) -completion_test_LDADD = $(progs_ldadd) -dirname_test_LDADD = $(progs_ldadd) -file_test_LDADD = $(progs_ldadd) -env_test_LDADD = $(progs_ldadd) -gio_test_LDADD = $(progs_ldadd) -iochannel_test_LDADD = $(progs_ldadd) -mainloop_test_LDADD = $(thread_ldadd) -mapping_test_LDADD = $(progs_ldadd) -module_test_LDADD = $(module_ldadd) $(module_test_exp) -module_test_LDFLAGS = $(G_MODULE_LDFLAGS) -onceinit_LDADD = $(thread_ldadd) -asyncqueue_test_LDADD = $(thread_ldadd) -qsort_test_LDADD = $(progs_ldadd) -relation_test_LDADD = $(progs_ldadd) -slice_test_SOURCES = slice-test.c memchunks.c -slice_test_LDADD = $(thread_ldadd) -slice_color_SOURCES = slice-color.c memchunks.c -slice_color_LDADD = $(thread_ldadd) -slice_concurrent_SOURCES = slice-concurrent.c -slice_concurrent_LDADD = $(thread_ldadd) -slice_threadinit_SOURCES = slice-threadinit.c -slice_threadinit_LDADD = $(thread_ldadd) -sources_LDADD = $(progs_ldadd) -spawn_test_LDADD = $(progs_ldadd) -thread_test_LDADD = $(thread_ldadd) -threadpool_test_LDADD = $(thread_ldadd) -type_test_LDADD = $(progs_ldadd) -unicode_encoding_LDADD = $(progs_ldadd) -unicode_caseconv_LDADD = $(progs_ldadd) - -if BUILDOPT_INSTALL_TESTS -insttest_LTLIBRARIES = libmoduletestplugin_a.la libmoduletestplugin_b.la -else -noinst_LTLIBRARIES = libmoduletestplugin_a.la libmoduletestplugin_b.la +dist-hook: $(BUILT_EXTRA_DIST) + files='$(BUILT_EXTRA_DIST)'; \ + for f in $$files; do \ + if test -f $$f; then d=.; else d=$(srcdir); fi; \ + cp $$d/$$f $(distdir) || exit 1; \ + done + mkdir $(distdir)/collate; \ + for f in $(srcdir)/collate/* ; do \ + if test -f $$f; then cp $$f $(distdir)/collate; fi; \ + done + +if HAVE_CXX +installed_test_programs += cxx-test +cxx_test_SOURCES = cxx-test.C endif -libmoduletestplugin_a_la_SOURCES = libmoduletestplugin_a.c -libmoduletestplugin_a_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) -rpath $(insttestdir) -libmoduletestplugin_a_la_LIBADD = $(G_MODULE_LIBS) $(libadd_libgmodule) $(libadd_libglib) +if ENABLE_TIMELOOP +installed_test_programs += timeloop +endif -libmoduletestplugin_b_la_SOURCES = libmoduletestplugin_b.c -libmoduletestplugin_b_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) -rpath $(insttestdir) -libmoduletestplugin_b_la_LIBADD = $(G_MODULE_LIBS) $(libadd_libgmodule) $(libadd_libglib) +if PLATFORM_WIN32 +no_undefined = -no-undefined -dist-hook: $(BUILT_EXTRA_DIST) - files='$(BUILT_EXTRA_DIST)'; \ - for f in $$files; do \ - if test -f $$f; then d=.; else d=$(srcdir); fi; \ - cp $$d/$$f $(distdir) || exit 1; done - mkdir $(distdir)/collate; \ - for f in $(srcdir)/collate/* ; do \ - if test -f $$f; then cp $$f $(distdir)/collate; fi; done - -DISTCLEANFILES = \ - iochannel-test-outfile \ - file-test-get-contents \ - maptest \ - mapchild \ +module_test_exp = module-test.exp + +module-test.exp: module-test.o + $(DLLTOOL) --output-exp module-test.exp module-test.o + +installed_test_extra_programs = spawn-test-win32-gui + +spawn_test_win32_gui_LDFLAGS = -mwindows + +endif + +EXTRA_DIST += \ + $(test_scripts) \ + makefile.msc.in \ + gen-casefold-txt.pl \ + gen-casemap-txt.pl \ + iochannel-test-infile \ + timeloop-basic.c \ + assert-msg-test.gdb + +BUILT_EXTRA_DIST += \ + makefile.msc + +DISTCLEANFILES += \ + iochannel-test-outfile \ + file-test-get-contents \ + maptest \ + mapchild \ collate.out diff --git a/tests/gobject/Makefile.am b/tests/gobject/Makefile.am index e58b1589b..5c3f18bbf 100644 --- a/tests/gobject/Makefile.am +++ b/tests/gobject/Makefile.am @@ -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) - -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 +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 +# So far, only two gtester-ified cases +test_programs = \ + gvalue-test \ + paramspec-test \ + $(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) +# 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) -######################################################################## +# 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 - -######################################################################## - -LDADD = libtestgobject.la $(libgobject) +BUILT_SOURCES += testmarshal.h testmarshal.c +CLEANFILES += stamp-testmarshal.h -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 - - diff --git a/tests/refcount/Makefile.am b/tests/refcount/Makefile.am index 34daca656..57af84f83 100644 --- a/tests/refcount/Makefile.am +++ b/tests/refcount/Makefile.am @@ -1,17 +1,12 @@ -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 +AM_CFLAGS = -g -libglib = $(top_builddir)/glib/libglib-2.0.la -libgmodule = $(top_builddir)/gmodule/libgmodule-2.0.la -libgobject = $(top_builddir)/gobject/libgobject-2.0.la - -LDADD = $(libglib) $(libgobject) - -test_programs = \ +# These are not gtester tests, so handle them manually +TESTS = \ closures \ objects \ objects2 \ @@ -22,9 +17,11 @@ test_programs = \ signal1 \ signal2 \ signal3 \ - signal4 - + signal4 \ + $(NULL) +TESTS_ENVIRONMENT = srcdir=$(srcdir) \ + LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset signal1_SOURCES = signals.c signal1_CFLAGS = -DTESTNUM=1 $(AM_CFLAGS) @@ -35,10 +32,4 @@ signal3_CFLAGS = -DTESTNUM=3 $(AM_CFLAGS) signal4_SOURCES = signals.c signal4_CFLAGS = -DTESTNUM=4 $(AM_CFLAGS) -check_PROGRAMS = $(test_programs) - -all: $(check_PROGRAMS) - -TESTS = $(test_programs) -TESTS_ENVIRONMENT = srcdir=$(srcdir) \ - LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset +check_PROGRAMS += $(TESTS) |