[gnome-logs] Validate desktop file during make check



commit 8e8c2dc65fca90842173f17a12b2ec0bed12db02
Author: David King <davidk gnome org>
Date:   Tue Feb 4 18:00:54 2014 +0000

    Validate desktop file during make check

 Makefile.am  |   19 +++++++++++++++++--
 configure.ac |   19 +++++++++++++++++++
 2 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 944fb9d..c96af90 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,8 @@
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
 
 DISTCHECK_CONFIGURE_FLAGS = \
-       --enable-appdata-validate
+       --enable-appdata-validate \
+       --enable-tests
 
 SUBDIRS = po
 
@@ -86,6 +87,19 @@ data/gnome-logs.1: data/gnome-logs.xml
 nodist_man_MANS = data/gnome-logs.1
 endif
 
+if LOGS_ENABLE_TESTS
+test-desktop-file-validate.sh: Makefile
+       $(AM_V_GEN)echo "#!/bin/sh -e" > $@; \
+               echo "$(DESKTOP_FILE_VALIDATE) $(top_builddir)/$(desktop_DATA) || exit 1" >> $@; \
+               chmod +x $@
+
+check_SCRIPTS = \
+       test-desktop-file-validate.sh
+
+TESTS = \
+       $(check_SCRIPTS)
+endif
+
 iconthemedir = $(datadir)/icons/hicolor
 
 appicon16dir = $(iconthemedir)/16x16/apps
@@ -187,7 +201,8 @@ CLEANFILES = \
        $(enum_data) \
        $(nodist_man_MANS) \
        src/gl-resource.c \
-       src/gl-resource.h
+       src/gl-resource.h \
+       test-desktop-file-validate.sh
 
 MAINTAINERCLEANFILES = \
        build-aux/compile \
diff --git a/configure.ac b/configure.ac
index c51ee8d..f72d084 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,25 @@ AM_CONDITIONAL([ENABLE_MAN], [test "x$have_manutils" = "xyes"])
 dnl AppData XML
 APPDATA_XML
 
+dnl Testing utilities.
+AC_ARG_ENABLE([tests],
+              [AS_HELP_STRING([--disable-tests], [Disable support for tests run during make check])])
+
+AS_IF([test "x$enable_tests" != "xno"],
+      [AC_PATH_PROG([DESKTOP_FILE_VALIDATE], [desktop-file-validate])
+       AS_IF([test "x$ac_cv_path_DESKTOP_FILE_VALIDATE" != "xyes"],
+             [have_desktop_file_validate=yes],
+             [have_desktop_file_validate=no])],
+      [have_desktop_file_validate=no])
+
+AS_IF([test "x$have_desktop_file_validate" = "xyes"],
+      [testing_utilities=yes],
+      [testing_utilities=no
+       AS_IF([test "x$enable_tests" = "xyes"],
+             [AC_MSG_ERROR([tests were requested but the required utilities were not found])])])
+
+AM_CONDITIONAL([LOGS_ENABLE_TESTS], [test "x$testing_utilities" = "xyes"])
+
 dnl Libraries
 GIO_REQUIRED="gio-unix-2.0"
 GTK_REQUIRED="gtk+-3.0 >= 3.9.6"


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