diff options
author | Bastien Nocera <hadess@hadess.net> | 2018-10-14 03:44:44 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2018-10-14 03:55:10 +0200 |
commit | 778c97b68c9b87599a2bbf8c6a797b45054504da (patch) | |
tree | 74711882c8f711d848faf34fe49295869e1bf8ae | |
parent | b61f41168ba767f475e12763c581cf86bd48391b (diff) | |
download | shared-mime-info-778c97b68c9b87599a2bbf8c6a797b45054504da.tar.gz |
build: Allow setting test suite helpers
And fix running the test suite with srcdir != builddir
-rw-r--r-- | HACKING | 6 | ||||
-rw-r--r-- | Makefile.am | 18 | ||||
-rw-r--r-- | configure.ac | 5 |
3 files changed, 19 insertions, 10 deletions
@@ -47,9 +47,11 @@ Bugs for new mime-types should include: Test suite ---------- -You need to have xdgmime checked out [1] and compiled at the same level as +You need to have xdgmime checked out [1] and compiled. By default, the build +system will expect the source directory to be at the same level as shared-mime-info. ../xdgmime/src/test-mime-data will be run against -tests/list. +tests/list. An alternate path to xdgmime can be passed by setting the +XDGMIME_PATH environment variable to the appropriate path. The format of the file is: <testcase filename> <expected mime-type> <expected failures> diff --git a/Makefile.am b/Makefile.am index 0941de99..b147d414 100644 --- a/Makefile.am +++ b/Makefile.am @@ -81,6 +81,8 @@ all: $(defaultmakedeps) create-pot: $(AM_V_GEN) $(MAKE) -C po shared-mime-info.pot +XDGMIME_PATH=@XDGMIME_PATH@ + local-test: create-pot freedesktop.org.xml update-mime-database$(EXEEXT) if CROSS_COMPILING @echo "Cross compiling: Skipping checks" @@ -91,11 +93,11 @@ else echo "***************************************************************************" ; \ exit 1 ; \ fi - if test -d .git/ && test -x ../xdgmime/src/print-mime-data$(EXEEXT) ; then \ + if test -d $(top_srcdir)/.git/ ; then \ mkdir -p $(top_builddir)/temp-mime-dir/mime/packages ; \ cp -a $(top_builddir)/freedesktop.org.xml $(top_builddir)/temp-mime-dir/mime/packages/ ; \ XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" $(top_builddir)/update-mime-database$(EXEEXT) "$(top_builddir)/temp-mime-dir/mime/" ; \ - XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" ../xdgmime/src/print-mime-data$(EXEEXT) staging-tests/; \ + XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" $(XDGMIME_PATH)/src/print-mime-data$(EXEEXT) staging-tests/; \ rm -rf "$(top_builddir)/temp-mime-dir/" ; \ fi endif @@ -105,11 +107,11 @@ if CROSS_COMPILING @echo "Cross compiling: Skipping checks" else xmllint --noout --valid $(top_builddir)/freedesktop.org.xml || exit 1; \ - if test -d .git/ && test -x $(top_builddir)/update-mime-database$(EXEEXT) && test -d $(top_srcdir)/mime-db-tests ; then \ - $(top_builddir)/update-mime-database$(EXEEXT) mime-db-tests/ ; \ + if test -d $(top_srcdir)/.git/ ; then \ + $(top_builddir)/update-mime-database$(EXEEXT) $(top_srcdir)/mime-db-tests/ ; \ fi - @if test -d .git/ ; then \ - if test ! -x ../xdgmime/src/test-mime-data$(EXEEXT) || test ! -x $(top_builddir)/test-tree-magic$(EXEEXT) ; then \ + @if test -d $(top_srcdir)/.git/ ; then \ + if test ! -x $(XDGMIME_PATH)/src/test-mime-data$(EXEEXT) || test ! -x $(top_builddir)/test-tree-magic$(EXEEXT) ; then \ echo "***************************************************************************" ; \ echo "*** xdgmime not compiled, test suite cannot run. Check HACKING for info ***" ; \ echo "***************************************************************************" ; \ @@ -118,8 +120,8 @@ else mkdir -p $(top_builddir)/temp-mime-dir/mime/packages ; \ cp -a $(top_builddir)/freedesktop.org.xml $(top_builddir)/temp-mime-dir/mime/packages/ ; \ XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" $(top_builddir)/update-mime-database$(EXEEXT) "$(top_builddir)/temp-mime-dir/mime/" ; \ - XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" ../xdgmime/src/test-mime-data$(EXEEXT) -v tests/list || XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" ../xdgmime/src/test-mime$(EXEEXT) || (XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" ../xdgmime/src/test-mime-data$(EXEEXT) -v -v tests/list ; exit 1); \ - XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" $(top_builddir)/test-tree-magic$(EXEEXT) tests/tree-list || exit 1; \ + XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" $(XDGMIME_PATH)/src/test-mime-data$(EXEEXT) -v $(top_srcdir)/tests/list || XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" $(XDGMIME_PATH)/src/test-mime$(EXEEXT) || (XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" $(XDGMIME_PATH)/src/test-mime-data$(EXEEXT) -v -v $(top_srcdir)/tests/list ; exit 1); \ + XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" $(top_builddir)/test-tree-magic$(EXEEXT) $(top_srcdir)/tests/tree-list || exit 1; \ rm -rf "$(top_builddir)/temp-mime-dir/" ; \ fi; \ fi diff --git a/configure.ac b/configure.ac index 6d39305b..a375c68a 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,11 @@ if test "x$GCC" = "xyes"; then fi ] +if test "x$XDGMIME_PATH" = "x" ; then + XDGMIME_PATH=$srcdir/../xdgmime +fi +AC_SUBST([XDGMIME_PATH], $XDGMIME_PATH) + AC_ARG_ENABLE(update-mimedb, AC_HELP_STRING([--disable-update-mimedb], [disable the update-mime-database after install [default=no]]),, |