[gdk-pixbuf] Use GLib test setup for installed tests



commit 8ec55ff29e0626a05a3aa9d92060e28767ee142f
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jun 23 20:22:35 2013 -0400

    Use GLib test setup for installed tests

 configure.ac      |    8 +-----
 m4/.gitignore     |    3 +-
 m4/glibtests.m4   |   28 ++++++++++++++++++++++
 tests/Makefile.am |   67 ++++++++++------------------------------------------
 4 files changed, 44 insertions(+), 62 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 08825d8..1aa05f9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1025,13 +1025,7 @@ fi
 
 AC_SUBST(GDK_PIXBUF_LINK_FLAGS)
 
-
-AC_ARG_ENABLE(installed_tests,
-              AS_HELP_STRING([--enable-installed-tests],
-                             [Install test programs (default: no)]),,
-              [enable_installed_tests=no])
-AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes)
-
+GLIB_TESTS
 
 ##################################################
 # Output commands
diff --git a/m4/.gitignore b/m4/.gitignore
index eedbbdc..78d4f1c 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -1,3 +1,4 @@
 *.m4
-# We maintain this file in our tree
+# We maintain these files in our tree
 !introspection.m4
+!glibtests.m4
diff --git a/m4/glibtests.m4 b/m4/glibtests.m4
new file mode 100644
index 0000000..27e9024
--- /dev/null
+++ b/m4/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 42319bc..2886804 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,38 +1,30 @@
-include $(top_srcdir)/Makefile.decl
-
-NULL =
+include $(top_srcdir)/glib.mk
 
 INCLUDES =                             \
        -I$(top_srcdir)                 \
        -I$(top_srcdir)/gdk-pixbuf      \
        $(GDK_PIXBUF_DEBUG_FLAGS)       \
-       $(GDK_PIXBUF_DEP_CFLAGS)
-
-AM_CFLAGS = '-DABS_SRCDIR="$(abs_srcdir)"'
+       $(GDK_PIXBUF_DEP_CFLAGS)        \
+       $(NULL)
 
 DEPS = \
        $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GDK_PIXBUF_API_VERSION).la
 
-LDADDS = \
-       $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GDK_PIXBUF_API_VERSION).la \
-       $(GDK_PIXBUF_DEP_LIBS)
+LDADD = \
+       $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GDK_PIXBUF_API_VERSION).la   \
+       $(GDK_PIXBUF_DEP_LIBS) \
+       $(GLIB_LIBS) \
+       $(NULL)
 
-noinst_PROGRAMS = \
+noinst_PROGRAMS =                      \
        animation                       \
        pixbuf-read                     \
        pixbuf-lowmem                   \
        pixbuf-randomly-modified        \
        pixbuf-random                   \
        pixbuf-threads                  \
-       pixbuf-icon-serialize
-
-animation_LDADD = $(LDADDS)
-pixbuf_read_LDADD = $(LDADDS)
-pixbuf_lowmem_LDADD = $(LDADDS)
-pixbuf_randomly_modified_LDADD = $(LDADDS)
-pixbuf_random_LDADD = $(LDADDS)
-pixbuf_threads_LDADD = $(LDADDS) $(GLIB_LIBS)
-pixbuf_icon_serialize_LDADD = $(LDADDS) $(GLIB_LIBS)
+       pixbuf-icon-serialize           \
+       $(NULL)
 
 test_programs =                        \
        animation                       \
@@ -41,43 +33,10 @@ test_programs =                     \
        pixbuf-threads                  \
        $(NULL)
 
-test_data =                            \
+dist_test_data =                       \
        test-image.png                  \
        test-animation.gif              \
        test-animation.ani              \
-       $(NULL)
-
-testimage_data = $(wildcard $(srcdir)/test-images/*)
-
-test_in_files = $(test_programs:=.test.in)
-
-EXTRA_DIST +=                          \
-       $(test_data)                    \
-       $(testimage_data)               \
-       $(test_in_files)                \
-       $(NULL)
-
-if BUILDOPT_INSTALL_TESTS
-insttestdir = $(pkglibexecdir)/installed-tests
-insttest_PROGRAMS = $(test_programs)
-
-insttest_DATA = $(test_data)
-
-testimagedir = $(insttestdir)/test-images
-testimage_DATA = $(testimage_data)
-
-substitutions = \
-       -e s,@pkglibexecdir\@,$(pkglibexecdir),g \
-       $(NULL)
-
-test_files = $(test_in_files:.test.in=.test)
-
-$(test_files): %.test: %.test.in
-       $(AM_V_GEN) sed $(substitutions) $< > $  tmp && mv $  tmp $@
-
-testmetadir = $(datadir)/installed-tests/$(PACKAGE)
-testmeta_DATA = $(test_files)
-
-endif
+       $(wildcard $(srcdir)/test-images/*)
 
 -include $(top_srcdir)/git.mk


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]