summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2013-05-30 00:07:32 -0400
committerRyan Lortie <desrt@desrt.ca>2013-05-31 16:42:51 -0400
commit2cdad088380d6be6faff39aec9dbd2086bf21681 (patch)
tree3284dbe2b56eb391db35ed6694c3114127ada50c
parenta49ed84f92d736879d4209f0154d3da00401c4cd (diff)
downloadglib-wip/test-cleanup.tar.gz
Rework the build system for a new tests approachwip/test-cleanup
Perform a substantial cleanup of the build system with respect to building and installing testcases. 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 a substantially expanded Makefile.decl, 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 is a net reduction of about ~350 lines of Makefile and configure.ac. 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. There is one regression in this patch: the appinfo tests can no longer be installed due to an inability to handle differently-generated data files for installed vs. uninstalled tests. I could probably work around this, but I lack the will to do so now and I think we may be able to fix this in GLib itself by introducing proper support for relative pathnames to desktop files.
-rw-r--r--Makefile.am15
-rw-r--r--Makefile.decl97
-rw-r--r--configure.ac28
-rw-r--r--gio/Makefile.am20
-rw-r--r--gio/fam/Makefile.am4
-rw-r--r--gio/fen/Makefile.am6
-rw-r--r--gio/gdbus-2.0/codegen/Makefile.am4
-rw-r--r--gio/inotify/Makefile.am6
-rw-r--r--gio/kqueue/Makefile.am6
-rw-r--r--gio/tests/Makefile.am729
-rw-r--r--gio/tests/gdbus-example-objectmanager-client.c2
-rw-r--r--gio/tests/gdbus-example-objectmanager-server.c2
-rw-r--r--gio/tests/gdbus-object-manager-example/Makefile.am37
-rw-r--r--gio/tests/gdbus-peer.c2
-rw-r--r--gio/tests/gdbus-test-fixture.c2
-rw-r--r--gio/tests/gsettings.c61
-rw-r--r--gio/win32/Makefile.am6
-rw-r--r--gio/xdgmime/Makefile.am4
-rw-r--r--glib.mk217
-rw-r--r--glib/Makefile.am15
-rw-r--r--glib/gnulib/Makefile.am4
-rw-r--r--glib/libcharset/Makefile.am6
-rw-r--r--glib/pcre/Makefile.am4
-rw-r--r--glib/tests/Makefile.am194
-rw-r--r--glib/update-pcre/Makefile.am2
-rw-r--r--gmodule/Makefile.am8
-rw-r--r--gobject/Makefile.am14
-rw-r--r--gobject/tests/Makefile.am86
-rw-r--r--gthread/Makefile.am6
-rw-r--r--m4macros/Makefile.am2
-rw-r--r--m4macros/glibtests.m428
-rw-r--r--tests/Makefile.am285
-rw-r--r--tests/gobject/Makefile.am124
-rw-r--r--tests/refcount/Makefile.am33
34 files changed, 947 insertions, 1112 deletions
diff --git a/Makefile.am b/Makefile.am
index b2555adc6..59ee8c33e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,18 +1,13 @@
## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
# http://people.gnome.org/~walters/docs/build-api.txt
.buildapi-allow-builddir:
ACLOCAL_AMFLAGS = -I m4macros ${ACLOCAL_FLAGS}
-SUBDIRS = . m4macros glib gmodule gthread gobject gio po docs
+SUBDIRS = . m4macros glib gmodule gthread gobject gio po docs tests
DIST_SUBDIRS = $(SUBDIRS) build
-if BUILD_MODULAR_TESTS
-SUBDIRS += tests
-else
-DIST_SUBDIRS += tests
-endif
bin_SCRIPTS = glib-gettextize
@@ -49,7 +44,7 @@ EXTRA_DIST += \
README.win32 \
HACKING \
autogen.sh \
- Makefile.decl \
+ glib.mk \
makefile.msc \
msvc_recommended_pragmas.h \
config.h.win32.in \
@@ -67,7 +62,7 @@ EXTRA_DIST += \
# These may be in the builddir too
-BUILT_EXTRA_DIST = \
+BUILT_EXTRA_DIST += \
README \
INSTALL \
ChangeLog \
@@ -105,7 +100,7 @@ $(pkgconfig_DATA): config.status
# build documentation when doing distcheck
DISTCHECK_CONFIGURE_FLAGS = --enable-debug --enable-gtk-doc --enable-man --disable-maintainer-mode
-DISTCLEANFILES = config.lt
+DISTCLEANFILES += config.lt
distclean-local: lcov-clean
if test $(srcdir) = .; then :; else \
diff --git a/Makefile.decl b/Makefile.decl
deleted file mode 100644
index 067e7e5cd..000000000
--- a/Makefile.decl
+++ /dev/null
@@ -1,97 +0,0 @@
-# GLIB - Library of useful C routines
-
-#GTESTER = gtester # for non-GLIB packages
-GTESTER = $(top_builddir)/glib/gtester # for the GLIB package
-GTESTER_REPORT = $(top_builddir)/glib/gtester-report # for the GLIB package
-
-# initialize variables for unconditional += appending
-EXTRA_DIST =
-TEST_PROGS =
-
-### testing rules
-
-# test: run all tests in cwd and subdirs
-test: test-nonrecursive
-if OS_UNIX
- @ for subdir in $(SUBDIRS) . ; do \
- test "$$subdir" = "." -o "$$subdir" = "po" || \
- ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
- done
-
-# test-nonrecursive: run tests only in cwd
-test-nonrecursive: ${TEST_PROGS}
- @test -z "${TEST_PROGS}" || G_TEST_SRCDIR="$(abs_srcdir)" G_TEST_BUILDDIR="$(abs_builddir)" G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS}
-else
-test-nonrecursive:
-endif
-
-# test-report: run tests in subdirs and generate report
-# perf-report: run tests in subdirs with -m perf and generate report
-# full-report: like test-report: with -m perf and -m slow
-test-report perf-report full-report: ${TEST_PROGS}
- @test -z "${TEST_PROGS}" || { \
- case $@ in \
- test-report) test_options="-k";; \
- perf-report) test_options="-k -m=perf";; \
- full-report) test_options="-k -m=perf -m=slow";; \
- esac ; \
- if test -z "$$GTESTER_LOGDIR" ; then \
- G_TEST_SRCDIR="$(abs_srcdir)" G_TEST_BUILDDIR="$(abs_builddir)" ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
- elif test -n "${TEST_PROGS}" ; then \
- G_TEST_SRCDIR="$(abs_srcdir)" G_TEST_BUILDDIR="$(abs_builddir)" ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
- fi ; \
- }
- @ ignore_logdir=true ; \
- if test -z "$$GTESTER_LOGDIR" ; then \
- GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
- ignore_logdir=false ; \
- fi ; \
- if test -d "$(top_srcdir)/.git" ; then \
- REVISION=`git describe` ; \
- else \
- REVISION=$(VERSION) ; \
- fi ; \
- for subdir in $(SUBDIRS) . ; do \
- test "$$subdir" = "." -o "$$subdir" = "po" || \
- ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
- done ; \
- $$ignore_logdir || { \
- echo '<?xml version="1.0"?>' > $@.xml ; \
- echo '<report-collection>' >> $@.xml ; \
- echo '<info>' >> $@.xml ; \
- echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \
- echo ' <version>$(VERSION)</version>' >> $@.xml ; \
- echo " <revision>$$REVISION</revision>" >> $@.xml ; \
- echo '</info>' >> $@.xml ; \
- for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
- sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
- done ; \
- echo >> $@.xml ; \
- echo '</report-collection>' >> $@.xml ; \
- rm -rf "$$GTESTER_LOGDIR"/ ; \
- ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
- }
-.PHONY: test test-report perf-report full-report test-nonrecursive
-
-.PHONY: lcov genlcov lcov-clean
-# use recursive makes in order to ignore errors during check
-lcov:
- -$(MAKE) $(AM_MAKEFLAGS) -k check
- $(MAKE) $(AM_MAKEFLAGS) genlcov
-
-# we have to massage the lcov.info file slightly to hide the effect of libtool
-# placing the objects files in the .libs/ directory separate from the *.c
-# we also have to delete tests/.libs/libmoduletestplugin_*.gcda
-genlcov:
- rm -f $(top_builddir)/tests/.libs/libmoduletestplugin_*.gcda
- $(LTP) --directory $(top_builddir) --capture --output-file glib-lcov.info --test-name GLIB_PERF --no-checksum --compat-libtool
- LANG=C $(LTP_GENHTML) --prefix $(top_builddir) --output-directory glib-lcov --title "GLib Code Coverage" --legend --show-details glib-lcov.info
- @echo "file://$(abs_top_builddir)/glib-lcov/index.html"
-
-lcov-clean:
- -$(LTP) --directory $(top_builddir) -z
- -rm -rf glib-lcov.info glib-lcov
- -find -name '*.gcda' -print | xargs rm
-
-# run tests in cwd as part of make check
-check-local: test-nonrecursive
diff --git a/configure.ac b/configure.ac
index 47a7d1696..775cc94cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,16 +254,8 @@ AC_ARG_ENABLE(rebuilds,
[AS_HELP_STRING([--disable-rebuilds],
[disable all source autogeneration rules])],,
[enable_rebuilds=yes])
-AC_ARG_ENABLE(modular_tests,
- AS_HELP_STRING([--disable-modular-tests],
- [Disable build of test programs (default: no)]),,
- [enable_modular_tests=yes])
-AC_ARG_ENABLE(installed_tests,
- AS_HELP_STRING([--enable-installed-tests],
- [Install test programs (default: no)]),,
- [enable_installed_tests=no])
-AM_CONDITIONAL(BUILD_MODULAR_TESTS, test x$enable_modular_tests = xyes || test x$enable_installed_tests=xyes)
-AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes)
+
+GLIB_TESTS
AC_MSG_CHECKING([whether to enable garbage collector friendliness])
AS_IF([test "x$enable_gc_friendly" = "xyes"], [
@@ -2710,7 +2702,7 @@ dnl ******************************************************************
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
-AS_IF([ test $cross_compiling = yes && test x$enable_modular_tests = xyes], [
+AS_IF([ test $cross_compiling = yes ], [
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal, no)
if test x$GLIB_GENMARSHAL = xno; then
AC_MSG_ERROR(Could not find a glib-genmarshal in your PATH)
@@ -3653,14 +3645,12 @@ AC_CHECK_ALIGNOF([unsigned long])
# Check for libdbus1 - Optional - is only used in the GDBus test cases
#
# 1.2.14 required for dbus_message_set_serial
-AS_IF([ test x$enable_modular_tests = xyes], [
- PKG_CHECK_MODULES(DBUS1,
- dbus-1 >= 1.2.14,
- [AC_DEFINE(HAVE_DBUS1, 1, [Define if dbus-1 is available]) have_dbus1=yes],
- have_dbus1=no)
- AC_SUBST(DBUS1_CFLAGS)
- AC_SUBST(DBUS1_LIBS)
-])
+PKG_CHECK_MODULES(DBUS1,
+ dbus-1 >= 1.2.14,
+ [AC_DEFINE(HAVE_DBUS1, 1, [Define if dbus-1 is available]) have_dbus1=yes],
+ have_dbus1=no)
+AC_SUBST(DBUS1_CFLAGS)
+AC_SUBST(DBUS1_LIBS)
AM_CONDITIONAL(HAVE_DBUS1, [test "x$have_dbus1" = "xyes"])
AC_CHECK_PROGS([DBUS_DAEMON], [dbus-daemon])
diff --git a/gio/Makefile.am b/gio/Makefile.am
index ff662638f..1e7b6b717 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -1,6 +1,4 @@
-include $(top_srcdir)/Makefile.decl
-
-NULL =
+include $(top_srcdir)/glib.mk
SUBDIRS = gdbus-2.0/codegen
@@ -10,7 +8,7 @@ endif
if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE
-noinst_DATA = gio-2.0.lib
+noinst_DATA += gio-2.0.lib
install_ms_lib_cmd = $(INSTALL) gio-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gio-2.0.lib
@@ -233,7 +231,7 @@ platform_libadd += win32/libgiowin32.la
platform_deps += win32/libgiowin32.la
endif
-SUBDIRS += .
+SUBDIRS += . tests
if HAVE_FAM
SUBDIRS += fam
@@ -327,10 +325,6 @@ giowin32include_HEADERS = \
endif
-if BUILD_MODULAR_TESTS
-SUBDIRS += tests
-endif
-
libgio_2_0_la_SOURCES = \
gappinfo.c \
gasynchelper.c \
@@ -622,7 +616,7 @@ gioinclude_HEADERS = \
gioenumtypes.h
# these sources (also mentioned above) are generated.
-BUILT_SOURCES = \
+BUILT_SOURCES += \
gconstructor_as_data.h \
gioenumtypes.h \
gioenumtypes.c \
@@ -642,17 +636,17 @@ EXTRA_DIST += \
gnetworking.h.win32 \
$(NULL)
-BUILT_EXTRA_DIST = \
+BUILT_EXTRA_DIST += \
gio.rc
# This is read by gobject-introspection/misc/ and gtk-doc
gio-public-headers.txt: Makefile
$(AM_V_GEN) echo $(gioinclude_HEADERS) $(giowin32include_HEADERS) $(giounixinclude_HEADERS) > $@.tmp && mv $@.tmp $@
-CLEANFILES = gdbus-daemon-generated.c gdbus-daemon-generated.h gio-public-headers.txt gconstructor_as_data.h
+CLEANFILES += gdbus-daemon-generated.c gdbus-daemon-generated.h gio-public-headers.txt gconstructor_as_data.h
-DISTCLEANFILES = \
+DISTCLEANFILES += \
gioenumtypes.h \
gioenumtypes.c
diff --git a/gio/fam/Makefile.am b/gio/fam/Makefile.am
index 429d7f424..67e0d6766 100644
--- a/gio/fam/Makefile.am
+++ b/gio/fam/Makefile.am
@@ -1,6 +1,4 @@
-include $(top_srcdir)/Makefile.decl
-
-NULL =
+include $(top_srcdir)/glib.mk
module_flags = -export_dynamic -avoid-version -module -no-undefined -export-symbols-regex '^g_io_module_(load|unload|query)'
diff --git a/gio/fen/Makefile.am b/gio/fen/Makefile.am
index 0a22a6456..2b5eb50d0 100644
--- a/gio/fen/Makefile.am
+++ b/gio/fen/Makefile.am
@@ -1,8 +1,6 @@
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
-NULL =
-
-noinst_LTLIBRARIES = libfen.la
+noinst_LTLIBRARIES += libfen.la
libfen_la_SOURCES = \
fen-dump.c \
diff --git a/gio/gdbus-2.0/codegen/Makefile.am b/gio/gdbus-2.0/codegen/Makefile.am
index 1afdaf08b..b3fb2c292 100644
--- a/gio/gdbus-2.0/codegen/Makefile.am
+++ b/gio/gdbus-2.0/codegen/Makefile.am
@@ -1,8 +1,6 @@
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
-NULL =
bin_SCRIPTS =
-CLEANFILES =
codegendir = $(datadir)/glib-2.0/codegen
codegen_PYTHON = \
diff --git a/gio/inotify/Makefile.am b/gio/inotify/Makefile.am
index b51a0a903..283868553 100644
--- a/gio/inotify/Makefile.am
+++ b/gio/inotify/Makefile.am
@@ -1,8 +1,6 @@
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
-NULL =
-
-noinst_LTLIBRARIES = libinotify.la
+noinst_LTLIBRARIES += libinotify.la
libinotify_la_SOURCES = \
inotify-kernel.c \
diff --git a/gio/kqueue/Makefile.am b/gio/kqueue/Makefile.am
index 652c43ed6..77f4cb2aa 100644
--- a/gio/kqueue/Makefile.am
+++ b/gio/kqueue/Makefile.am
@@ -1,8 +1,6 @@
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
-NULL =
-
-noinst_LTLIBRARIES = libkqueue.la
+noinst_LTLIBRARIES += libkqueue.la
libkqueue_la_SOURCES = \
gkqueuefilemonitor.c \
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am
index 948be4659..116d9f261 100644
--- a/gio/tests/Makefile.am
+++ b/gio/tests/Makefile.am
@@ -1,310 +1,107 @@
-
-NULL =
-BUILT_SOURCES =
-
-include $(top_srcdir)/Makefile.decl
-
-insttestdir = $(pkglibexecdir)/installed-tests
+include $(top_srcdir)/glib.mk
+test_ltlibraries =
SUBDIRS = gdbus-object-manager-example services
-AM_CPPFLAGS = \
- -DG_LOG_DOMAIN=\"GLib-GIO\" \
- $(gio_INCLUDES) \
- $(GLIB_DEBUG_FLAGS) \
- -I$(top_builddir)/gio \
- -I$(top_srcdir)/gio \
- $(DBUS1_CFLAGS) \
- -DSRCDIR=\""$(srcdir)"\" \
- -DBUILDDIR=\""$(abs_builddir)"\" \
- -DTEST_SERVICES=\""$(abs_top_builddir)/gio/tests/services"\"
-
-AM_CFLAGS = $(GLIB_WARN_CFLAGS)
-
-noinst_PROGRAMS = $(TEST_PROGS) $(SAMPLE_PROGS)
-noinst_DATA = $(MISC_STUFF)
-
-LDADD = \
- $(top_builddir)/glib/libglib-2.0.la \
- $(top_builddir)/gthread/libgthread-2.0.la \
+LDADD = \
+ $(top_builddir)/glib/libglib-2.0.la \
$(top_builddir)/gobject/libgobject-2.0.la \
$(top_builddir)/gmodule/libgmodule-2.0.la \
$(top_builddir)/gio/libgio-2.0.la
+AM_CPPFLAGS = $(gio_INCLUDES) $(GLIB_DEBUG_FLAGS) -I$(top_builddir)/gio -I$(top_srcdir)/gio
+DEFS = -DG_LOG_DOMAIN=\"GLib-GIO\" -DTEST_SERVICES=\""$(abs_top_builddir)/gio/tests/services"\"
+AM_CFLAGS = $(GLIB_WARN_CFLAGS)
-test_progs = \
- io-stream \
- memory-input-stream \
- memory-output-stream \
- readwrite \
- g-file \
- g-file-info \
- converter-stream \
- data-input-stream \
- data-output-stream \
- g-icon \
- buffered-input-stream \
- buffered-output-stream \
- sleepy-stream \
- filter-streams \
- volumemonitor \
- simple-async-result \
- srvtarget \
- contexts \
- gsettings \
- gschema-compile \
- async-close-output-stream \
- gdbus-addresses \
- network-address \
- gdbus-message \
- socket \
- pollable \
- tls-certificate \
- tls-interaction \
- cancellable \
- vfs \
- network-monitor \
- fileattributematcher \
- resources \
- proxy-test \
- simple-proxy \
- inet-address \
- permission \
- task \
- credentials \
- $(NULL)
-
-if HAVE_DBUS_DAEMON
-test_progs += \
- actions \
- gdbus-connection \
- gdbus-connection-loss \
- gdbus-connection-slow \
- gdbus-names \
- gdbus-proxy \
- gdbus-proxy-threads \
- gdbus-proxy-well-known-name \
- gdbus-introspection \
- gdbus-threading \
- gdbus-export \
- gdbus-error \
- gdbus-bz627724 \
- gmenumodel \
- $(NULL)
-endif
-
-if OS_UNIX
-test_progs += \
- gdbus-close-pending \
- gdbus-connection-flush \
- gdbus-peer \
- gdbus-exit-on-close \
- gdbus-non-socket \
- gdbus-peer-object-manager \
- appinfo \
- contenttype \
- mimeapps \
- file \
+# -----------------------------------------------------------------------------
+# Test programs buildable on all platforms
+
+test_programs = \
+ io-stream \
+ memory-input-stream \
+ memory-output-stream \
+ readwrite \
+ g-file \
+ g-file-info \
+ converter-stream \
+ data-input-stream \
+ data-output-stream \
+ g-icon \
+ buffered-input-stream \
+ buffered-output-stream \
+ sleepy-stream \
+ filter-streams \
+ volumemonitor \
+ simple-async-result \
+ srvtarget \
+ contexts \
+ gschema-compile \
+ async-close-output-stream \
+ gdbus-addresses \
+ network-address \
+ gdbus-message \
+ socket \
+ pollable \
+ tls-interaction \
+ cancellable \
+ vfs \
+ network-monitor \
+ fileattributematcher \
+ proxy-test \
+ simple-proxy \
+ inet-address \
+ permission \
+ task \
+ credentials \
$(NULL)
-endif
-SAMPLE_PROGS = \
- resolver \
- socket-server \
- socket-client \
- echo-server \
- httpd \
- send-data \
- filter-cat \
- gdbus-example-export \
- gdbus-example-own-name \
- gdbus-example-watch-name \
- gdbus-example-watch-proxy \
- gdbus-example-server \
- gdbus-example-subtree \
- gdbus-example-peer \
- gdbus-example-proxy-subclass \
- proxy \
- gapplication-example-open \
- gapplication-example-cmdline \
- gapplication-example-cmdline2 \
- gapplication-example-cmdline3 \
- gapplication-example-actions \
- gapplication-example-dbushooks \
- gdbus-daemon \
+uninstalled_test_programs = \
$(NULL)
-other_progs = \
- gdbus-testserver \
- gdbus-connection-flush-helper \
+dist_test_data = \
+ org.gtk.test.gschema.xml \
+ org.gtk.schemasourcecheck.gschema.xml \
+ testenum.h \
+ enums.xml.template \
+ contexts.c \
+ g-icon.c \
$(NULL)
-noinst_PROGRAMS += $(other_progs)
-if OS_UNIX
-test_progs += \
- live-g-file \
- desktop-app-info \
- unix-fd \
- unix-streams \
- gapplication \
- basic-application \
- gdbus-test-codegen \
- socket-address \
+test_data = \
+ test.gresource \
$(NULL)
-other_progs += \
- appinfo-test \
+uninstalled_test_extra_programs = \
+ resolver \
+ socket-server \
+ echo-server \
+ httpd \
+ send-data \
+ filter-cat \
+ gdbus-example-export \
+ gdbus-example-own-name \
+ gdbus-example-watch-name \
+ gdbus-example-watch-proxy \
+ gdbus-example-server \
+ gdbus-example-subtree \
+ gdbus-example-peer \
+ gdbus-example-proxy-subclass \
+ proxy \
+ gapplication-example-open \
+ gapplication-example-cmdline \
+ gapplication-example-cmdline2 \
+ gapplication-example-cmdline3 \
+ gapplication-example-actions \
+ gapplication-example-dbushooks \
$(NULL)
-SAMPLE_PROGS += \
- gdbus-example-unix-fd-client \
- gdbus-example-objectmanager-server \
- gdbus-example-objectmanager-client \
- gdbus-test-fixture \
+test_extra_programs = \
+ gdbus-testserver \
+ gdbus-connection-flush-helper \
$(NULL)
-endif
-
-if OS_WIN32
-TEST_PROGS += win32-streams
-endif
-
-if PLATFORM_WIN32
-no_undefined = -no-undefined
-endif
-
-actions_SOURCES = actions.c gdbus-sessionbus.c gdbus-sessionbus.h
-
-unix_streams_LDADD = $(LDADD) \
- $(top_builddir)/gthread/libgthread-2.0.la
-
-win32_streams_LDADD = $(LDADD) \
- $(top_builddir)/gthread/libgthread-2.0.la
-
-resolver_LDADD = $(LDADD) \
- $(top_builddir)/gthread/libgthread-2.0.la
-
-socket_server_LDADD = $(LDADD) \
- $(top_builddir)/gthread/libgthread-2.0.la
-
-socket_client_SOURCES = socket-client.c \
- gtlsconsoleinteraction.c \
- gtlsconsoleinteraction.h
-socket_client_LDADD = $(LDADD) \
- $(top_builddir)/gthread/libgthread-2.0.la
-
-echo_server_LDADD = $(LDADD) \
- $(top_builddir)/gthread/libgthread-2.0.la
-
-httpd_LDADD = $(LDADD) \
- $(top_builddir)/gthread/libgthread-2.0.la
-
-send_data_LDADD = $(LDADD) \
- $(top_builddir)/gthread/libgthread-2.0.la
-
-contexts_LDADD = $(LDADD) \
- $(top_builddir)/gthread/libgthread-2.0.la
-
-gdbus_daemon_SOURCES = gdbus-daemon.c $(top_srcdir)/gio/gdbusdaemon.c $(top_builddir)/gio/gdbus-daemon-generated.c
-
-gdbus_testserver_SOURCES = gdbus-testserver.c
-
-if HAVE_DBUS1
-test_progs += gdbus-serialization
-gdbus_serialization_SOURCES = gdbus-serialization.c gdbus-tests.h gdbus-tests.c
-gdbus_serialization_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS)
-gdbus_serialization_LDADD = $(LDADD) $(DBUS1_LIBS)
-endif
-
-test_progs += gdbus-auth
-gdbus_auth_SOURCES = gdbus-auth.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-gdbus_auth_LDADD = $(LDADD)
-
-gdbus_bz627724_SOURCES = gdbus-bz627724.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_close_pending_SOURCES = gdbus-close-pending.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-if OS_UNIX
-gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c : test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
- $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
- UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
- $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \
- --interface-prefix org.project. \
- --generate-c-code gdbus-test-codegen-generated \
- --c-generate-object-manager \
- --c-namespace Foo_iGen \
- --generate-docbook gdbus-test-codegen-generated-doc \
- --annotate "org.project.Bar" Key1 Value1 \
- --annotate "org.project.Bar" org.gtk.GDBus.Internal Value2 \
- --annotate "org.project.Bar.HelloWorld()" Key3 Value3 \
- --annotate "org.project.Bar::TestSignal" Key4 Value4 \
- --annotate "org.project.Bar:ay" Key5 Value5 \
- --annotate "org.project.Bar.TestPrimitiveTypes()[val_int32]" Key6 Value6 \
- --annotate "org.project.Bar.TestPrimitiveTypes()[ret_uint32]" Key7 Value7 \
- --annotate "org.project.Bar::TestSignal[array_of_strings]" Key8 Value8 \
- $(srcdir)/test-codegen.xml \
- $(NULL)
-
-BUILT_SOURCES += gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h
-
-gdbus_test_codegen_SOURCES = gdbus-test-codegen.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-gdbus_test_codegen_SOURCES += gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h
-
-endif # OS_UNIX
-
-gdbus_connection_SOURCES = gdbus-connection.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_connection_flush_SOURCES = \
- gdbus-connection-flush.c \
- test-io-stream.c \
- test-io-stream.h \
- test-pipe-unix.c \
- test-pipe-unix.h \
- $(NULL)
-
-gdbus_connection_loss_SOURCES = gdbus-connection-loss.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_connection_slow_SOURCES = gdbus-connection-slow.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_names_SOURCES = gdbus-names.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_proxy_SOURCES = gdbus-proxy.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_proxy_threads_SOURCES = gdbus-proxy-threads.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_proxy_well_known_name_SOURCES = gdbus-proxy-well-known-name.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_introspection_SOURCES = gdbus-introspection.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_threading_SOURCES = gdbus-threading.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_export_SOURCES = gdbus-export.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_error_SOURCES = gdbus-error.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-gdbus_non_socket_SOURCES = \
- gdbus-non-socket.c \
- gdbus-tests.c \
- gdbus-tests.h \
- test-io-stream.c \
- test-io-stream.h \
- test-pipe-unix.c \
- test-pipe-unix.h \
- $(NULL)
-
-gdbus_exit_on_close_SOURCES = gdbus-exit-on-close.c gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
-
-resources_SOURCES = resources.c test_resources.c test_resources2.c test_resources2.h
-resources_DEPENDENCIES = test.gresource
-
-gapplication_SOURCES = gapplication.c gdbus-sessionbus.h gdbus-sessionbus.c gdbus-tests.h gdbus-tests.c
-
-gmenumodel_SOURCES = gmenumodel.c gdbus-sessionbus.h gdbus-sessionbus.c
-
-TEST_PROGS += $(test_progs)
-
-TESTS_ENVIRONMENT = \
- GLIB_MKENUMS=../../gobject/glib-mkenums \
- GLIB_COMPILE_SCHEMAS=../glib-compile-schemas
+# We need this indirection in order to save automake from itself
+dist_test_data += $(schema_data_files)
+schema_data_files = $(addprefix schema-tests/,$(schema_tests))
schema_tests = \
array-default-not-in-choices.gschema.xml \
bad-choice.gschema.xml \
@@ -357,7 +154,7 @@ schema_tests = \
key-in-list-indirect.gschema.xml \
key-in-list.gschema.xml \
list-of-missing.gschema.xml \
- missing-quotes.gschema.xml \
+ missing-quotes.gschema.xml \
no-default.gschema.xml \
overflow.gschema.xml \
override-missing.gschema.xml \
@@ -379,167 +176,269 @@ schema_tests = \
wrong-category.gschema.xml \
$(NULL)
-schema_test_files = $(addprefix schema-tests/,$(schema_tests))
-
-proxy_LDADD = $(LDADD) \
- $(top_builddir)/gthread/libgthread-2.0.la
-
-tls_certificate_SOURCES = tls-certificate.c gtesttlsbackend.c gtesttlsbackend.h
-
-cert_tests = \
- cert1.pem \
- cert2.pem \
- cert3.pem \
- cert-key.pem \
- cert-list.pem \
- key8.pem \
- key-cert.pem \
- key.pem \
- nothing.pem \
+test_programs += tls-certificate
+tls_certificate_SOURCES = \
+ tls-certificate.c \
+ gtesttlsbackend.c \
+ gtesttlsbackend.h
+dist_test_data += $(cert_data_files)
+cert_data_files = $(addprefix cert-tests/,$(cert_tests))
+cert_tests = \
+ cert1.pem \
+ cert2.pem \
+ cert3.pem \
+ cert-key.pem \
+ cert-list.pem \
+ key8.pem \
+ key-cert.pem \
+ key.pem \
+ nothing.pem \
$(NULL)
-cert_test_files = $(addprefix cert-tests/,$(cert_tests))
+uninstalled_test_extra_programs += socket-client
+socket_client_SOURCES = \
+ socket-client.c \
+ gtlsconsoleinteraction.c \
+ gtlsconsoleinteraction.h
+
+uninstalled_test_extra_programs += gdbus-daemon
+nodist_gdbus_daemon_SOURCES = \
+ $(top_builddir)/gio/gdbus-daemon-generated.c
+gdbus_daemon_SOURCES = \
+ gdbus-daemon.c \
+ $(top_srcdir)/gio/gdbusdaemon.c
+
+test_programs += gsettings
+gsettings_DEPENDENCIES = test.mo
+CLEANFILES += test.mo de/LC_MESSAGES/test.mo
+test.mo: de.po
+ $(AM_V_GEN) $(MSGFMT) -o test.mo $(srcdir)/de.po; \
+ $(MKDIR_P) de/LC_MESSAGES; \
+ cp -f test.mo de/LC_MESSAGES
+# Generated while running the testcase itself...
+CLEANFILES += \
+ org.gtk.test.enums.xml \
+ gsettings.store \
+ gschemas.compiled \
+ schema-source/gschemas.compiled
# -----------------------------------------------------------------------------
+# Test programs buildable on UNIX only
if OS_UNIX
-gdbus_example_objectmanager_server_CFLAGS = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example
-gdbus_example_objectmanager_server_LDADD = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
-
-gdbus_example_objectmanager_client_CFLAGS = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example
-gdbus_example_objectmanager_client_LDADD = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
-
-gdbus_peer_SOURCES = gdbus-peer.c gdbus-tests.h gdbus-tests.c
-gdbus_peer_CFLAGS = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example
-gdbus_peer_LDADD = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
-
-gdbus_test_fixture_SOURCES = gdbus-test-fixture.c
-gdbus_test_fixture_CFLAGS = $(AM_CFLAGS) -I$(top_builddir)/gio/tests/gdbus-object-manager-example
-gdbus_test_fixture_LDADD = $(top_builddir)/gio/tests/gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
-
-endif OS_UNIX
+test_programs += \
+ live-g-file \
+ unix-fd \
+ unix-streams \
+ basic-application \
+ gdbus-test-codegen \
+ socket-address \
+ gdbus-peer-object-manager \
+ contenttype \
+ file \
+ $(NULL)
-# -----------------------------------------------------------------------------
+# Uninstalled because of the check-for-executable logic in DesktopAppInfo unable to find the installed executable
+uninstalled_test_programs += \
+ appinfo \
+ desktop-app-info \
+ $(NULL)
-desktop_test_files = \
+test_data += \
appinfo-test.desktop \
appinfo-test2.desktop \
appinfo-test-gnome.desktop \
appinfo-test-notgnome.desktop \
+ file.c \
$(NULL)
-EXTRA_DIST += \
- socket-common.c \
- org.gtk.test.gschema.xml \
- de.po \
- $(schema_test_files) \
- test-codegen.xml \
- $(cert_test_files) \
- test.gresource.xml \
- test1.txt \
- test2.gresource.xml \
- test2.txt \
- test3.gresource.xml \
- test3.txt \
- test4.gresource.xml \
- $(desktop_test_files) \
+test_extra_programs += \
+ appinfo-test \
$(NULL)
-MISC_STUFF = test.mo test.gresource
-
-test.mo: de.po
- $(MSGFMT) -o test.mo $(srcdir)/de.po; \
- $(MKDIR_P) de/LC_MESSAGES; \
- cp -f test.mo de/LC_MESSAGES
+uninstalled_test_extra_programs += \
+ gdbus-example-unix-fd-client \
+ $(NULL)
-if CROSS_COMPILING
- glib_compile_resources=$(GLIB_COMPILE_RESOURCES)
-else
- glib_compile_resources=$(top_builddir)/gio/glib-compile-resources
-endif
+test_programs += mimeapps
+clean-local: clean-mimeapps
+clean-mimeapps:
+ rm -rf xdgdatadir xdgdatahome
-BUILT_SOURCES += test_resources.c test_resources2.c test_resources2.h
-test_resources.c: test2.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test2.gresource.xml)
- $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_test1 $<
+test_programs += gdbus-connection-flush
+gdbus_connection_flush_SOURCES = \
+ gdbus-connection-flush.c \
+ test-io-stream.c \
+ test-io-stream.h \
+ test-pipe-unix.c \
+ test-pipe-unix.h
-test_resources2.h test_resources2.c: test3.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test3.gresource.xml)
- $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate --c-name _g_test2 --manual-register $<
+test_programs += gdbus-exit-on-close
+gdbus_exit_on_close_SOURCES = gdbus-exit-on-close.c $(gdbus_tests_sources) $(gdbus_sessionbus_sources)
-plugin_resources.c: test4.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test4.gresource.xml)
- $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_plugin $<
+test_programs += gdbus-non-socket
+gdbus_non_socket_SOURCES = \
+ gdbus-non-socket.c \
+ gdbus-tests.c \
+ gdbus-tests.h \
+ test-io-stream.c \
+ test-io-stream.h \
+ test-pipe-unix.c \
+ test-pipe-unix.h
-test.gresource: test.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test.gresource.xml)
- $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) $<
+# These three are manual-run tests because they need a session bus but don't bring one up themselves
+uninstalled_test_extra_programs += gdbus-example-objectmanager-client
+gdbus_example_objectmanager_client_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
-if BUILDOPT_INSTALL_TESTS
-insttest_LTLIBRARIES = libresourceplugin.la
-else
-noinst_LTLIBRARIES = libresourceplugin.la
-endif
+uninstalled_test_extra_programs += gdbus-example-objectmanager-server
+gdbus_example_objectmanager_server_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
-libresourceplugin_la_SOURCES = resourceplugin.c plugin_resources.c
-libresourceplugin_la_LDFLAGS = -avoid-version -module $(no_undefined) -rpath $(insttestdir)
-libresourceplugin_la_LIBADD = $(LDADD)
+uninstalled_test_extra_programs += gdbus-test-fixture
+gdbus_test_fixture_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
-CLEANFILES = gdbus-test-codegen-generated.[ch] gdbus-test-codegen-generated-doc-*.xml test_resources2.[ch] plugin_resources.c
+# This is peer to peer so it doesn't need a session bus (so we can run it normally)
+test_programs += gdbus-peer
+gdbus_peer_LDADD = gdbus-object-manager-example/libgdbus-example-objectmanager.la $(LDADD)
-DISTCLEANFILES = \
- applications/mimeinfo.cache \
- org.gtk.test.enums.xml \
- de/LC_MESSAGES/test.mo \
- test.mo \
- test.gresource \
- test_resources.c \
- gsettings.store \
- gschemas.compiled \
- schema-source/gschemas.compiled
+endif # OS_UNIX
-distclean-local:
- rm -rf xdgdatahome xdgdatadir
+# -----------------------------------------------------------------------------
+# Test programs that need to bring up a session bus (requires dbus-daemon)
-test_files = \
- contexts.c \
- g-icon.c \
- file.c \
- enums.xml.template \
- testenum.h \
- org.gtk.test.gschema.xml \
- org.gtk.schemasourcecheck.gschema.xml \
- test.gresource \
+if HAVE_DBUS_DAEMON
+gdbus_sessionbus_sources = gdbus-sessionbus.c gdbus-sessionbus.h gdbus-tests.h gdbus-tests.c
+
+test_programs += \
+ gapplication \
+ actions \
+ gdbus-auth \
+ gdbus-connection \
+ gdbus-close-pending \
+ gdbus-bz627724 \
+ gdbus-connection-loss \
+ gdbus-connection-slow \
+ gdbus-names \
+ gdbus-proxy \
+ gdbus-proxy-threads \
+ gdbus-proxy-well-known-name \
+ gdbus-introspection \
+ gdbus-threading \
+ gdbus-export \
+ gdbus-error \
+ gmenumodel \
$(NULL)
-EXTRA_DIST += $(test_files)
-if BUILDOPT_INSTALL_TESTS
-insttest_PROGRAMS = $(test_progs) $(other_progs)
+gdbus_proxy_threads_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS)
+gapplication_SOURCES = $(gdbus_sessionbus_sources) gapplication.c
+actions_SOURCES = $(gdbus_sessionbus_sources) actions.c
+gdbus_auth_SOURCES = $(gdbus_sessionbus_sources) gdbus-auth.c
+gdbus_connection_SOURCES = $(gdbus_sessionbus_sources) gdbus-connection.c
+gdbus_close_pending_SOURCES = $(gdbus_sessionbus_sources) gdbus-close-pending.c
+gdbus_bz627724_SOURCES = $(gdbus_sessionbus_sources) gdbus-bz627724.c
+gdbus_connection_loss_SOURCES = $(gdbus_sessionbus_sources) gdbus-connection-loss.c
+gdbus_connection_slow_SOURCES = $(gdbus_sessionbus_sources) gdbus-connection-slow.c
+gdbus_names_SOURCES = $(gdbus_sessionbus_sources) gdbus-names.c
+gdbus_proxy_SOURCES = $(gdbus_sessionbus_sources) gdbus-proxy.c
+gdbus_proxy_threads_SOURCES = $(gdbus_sessionbus_sources) gdbus-proxy-threads.c
+gdbus_proxy_well_known_name_SOURCES = $(gdbus_sessionbus_sources) gdbus-proxy-well-known-name.c
+gdbus_introspection_SOURCES = $(gdbus_sessionbus_sources) gdbus-introspection.c
+gdbus_threading_SOURCES = $(gdbus_sessionbus_sources) gdbus-threading.c
+gdbus_export_SOURCES = $(gdbus_sessionbus_sources) gdbus-export.c
+gdbus_error_SOURCES = $(gdbus_sessionbus_sources) gdbus-error.c
+gmenumodel_SOURCES = $(gdbus_sessionbus_sources) gmenumodel.c
+
+if OS_UNIX
+gdbus_test_codegen_SOURCES = $(gdbus_sessionbus_sources) gdbus-test-codegen.c
+nodist_gdbus_test_codegen_SOURCES = gdbus-test-codegen-generated.c gdbus-test-codegen-generated.h
+
+gdbus-test-codegen.o: gdbus-test-codegen-generated.h
+gdbus-test-codegen-generated.h gdbus-test-codegen-generated.c: test-codegen.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
+ $(AM_V_GEN) UNINSTALLED_GLIB_SRCDIR=$(top_srcdir) \
+ UNINSTALLED_GLIB_BUILDDIR=$(top_builddir) \
+ $(PYTHON) $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen \
+ --interface-prefix org.project. \
+ --generate-c-code gdbus-test-codegen-generated \
+ --c-generate-object-manager \
+ --c-namespace Foo_iGen \
+ --generate-docbook gdbus-test-codegen-generated-doc \
+ --annotate "org.project.Bar" Key1 Value1 \
+ --annotate "org.project.Bar" org.gtk.GDBus.Internal Value2 \
+ --annotate "org.project.Bar.HelloWorld()" Key3 Value3 \
+ --annotate "org.project.Bar::TestSignal" Key4 Value4 \
+ --annotate "org.project.Bar:ay" Key5 Value5 \
+ --annotate "org.project.Bar.TestPrimitiveTypes()[val_int32]" Key6 Value6 \
+ --annotate "org.project.Bar.TestPrimitiveTypes()[ret_uint32]" Key7 Value7 \
+ --annotate "org.project.Bar::TestSignal[array_of_strings]" Key8 Value8 \
+ $(srcdir)/test-codegen.xml \
+ $(NULL)
+
+CLEANFILES += gdbus-test-codegen-generated.[ch] gdbus-test-codegen-generated-doc-*.xml
+endif # OS_UNIX
+endif # HAVE_DBUS_DAEMON
-schematestdir = $(insttestdir)/schema-tests
-schematest_DATA = $(schema_test_files)
+# -----------------------------------------------------------------------------
-certtestdir = $(insttestdir)/cert-tests
-certtest_DATA = $(cert_test_files)
+if OS_WIN32
+test_programs += win32-streams
+endif
-testdatadir = $(insttestdir)
-testdata_DATA = $(test_files)
+if PLATFORM_WIN32
+no_undefined = -no-undefined
+endif
-testmetadir = $(datadir)/installed-tests/$(PACKAGE)
-xfail_tests = desktop-app-info.test
-developer_only_tests = gsettings.test
-testmeta_DATA = $(filter-out $(xfail_tests) $(developer_only_tests),$(test_progs:=.test))
+if HAVE_DBUS1
+test_programs += gdbus-serialization
+gdbus_serialization_CFLAGS = $(AM_CFLAGS) $(DBUS1_CFLAGS)
+gdbus_serialization_LDADD = $(LDADD) $(DBUS1_LIBS)
+gdbus_serialization_SOURCES = \
+ gdbus-serialization.c \
+ gdbus-tests.h \
+ gdbus-tests.c
+endif
-%.test: %$(EXEEXT) Makefile
- $(AM_V_GEN) (echo '[Test]' > $@.tmp; \
- echo 'Type=session' >> $@.tmp; \
- echo 'Exec=$(pkglibexecdir)/installed-tests/$<' >> $@.tmp; \
- mv $@.tmp $@)
+# -----------------------------------------------------------------------------
+# The resources test is a bit more complicated...
-%.desktop.insttest: %.desktop
- sed -e s,Exec=./appinfo-test,Exec=$(insttestdir)/appinfo-test, < $< >$@.tmp && mv $@.tmp $@
+test_programs += resources
+resources_SOURCES = resources.c
+nodist_resources_SOURCES = test_resources.c test_resources2.c test_resources2.h
+resources_DEPENDENCIES = test.gresource
-installed_desktop_test_files = $(desktop_test_files:.desktop=.desktop.insttest)
-install-data-local: $(installed_desktop_test_files)
- for x in $(desktop_test_files); do \
- install -m 0644 $${x}.insttest $(DESTDIR)$(testdatadir)/$$x; \
- done
- install -d -m 0755 $(DESTDIR)$(testdatadir)/schema-tests
+test_ltlibraries += libresourceplugin.la
+libresourceplugin_la_SOURCES = resourceplugin.c plugin_resources.c
+libresourceplugin_la_LDFLAGS = -avoid-version -module -export-dynamic $(no_undefined)
+libresourceplugin_la_LIBADD = $(LDADD)
+# libtool contains a bug whereby the created .la file doesn't contain the correct dlname='' in the case that
+# you're building a library but not installing it. This is apparently because the only considered use for an
+# uninstalled library is as a convenience library for linking (despite the fact that we give -module). The lack
+# of dlname='' in the .la trips up libltdl and GModule as well. We can trick libtool into believing that we
+# will install the module by giving it a bogus -rpath for the uninstalled cases.
+#
+# See http://lists.gnu.org/archive/html/bug-libtool/2013-05/msg00009.html
+if !ENABLE_INSTALLED_TESTS
+libresourceplugin_la_LDFLAGS += -rpath /
endif
+
+if CROSS_COMPILING
+ glib_compile_resources=$(GLIB_COMPILE_RESOURCES)
+else
+ glib_compile_resources=$(top_builddir)/gio/glib-compile-resources
+endif
+
+resources.o: test_resources2.h
+test_resources.c: test2.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test2.gresource.xml)
+ $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_test1 $<
+
+test_resources2.h test_resources2.c: test3.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test3.gresource.xml)
+ $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate --c-name _g_test2 --manual-register $<
+
+plugin_resources.c: test4.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test4.gresource.xml)
+ $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name _g_plugin $<
+
+test.gresource: test.gresource.xml Makefile $(shell $(glib_compile_resources) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/test.gresource.xml)
+ $(AM_V_GEN) $(glib_compile_resources) --target=$@ --sourcedir=$(srcdir) $<
+
+EXTRA_DIST += test.gresource.xml test1.txt test2.gresource.xml test2.txt test3.gresource.xml test3.txt test4.gresource.xml
+
+CLEANFILES += test_resources.c test_resources2.[ch] plugin_resources.c test.gresource
diff --git a/gio/tests/gdbus-example-objectmanager-client.c b/gio/tests/gdbus-example-objectmanager-client.c
index a99399665..b235ca140 100644
--- a/gio/tests/gdbus-example-objectmanager-client.c
+++ b/gio/tests/gdbus-example-objectmanager-client.c
@@ -1,5 +1,5 @@
-#include "gdbus-example-objectmanager-generated.h"
+#include "gdbus-object-manager-example/gdbus-example-objectmanager-generated.h"
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/gio/tests/gdbus-example-objectmanager-server.c b/gio/tests/gdbus-example-objectmanager-server.c
index 1233958b7..2a7bf63b6 100644
--- a/gio/tests/gdbus-example-objectmanager-server.c
+++ b/gio/tests/gdbus-example-objectmanager-server.c
@@ -1,5 +1,5 @@
-#include "gdbus-example-objectmanager-generated.h"
+#include "gdbus-object-manager-example/gdbus-example-objectmanager-generated.h"
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/gio/tests/gdbus-object-manager-example/Makefile.am b/gio/tests/gdbus-object-manager-example/Makefile.am
index 6875210a6..d6d141289 100644
--- a/gio/tests/gdbus-object-manager-example/Makefile.am
+++ b/gio/tests/gdbus-object-manager-example/Makefile.am
@@ -1,24 +1,14 @@
-NULL =
-BUILT_SOURCES =
-CLEANFILES =
+include $(top_srcdir)/glib.mk
-include $(top_srcdir)/Makefile.decl
-
-AM_CPPFLAGS = \
- -g \
- $(gio_INCLUDES) \
- $(GLIB_DEBUG_FLAGS) \
- -I$(top_builddir)/gio \
- -I$(top_srcdir)/gio \
- -DSRCDIR=\""$(srcdir)"\"
+AM_CPPFLAGS = -g $(gio_INCLUDES) $(GLIB_DEBUG_FLAGS) -I$(top_builddir)/gio -I$(top_srcdir)/gio
# ------------------------------------------------------------------------
-GDBUS_GENERATED = \
- gdbus-example-objectmanager-generated.h \
- gdbus-example-objectmanager-generated.c \
+GDBUS_GENERATED = \
+ gdbus-example-objectmanager-generated.h \
+ gdbus-example-objectmanager-generated.c \
gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Animal.xml \
- gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Cat.xml \
+ gdbus-example-objectmanager-generated-org.gtk.GDBus.Example.ObjectManager.Cat.xml \
$(NULL)
$(GDBUS_GENERATED) : gdbus-example-objectmanager.xml Makefile $(top_builddir)/gio/gdbus-2.0/codegen/gdbus-codegen
@@ -33,11 +23,19 @@ $(GDBUS_GENERATED) : gdbus-example-objectmanager.xml Makefile $(top_builddir)/gi
$< \
$(NULL)
+test_ltlibraries = libgdbus-example-objectmanager.la
+
+if ENABLE_GTK_DOC
+# The docs pull these in, so we need them even if not doing 'make check'
BUILT_SOURCES += $(GDBUS_GENERATED)
+noinst_LTLIBRARIES += libgdbus-example-objectmanager.la
+endif
-noinst_LTLIBRARIES = libgdbus-example-objectmanager.la
-libgdbus_example_objectmanager_la_SOURCES = gdbus-example-objectmanager-generated.h gdbus-example-objectmanager-generated.c
-libgdbus_example_objectmanager_la_LIBADD = \
+nodist_libgdbus_example_objectmanager_la_SOURCES = \
+ gdbus-example-objectmanager-generated.h \
+ gdbus-example-objectmanager-generated.c
+
+libgdbus_example_objectmanager_la_LIBADD = \
$(top_builddir)/glib/libglib-2.0.la \
$(top_builddir)/gobject/libgobject-2.0.la \
$(top_builddir)/gmodule/libgmodule-2.0.la \
@@ -47,4 +45,3 @@ libgdbus_example_objectmanager_la_LIBADD = \
EXTRA_DIST += gdbus-example-objectmanager.xml
CLEANFILES += $(GDBUS_GENERATED)
-
diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c
index 152c5884f..45731f8c2 100644
--- a/gio/tests/gdbus-peer.c
+++ b/gio/tests/gdbus-peer.c
@@ -54,7 +54,7 @@
#include "gdbus-tests.h"
-#include "gdbus-example-objectmanager-generated.h"
+#include "gdbus-object-manager-example/gdbus-example-objectmanager-generated.h"
#ifdef G_OS_UNIX
static gboolean is_unix = TRUE;
diff --git a/gio/tests/gdbus-test-fixture.c b/gio/tests/gdbus-test-fixture.c
index a4403dd72..1e0a3223c 100644
--- a/gio/tests/gdbus-test-fixture.c
+++ b/gio/tests/gdbus-test-fixture.c
@@ -1,5 +1,5 @@
-#include "gdbus-example-objectmanager-generated.h"
+#include "gdbus-object-manager-example/gdbus-example-objectmanager-generated.h"
/* ---------------------------------------------------------------------------------------------------- */
diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c
index 922eea262..20967f463 100644
--- a/gio/tests/gsettings.c
+++ b/gio/tests/gsettings.c
@@ -660,14 +660,20 @@ test_l10n (void)
str = NULL;
setlocale (LC_MESSAGES, "de_DE");
- str = g_settings_get_string (settings, "error-message");
- setlocale (LC_MESSAGES, locale);
+ /* Only do the test if translation is actually working... */
+ if (g_str_equal (dgettext ("test", "\"Unnamed\""), "\"Unbenannt\""))
+ {
+ str = g_settings_get_string (settings, "error-message");
- g_assert_cmpstr (str, ==, "Unbenannt");
- g_object_unref (settings);
- g_free (str);
- str = NULL;
+ g_assert_cmpstr (str, ==, "Unbenannt");
+ g_object_unref (settings);
+ g_free (str);
+ str = NULL;
+ }
+ else
+ g_printerr ("warning: translation is not working... skipping test. ");
+ setlocale (LC_MESSAGES, locale);
g_free (locale);
}
@@ -701,14 +707,20 @@ test_l10n_context (void)
str = NULL;
setlocale (LC_MESSAGES, "de_DE");
- g_settings_get (settings, "backspace", "s", &str);
- setlocale (LC_MESSAGES, locale);
+ /* Only do the test if translation is actually working... */
+ if (g_str_equal (dgettext ("test", "\"Unnamed\""), "\"Unbenannt\""))
+ {
+ g_settings_get (settings, "backspace", "s", &str);
- g_assert_cmpstr (str, ==, "Löschen");
- g_object_unref (settings);
- g_free (str);
- str = NULL;
+ g_assert_cmpstr (str, ==, "Löschen");
+ g_object_unref (settings);
+ g_free (str);
+ str = NULL;
+ }
+ else
+ g_printerr ("warning: translation is not working... skipping test. ");
+ setlocale (LC_MESSAGES, locale);
g_free (locale);
}
@@ -1578,24 +1590,6 @@ test_child_schema (void)
g_object_unref (settings);
}
-static gboolean
-glib_translations_work (void)
-{
- gboolean works;
- gchar *locale;
- gchar *orig = "Unnamed";
-
- locale = g_strdup (setlocale (LC_MESSAGES, NULL));
- if (!setlocale (LC_MESSAGES, "de"))
- works = FALSE;
- else
- works = dgettext ("glib20", orig) != orig;
- setlocale (LC_MESSAGES, locale);
- g_free (locale);
-
- return works;
-}
-
#include "../strinfo.c"
static void
@@ -2316,11 +2310,8 @@ main (int argc, char *argv[])
g_test_add_func ("/gsettings/complex-types", test_complex_types);
g_test_add_func ("/gsettings/changes", test_changes);
- if (glib_translations_work ())
- {
- g_test_add_func ("/gsettings/l10n", test_l10n);
- g_test_add_func ("/gsettings/l10n-context", test_l10n_context);
- }
+ g_test_add_func ("/gsettings/l10n", test_l10n);
+ g_test_add_func ("/gsettings/l10n-context", test_l10n_context);
g_test_add_func ("/gsettings/delay-apply", test_delay_apply);
g_test_add_func ("/gsettings/delay-revert", test_delay_revert);
diff --git a/gio/win32/Makefile.am b/gio/win32/Makefile.am
index b75bc36de..a48c68f03 100644
--- a/gio/win32/Makefile.am
+++ b/gio/win32/Makefile.am
@@ -1,8 +1,6 @@
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
-NULL =
-
-noinst_LTLIBRARIES = libgiowin32.la
+noinst_LTLIBRARIES += libgiowin32.la
libgiowin32_la_SOURCES = \
gwin32directorymonitor.c \
diff --git a/gio/xdgmime/Makefile.am b/gio/xdgmime/Makefile.am
index fa39d05e5..42348a6ab 100644
--- a/gio/xdgmime/Makefile.am
+++ b/gio/xdgmime/Makefile.am
@@ -1,8 +1,8 @@
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
AM_CPPFLAGS = -DXDG_PREFIX=_gio_xdg
-noinst_LTLIBRARIES = libxdgmime.la
+noinst_LTLIBRARIES += libxdgmime.la
libxdgmime_la_CFLAGS = $(GLIB_HIDDEN_VISIBILITY_CFLAGS)
libxdgmime_la_SOURCES = \
diff --git a/glib.mk b/glib.mk
new file mode 100644
index 000000000..416d5b134
--- /dev/null
+++ b/glib.mk
@@ -0,0 +1,217 @@
+# GLIB - Library of useful C routines
+
+#GTESTER = gtester # for non-GLIB packages
+GTESTER = $(top_builddir)/glib/gtester # for the GLIB package
+GTESTER_REPORT = $(top_builddir)/glib/gtester-report # for the GLIB package
+NULL =
+
+# initialize variables for unconditional += appending
+BUILT_SOURCES =
+BUILT_EXTRA_DIST =
+CLEANFILES =
+DISTCLEANFILES =
+MAINTAINERCLEANFILES =
+EXTRA_DIST =
+TEST_PROGS =
+
+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 =
+
+### testing rules
+
+# test: run all tests in cwd and subdirs
+test: test-nonrecursive
+if OS_UNIX
+ @ for subdir in $(SUBDIRS) . ; do \
+ test "$$subdir" = "." -o "$$subdir" = "po" || \
+ ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
+ done
+
+# test-nonrecursive: run tests only in cwd
+test-nonrecursive: ${TEST_PROGS}
+ @test -z "${TEST_PROGS}" || G_TEST_SRCDIR="$(abs_srcdir)" G_TEST_BUILDDIR="$(abs_builddir)" G_DEBUG=gc-friendly MALLOC_CHECK_=2 MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256)) ${GTESTER} --verbose ${TEST_PROGS}
+else
+test-nonrecursive:
+endif
+
+# test-report: run tests in subdirs and generate report
+# perf-report: run tests in subdirs with -m perf and generate report
+# full-report: like test-report: with -m perf and -m slow
+test-report perf-report full-report: ${TEST_PROGS}
+ @test -z "${TEST_PROGS}" || { \
+ case $@ in \
+ test-report) test_options="-k";; \
+ perf-report) test_options="-k -m=perf";; \
+ full-report) test_options="-k -m=perf -m=slow";; \
+ esac ; \
+ if test -z "$$GTESTER_LOGDIR" ; then \
+ G_TEST_SRCDIR="$(abs_srcdir)" G_TEST_BUILDDIR="$(abs_builddir)" ${GTESTER} --verbose $$test_options -o test-report.xml ${TEST_PROGS} ; \
+ elif test -n "${TEST_PROGS}" ; then \
+ G_TEST_SRCDIR="$(abs_srcdir)" G_TEST_BUILDDIR="$(abs_builddir)" ${GTESTER} --verbose $$test_options -o `mktemp "$$GTESTER_LOGDIR/log-XXXXXX"` ${TEST_PROGS} ; \
+ fi ; \
+ }
+ @ ignore_logdir=true ; \
+ if test -z "$$GTESTER_LOGDIR" ; then \
+ GTESTER_LOGDIR=`mktemp -d "\`pwd\`/.testlogs-XXXXXX"`; export GTESTER_LOGDIR ; \
+ ignore_logdir=false ; \
+ fi ; \
+ if test -d "$(top_srcdir)/.git" ; then \
+ REVISION=`git describe` ; \
+ else \
+ REVISION=$(VERSION) ; \
+ fi ; \
+ for subdir in $(SUBDIRS) . ; do \
+ test "$$subdir" = "." -o "$$subdir" = "po" || \
+ ( cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@ ) || exit $? ; \
+ done ; \
+ $$ignore_logdir || { \
+ echo '<?xml version="1.0"?>' > $@.xml ; \
+ echo '<report-collection>' >> $@.xml ; \
+ echo '<info>' >> $@.xml ; \
+ echo ' <package>$(PACKAGE)</package>' >> $@.xml ; \
+ echo ' <version>$(VERSION)</version>' >> $@.xml ; \
+ echo " <revision>$$REVISION</revision>" >> $@.xml ; \
+ echo '</info>' >> $@.xml ; \
+ for lf in `ls -L "$$GTESTER_LOGDIR"/.` ; do \
+ sed '1,1s/^<?xml\b[^>?]*?>//' <"$$GTESTER_LOGDIR"/"$$lf" >> $@.xml ; \
+ done ; \
+ echo >> $@.xml ; \
+ echo '</report-collection>' >> $@.xml ; \
+ rm -rf "$$GTESTER_LOGDIR"/ ; \
+ ${GTESTER_REPORT} --version 2>/dev/null 1>&2 ; test "$$?" != 0 || ${GTESTER_REPORT} $@.xml >$@.html ; \
+ }
+.PHONY: test test-report perf-report full-report test-nonrecursive
+
+.PHONY: lcov genlcov lcov-clean
+# use recursive makes in order to ignore errors during check
+lcov:
+ -$(MAKE) $(AM_MAKEFLAGS) -k check
+ $(MAKE) $(AM_MAKEFLAGS) genlcov
+
+# we have to massage the lcov.info file slightly to hide the effect of libtool
+# placing the objects files in the .libs/ directory separate from the *.c
+# we also have to delete tests/.libs/libmoduletestplugin_*.gcda
+genlcov:
+ rm -f $(top_builddir)/tests/.libs/libmoduletestplugin_*.gcda
+ $(LTP) --directory $(top_builddir) --capture --output-file glib-lcov.info --test-name GLIB_PERF --no-checksum --compat-libtool
+ LANG=C $(LTP_GENHTML) --prefix $(top_builddir) --output-directory glib-lcov --title "GLib Code Coverage" --legend --show-details glib-lcov.info
+ @echo "file://$(abs_top_builddir)/glib-lcov/index.html"
+
+lcov-clean:
+ -$(LTP) --directory $(top_builddir) -z
+ -rm -rf glib-lcov.info glib-lcov
+ -find -name '*.gcda' -print | xargs rm
+
+# run tests in cwd as part of make check
+check-local: test-nonrecursive
+
+# 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.
+
+# we use test -z "$(TEST_PROGS)" above, so make sure we have no extra whitespace...
+TEST_PROGS += $(strip $(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_ALWAYS_BUILD_TESTS
+noinst_LTLIBRARIES += $(all_test_ltlibs)
+noinst_PROGRAMS += $(all_test_programs)
+noinst_SCRIPTS += $(all_test_scripts)
+noinst_DATA += $(all_test_data)
+else
+check_LTLIBRARIES += $(all_test_ltlibs)
+check_PROGRAMS += $(all_test_programs)
+check_SCRIPTS += $(all_test_scripts)
+check_DATA += $(all_test_data)
+endif
+
+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)/$<' >> $@.tmp; \
+ mv $@.tmp $@)
+
+CLEANFILES += $(installed_test_meta_DATA)
+endif
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 0744a6c52..12463fa67 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -1,9 +1,5 @@
## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
-
-BUILT_SOURCES =
-DISTCLEANFILES =
-CLEANFILES =
+include $(top_srcdir)/glib.mk
#
# Generate glibconfig.h
@@ -35,11 +31,8 @@ else
MAYBE_PCRE = pcre
endif
-SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre .
+SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . tests
DIST_SUBDIRS = libcharset gnulib pcre update-pcre tests
-if BUILD_MODULAR_TESTS
-SUBDIRS += tests
-endif
AM_CPPFLAGS = \
$(glib_INCLUDES) \
@@ -77,7 +70,7 @@ EXTRA_DIST += \
CLEANFILES += libglib-gdb.py
# These may be in the builddir too
-BUILT_EXTRA_DIST = \
+BUILT_EXTRA_DIST += \
makefile.msc \
glibconfig.h.win32 \
glib.rc
@@ -86,7 +79,7 @@ lib_LTLIBRARIES = libglib-2.0.la
if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE
-noinst_DATA = glib-2.0.lib
+noinst_DATA += glib-2.0.lib
install_ms_lib_cmd = $(INSTALL) glib-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/glib-2.0.lib
diff --git a/glib/gnulib/Makefile.am b/glib/gnulib/Makefile.am
index 03e1d1860..931230e55 100644
--- a/glib/gnulib/Makefile.am
+++ b/glib/gnulib/Makefile.am
@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
AM_CPPFLAGS = \
$(glib_INCLUDES) \
@@ -8,7 +8,7 @@ AM_CPPFLAGS = \
-DG_DISABLE_DEPRECATED \
-DGLIB_COMPILATION
-noinst_LTLIBRARIES = libgnulib.la
+noinst_LTLIBRARIES += libgnulib.la
libgnulib_la_CFLAGS = $(GLIB_HIDDEN_VISIBILITY_CFLAGS)
libgnulib_la_SOURCES = \
diff --git a/glib/libcharset/Makefile.am b/glib/libcharset/Makefile.am
index fb9a9785b..642f75c39 100644
--- a/glib/libcharset/Makefile.am
+++ b/glib/libcharset/Makefile.am
@@ -1,11 +1,11 @@
## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
AM_CPPFLAGS = \
-DLIBDIR=\"$(libdir)\" \
$(config_h_INCLUDES)
-noinst_LTLIBRARIES = libcharset.la
+noinst_LTLIBRARIES += libcharset.la
libcharset_la_CFLAGS = $(GLIB_HIDDEN_VISIBILITY_CFLAGS)
libcharset_la_SOURCES = \
@@ -63,4 +63,4 @@ SUFFIXES = .sed .sin
$(AM_V_GEN) $(SED) -e '/^#/d' -e 's/@''PACKAGE''@/@PACKAGE@/g' $< > t-$@
@mv t-$@ $@
-CLEANFILES = charset.alias ref-add.sed ref-del.sed
+CLEANFILES += charset.alias ref-add.sed ref-del.sed
diff --git a/glib/pcre/Makefile.am b/glib/pcre/Makefile.am
index 53669a0b2..14442dcc0 100644
--- a/glib/pcre/Makefile.am
+++ b/glib/pcre/Makefile.am
@@ -1,6 +1,6 @@
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
-noinst_LTLIBRARIES = libpcre.la
+noinst_LTLIBRARIES += libpcre.la
libpcre_la_CPPFLAGS = \
-DG_LOG_DOMAIN=\"GLib-GRegex\" \
diff --git a/glib/tests/Makefile.am b/glib/tests/Makefile.am
index 5ee09dd79..5753d531e 100644
--- a/glib/tests/Makefile.am
+++ b/glib/tests/Makefile.am
@@ -1,81 +1,31 @@
-include $(top_srcdir)/Makefile.decl
-NULL =
+include $(top_srcdir)/glib.mk
-insttestdir=$(pkglibexecdir)/installed-tests
+LDADD = $(top_builddir)/glib/libglib-2.0.la -lm
+AM_CPPFLAGS = -g $(glib_INCLUDES) $(GLIB_DEBUG_FLAGS)
+DEFS = -DG_LOG_DOMAIN=\"GLib\" -DEXEEXT=\"$(EXEEXT)\"
+AM_CFLAGS = $(GLIB_WARN_CFLAGS)
-bookmark_test_files = \
- bookmarks/fail-01.xbel \
- bookmarks/fail-02.xbel \
- bookmarks/fail-03.xbel \
- bookmarks/fail-04.xbel \
- bookmarks/fail-05.xbel \
- bookmarks/fail-06.xbel \
- bookmarks/fail-07.xbel \
- bookmarks/fail-08.xbel \
- bookmarks/fail-09.xbel \
- bookmarks/fail-10.xbel \
- bookmarks/fail-11.xbel \
- bookmarks/fail-12.xbel \
- bookmarks/fail-13.xbel \
- bookmarks/fail-14.xbel \
- bookmarks/fail-15.xbel \
- bookmarks/fail-16.xbel \
- bookmarks/fail-17.xbel \
- bookmarks/valid-01.xbel \
- bookmarks/valid-02.xbel \
- bookmarks/valid-03.xbel \
- $(NULL)
+# -----------------------------------------------------------------------------
-markup_tests = \
- fail-1 fail-2 fail-3 fail-4 fail-5 \
- fail-6 fail-7 fail-8 fail-9 fail-10 \
- fail-11 fail-12 fail-13 fail-14 fail-15 \
- fail-16 fail-17 fail-18 fail-19 fail-20 \
- fail-21 fail-22 fail-23 fail-24 fail-25 \
- fail-26 fail-27 fail-28 fail-29 fail-30 \
- fail-31 fail-32 fail-33 fail-34 fail-35 \
- fail-36 fail-37 fail-38 fail-39 fail-40 \
- fail-41 fail-42 fail-43 fail-44 fail-45 \
- fail-46 fail-47 fail-48 fail-49 \
- valid-1 valid-2 valid-3 valid-4 valid-5 \
- valid-6 valid-7 valid-8 valid-9 valid-10 \
- valid-11 valid-12 valid-13 valid-14 valid-15 \
+dist_test_data = \
+ keyfiletest.ini \
+ pages.ini \
+ keyfile.c \
+ empty \
+ 4096-random-bytes \
$(NULL)
-all_markup_test_files = $(addprefix markups/,$(markup_tests:=.gmarkup) $(markup_tests:=.expected))
-
-test_files = \
- keyfiletest.ini \
- pages.ini \
- keyfile.c \
- empty \
- 4096-random-bytes \
+dist_test_extra_scripts = \
+ echo-script \
$(NULL)
-test_script_files = \
- echo-script
-
-AM_CPPFLAGS = \
- -g \
- $(glib_INCLUDES) \
- -DG_LOG_DOMAIN=\"GLib\" \
- -DSRCDIR=\""$(srcdir)"\" \
- -DEXEEXT=\"$(EXEEXT)\" \
- $(GLIB_DEBUG_FLAGS)
-
-AM_CFLAGS = $(GLIB_WARN_CFLAGS)
-
-LDADD = $(top_builddir)/glib/libglib-2.0.la -lm
-
-TEST_PROGS += \
- 1bit-emufutex \
- gwakeup \
+test_extra_programs = \
+ test-spawn-echo \
$(NULL)
-all_test_programs = \
+test_programs = \
array-test \
asyncqueue \
- atomic \
base64 \
bitlock \
bookmarkfile \
@@ -130,7 +80,7 @@ all_test_programs = \
spawn-singlethread \
strfuncs \
string \
- testing \
+ testing \
test-printf \
thread \
timeout \
@@ -144,63 +94,79 @@ all_test_programs = \
uri \
1bit-mutex \
642026 \
- 642026-ec
-
-if OS_UNIX
-all_test_programs += unix
-all_test_programs += include
-endif
-
-extra_test_binaries = test-spawn-echo
-
-if BUILD_MODULAR_TESTS
-TEST_PROGS += $(all_test_programs)
-noinst_PROGRAMS = $(TEST_PROGS) $(extra_test_binaries)
-endif
-
-if BUILDOPT_INSTALL_TESTS
-insttest_PROGRAMS = $(all_test_programs) $(extra_test_binaries)
-testmetadir = $(datadir)/installed-tests/$(PACKAGE)
-testmeta_DATA = $(all_test_programs:=.test)
+ $(NULL)
-testdatadir=$(insttestdir)
-testdata_DATA = $(test_files)
+uninstalled_test_programs = \
+ $(NULL)
-testdata_SCRIPTS = $(test_script_files)
+dist_test_data += \
+ bookmarks/fail-01.xbel \
+ bookmarks/fail-02.xbel \
+ bookmarks/fail-03.xbel \
+ bookmarks/fail-04.xbel \
+ bookmarks/fail-05.xbel \
+ bookmarks/fail-06.xbel \
+ bookmarks/fail-07.xbel \
+ bookmarks/fail-08.xbel \
+ bookmarks/fail-09.xbel \
+ bookmarks/fail-10.xbel \
+ bookmarks/fail-11.xbel \
+ bookmarks/fail-12.xbel \
+ bookmarks/fail-13.xbel \
+ bookmarks/fail-14.xbel \
+ bookmarks/fail-15.xbel \
+ bookmarks/fail-16.xbel \
+ bookmarks/fail-17.xbel \
+ bookmarks/valid-01.xbel \
+ bookmarks/valid-02.xbel \
+ bookmarks/valid-03.xbel \
+ $(NULL)
-bookmarksdir=$(insttestdir)/bookmarks
-bookmarks_DATA = $(bookmark_test_files)
+markup_tests = \
+ fail-1 fail-2 fail-3 fail-4 fail-5 \
+ fail-6 fail-7 fail-8 fail-9 fail-10 \
+ fail-11 fail-12 fail-13 fail-14 fail-15 \
+ fail-16 fail-17 fail-18 fail-19 fail-20 \
+ fail-21 fail-22 fail-23 fail-24 fail-25 \
+ fail-26 fail-27 fail-28 fail-29 fail-30 \
+ fail-31 fail-32 fail-33 fail-34 fail-35 \
+ fail-36 fail-37 fail-38 fail-39 fail-40 \
+ fail-41 fail-42 fail-43 fail-44 fail-45 \
+ fail-46 fail-47 fail-48 fail-49 \
+ valid-1 valid-2 valid-3 valid-4 valid-5 \
+ valid-6 valid-7 valid-8 valid-9 valid-10 \
+ valid-11 valid-12 valid-13 valid-14 valid-15 \
+ $(NULL)
-markupsdir=$(insttestdir)/markups
-markups_DATA = $(all_markup_test_files)
-endif
+dist_test_data += $(all_markup_data)
+all_markup_data = $(addprefix markups/,$(markup_tests:=.gmarkup) $(markup_tests:=.expected))
-%.test: %$(EXEEXT) Makefile
- $(AM_V_GEN) (echo '[Test]' > $@.tmp; \
- echo 'Type=session' >> $@.tmp; \
- echo 'Exec=$(pkglibexecdir)/installed-tests/$<' >> $@.tmp; \
- mv $@.tmp $@)
+# -----------------------------------------------------------------------------
+test_programs += atomic
atomic_CFLAGS = $(AM_CFLAGS)
if HAVE_GCC
atomic_CFLAGS += -Wstrict-aliasing=2
endif
+test_programs += 642026-ec
642026_ec_SOURCES = 642026.c
642026_ec_CFLAGS = -DG_ERRORCHECK_MUTEXES
+uninstalled_test_programs += 1bit-emufutex
1bit_emufutex_SOURCES = 1bit-mutex.c
1bit_emufutex_CFLAGS = $(AM_CFLAGS) -DTEST_EMULATED_FUTEX
+uninstalled_test_programs += gwakeup
gwakeup_SOURCES = gwakeuptest.c ../../glib/gwakeup.c
-if HAVE_EVENTFD
-TEST_PROGS += gwakeup-fallback
-gwakeup_fallback_SOURCES = gwakeuptest.c ../../glib/gwakeup.c
-gwakeup_fallback_CFLAGS = $(AM_CFLAGS) -DTEST_EVENTFD_FALLBACK
-endif
+# -----------------------------------------------------------------------------
if OS_UNIX
+test_programs += \
+ unix \
+ include \
+ $(NULL)
# some testing of gtester functionality
XMLLINT = xmllint
@@ -209,19 +175,21 @@ gtester-xmllint-check: # check testreport xml with xmllint if present
${GTESTER} -k --quiet -o tmpsample.xml --test-arg=--gtester-selftest ${GTESTER}
${XMLLINT} --version 2>/dev/null; test "$$?" != 0 || ${XMLLINT} --noout tmpsample.xml
+CLEANFILES += tmpsample.xml
+
check-am: gtester-xmllint-check
private_LDFLAGS = @G_THREAD_LIBS@
+endif
+
+# -----------------------------------------------------------------------------
+if HAVE_EVENTFD
+uninstalled_test_programs += gwakeup-fallback
+gwakeup_fallback_SOURCES = gwakeuptest.c ../../glib/gwakeup.c
+gwakeup_fallback_CFLAGS = $(AM_CFLAGS) -DTEST_EVENTFD_FALLBACK
endif
-CLEANFILES = \
- tmpsample.xml
+# -----------------------------------------------------------------------------
-EXTRA_DIST += \
- $(bookmark_test_files) \
- $(all_markup_test_files) \
- $(test_files) \
- $(test_script_files) \
- bookmarks.xbel \
- $(NULL)
+EXTRA_DIST += bookmarks.xbel
diff --git a/glib/update-pcre/Makefile.am b/glib/update-pcre/Makefile.am
index 66943ec94..864880b3f 100644
--- a/glib/update-pcre/Makefile.am
+++ b/glib/update-pcre/Makefile.am
@@ -1,4 +1,4 @@
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
EXTRA_DIST += \
update.sh \
diff --git a/gmodule/Makefile.am b/gmodule/Makefile.am
index 4a75a304b..6acd8464f 100644
--- a/gmodule/Makefile.am
+++ b/gmodule/Makefile.am
@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
AM_CPPFLAGS = \
$(glib_INCLUDES) \
@@ -22,11 +22,11 @@ EXTRA_DIST += \
gmoduleconf.h.win32 \
gmodule.rc.in
-BUILT_EXTRA_DIST = \
+BUILT_EXTRA_DIST += \
makefile.msc \
gmodule.rc
-BUILT_SOURCES = gmoduleconf.h
+BUILT_SOURCES += gmoduleconf.h
gmoduleconf.h: gmoduleconf.h.in
glibincludedir=$(includedir)/glib-2.0
@@ -41,7 +41,7 @@ lib_LTLIBRARIES = libgmodule-2.0.la
if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE
-noinst_DATA = gmodule-2.0.lib
+noinst_DATA += gmodule-2.0.lib
install_ms_lib_cmd = $(INSTALL) gmodule-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gmodule-2.0.lib
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index d1b52d103..f899e47c5 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -2,15 +2,9 @@
# Copyright (C) 1997,98,99,2000 Tim Janik and Red Hat, Inc.
#
## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
-SUBDIRS = .
-if BUILD_MODULAR_TESTS
-SUBDIRS += tests
-endif
-
-BUILT_SOURCES=
-CLEANFILES=
+SUBDIRS = . tests
AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"GLib-GObject\" \
@@ -27,7 +21,7 @@ lib_LTLIBRARIES = libgobject-2.0.la
if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE
-noinst_DATA = gobject-2.0.lib
+noinst_DATA += gobject-2.0.lib
install_ms_lib_cmd = $(INSTALL) gobject-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gobject-2.0.lib
@@ -210,7 +204,7 @@ EXTRA_DIST += \
CLEANFILES += libgobject-gdb.py
-BUILT_EXTRA_DIST = \
+BUILT_EXTRA_DIST += \
makefile.msc \
gobject.rc
diff --git a/gobject/tests/Makefile.am b/gobject/tests/Makefile.am
index 988a13900..91dc49117 100644
--- a/gobject/tests/Makefile.am
+++ b/gobject/tests/Makefile.am
@@ -1,66 +1,48 @@
-include $(top_srcdir)/Makefile.decl
-NULL =
-
-AM_CPPFLAGS = \
- -g \
- -DG_LOG_DOMAIN=\"GLib-GObject\" \
- $(gobject_INCLUDES) \
- $(GLIB_DEBUG_FLAGS)
+include $(top_srcdir)/glib.mk
+LDADD = ../libgobject-2.0.la $(top_builddir)/glib/libglib-2.0.la
+AM_CPPFLAGS = -g $(gobject_INCLUDES) $(GLIB_DEBUG_FLAGS)
+DEFS = -DG_LOG_DOMAIN=\"GLib-GObject\"
AM_CFLAGS = $(GLIB_WARN_CFLAGS)
+# -----------------------------------------------------------------------------
+
+test_programs = \
+ qdata \
+ boxed \
+ enums \
+ param \
+ threadtests \
+ dynamictests \
+ binding \
+ properties \
+ reference \
+ valuearray \
+ type \
+ $(NULL)
+
+# -----------------------------------------------------------------------------
+
+test_programs += ifaceproperties
+ifaceproperties_SOURCES = ifaceproperties.c testcommon.h
+
+# -----------------------------------------------------------------------------
+
+test_programs += signals
+signals_SOURCES = signals.c
+nodist_signals_SOURCES = marshalers.c marshalers.h
+signals.o: marshalers.h
+CLEANFILES += marshalers.h marshalers.c
+EXTRA_DIST += marshalers.list
+
if CROSS_COMPILING
glib_genmarshal=$(GLIB_GENMARSHAL)
else
glib_genmarshal=$(top_builddir)/gobject/glib-genmarshal
endif
-noinst_PROGRAMS = $(TEST_PROGS)
-LDADD = ../libgobject-2.0.la $(top_builddir)/gthread/libgthread-2.0.la $(top_builddir)/glib/libglib-2.0.la
-
-TEST_PROGS += \
- qdata \
- boxed \
- enums \
- param \
- signals \
- threadtests \
- dynamictests \
- binding \
- properties \
- reference \
- ifaceproperties \
- valuearray \
- type \
- $(NULL)
-
-signals_SOURCES = signals.c marshalers.c
-
marshalers.h: Makefile.am marshalers.list
$(AM_V_GEN) $(glib_genmarshal) --prefix=test $(srcdir)/marshalers.list --header --valist-marshallers > marshalers.h
marshalers.c: Makefile.am marshalers.list
$(AM_V_GEN) (echo "#include \"marshalers.h\""; $(glib_genmarshal) --prefix=test $(srcdir)/marshalers.list --body --valist-marshallers) > $@.tmp && mv $@.tmp $@
-
-BUILT_SOURCES = marshalers.h marshalers.c
-CLEANFILES = marshalers.h marshalers.c
-
-ifaceproperties_SOURCES = ifaceproperties.c testcommon.h
-
-EXTRA_DIST += marshalers.list
-
-if BUILDOPT_INSTALL_TESTS
-insttestdir = $(pkglibexecdir)/installed-tests
-insttest_PROGRAMS = $(TEST_PROGS)
-
-testmetadir = $(datadir)/installed-tests/$(PACKAGE)
-testmeta_DATA = $(TEST_PROGS:=.test)
-
-%.test: %$(EXEEXT) Makefile
- $(AM_V_GEN) (echo '[Test]' > $@.tmp; \
- echo 'Type=session' >> $@.tmp; \
- echo 'Exec=$(pkglibexecdir)/installed-tests/$<' >> $@.tmp; \
- mv $@.tmp $@)
-
-
-endif
diff --git a/gthread/Makefile.am b/gthread/Makefile.am
index 9132be631..f1ef78d6c 100644
--- a/gthread/Makefile.am
+++ b/gthread/Makefile.am
@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
AM_CPPFLAGS = \
$(glib_INCLUDES) \
@@ -14,7 +14,7 @@ EXTRA_DIST += \
gthread.def \
gthread.rc.in
-BUILT_EXTRA_DIST = \
+BUILT_EXTRA_DIST += \
makefile.msc \
gthread.rc
@@ -26,7 +26,7 @@ lib_LTLIBRARIES = libgthread-2.0.la
if OS_WIN32_AND_DLL_COMPILATION
if MS_LIB_AVAILABLE
-noinst_DATA = gthread-2.0.lib
+noinst_DATA += gthread-2.0.lib
install_ms_lib_cmd = $(INSTALL) gthread-2.0.lib $(DESTDIR)$(libdir)
uninstall_ms_lib_cmd = -rm $(DESTDIR)$(libdir)/gthread-2.0.lib
diff --git a/m4macros/Makefile.am b/m4macros/Makefile.am
index 75a9ca05a..971871ce7 100644
--- a/m4macros/Makefile.am
+++ b/m4macros/Makefile.am
@@ -1,4 +1,4 @@
-include $(top_srcdir)/Makefile.decl
+include $(top_srcdir)/glib.mk
installed_m4= glib-2.0.m4 glib-gettext.m4 gsettings.m4
diff --git a/m4macros/glibtests.m4 b/m4macros/glibtests.m4
new file mode 100644
index 000000000..27e902466
--- /dev/null
+++ b/m4macros/glibtests.m4
@@ -0,0 +1,28 @@
+dnl GLIB_TESTS
+dnl
+
+AC_DEFUN([GLIB_TESTS],
+[
+ 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)
+ fi
+])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5a342c529..6a0398d51 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,95 +1,30 @@
-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 \
@@ -99,122 +34,124 @@ test_programs = \
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
-
-test_script_support_programs = unicode-collate
-
-check_PROGRAMS = $(test_programs) $(test_script_support_programs)
-
-TESTS = $(test_programs) $(test_scripts)
-TESTS_ENVIRONMENT = srcdir=$(srcdir) \
- LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset \
- MALLOC_CHECK_=2 \
- MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
-
-test_data = \
- iochannel-test-infile \
- casemap.txt \
- casefold.txt \
- utf8.txt \
+ unicode-encoding \
$(NULL)
-if BUILDOPT_INSTALL_TESTS
-insttest_PROGRAMS = $(test_programs)
-
-testmetadir = $(datadir)/installed-tests/$(PACKAGE)
-testmeta_DATA = $(test_programs:=.test)
-
-insttest_DATA = $(test_data)
+test_extra_programs = \
+ slice-test \
+ slice-color \
+ assert-msg-test \
+ unicode-collate \
+ $(NULL)
-%.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 $@)
+# 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 \
+ $(NULL)
-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)
+# 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 = \
+ 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)
-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
-endif
+slice_threadinit_LDADD = $(LDADD) $(top_builddir)/gthread/libgthread-2.0.la
+
+test_ltlibraries = libmoduletestplugin_a.la libmoduletestplugin_b.la
libmoduletestplugin_a_la_SOURCES = libmoduletestplugin_a.c
-libmoduletestplugin_a_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) -rpath $(insttestdir)
+libmoduletestplugin_a_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined)
libmoduletestplugin_a_la_LIBADD = $(G_MODULE_LIBS) $(libadd_libgmodule) $(libadd_libglib)
libmoduletestplugin_b_la_SOURCES = libmoduletestplugin_b.c
-libmoduletestplugin_b_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) -rpath $(insttestdir)
+libmoduletestplugin_b_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined)
libmoduletestplugin_b_la_LIBADD = $(G_MODULE_LIBS) $(libadd_libgmodule) $(libadd_libglib)
+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
+
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 \
+ 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
+
+if ENABLE_TIMELOOP
+installed_test_programs += timeloop
+endif
+
+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
+
+installed_test_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)