diff options
author | Félix Piédallu <felix@piedallu.me> | 2020-02-20 16:08:57 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2020-02-20 18:00:36 +0100 |
commit | a37cb4db553eb25c7b02813680533fcfbb961fc8 (patch) | |
tree | 93dde53da4e51ccf61d73b8a09c00891e9b3caf9 | |
parent | 6fb21a2046d93f66f4625c0bcddfc5fbef27c501 (diff) | |
download | shared-mime-info-a37cb4db553eb25c7b02813680533fcfbb961fc8.tar.gz |
build: Add script to run the mime detection tests
Replaces the shell in Makefile.am
-rw-r--r-- | Makefile.am | 11 | ||||
-rwxr-xr-x | tests/test_mime.sh | 26 |
2 files changed, 29 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am index 8c1bd0f7..36762a78 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,8 @@ EXTRA_DIST = \ data/freedesktop_generate.sh \ po/check_translations.sh \ tests/test_generic_icons.sh \ - tests/test_duplicate_mime_types.sh + tests/test_duplicate_mime_types.sh \ + tests/test_mime.sh CLEANFILES = freedesktop.org.xml po/stamp-it @@ -120,13 +121,7 @@ else echo "***************************************************************************" ; \ exit 1 ; \ 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_PATH)/src/test-mime-data$(EXEEXT) -v $(top_srcdir)/tests/mime-detection/list || exit 1; \ - XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" XDG_DATA_HOME="$(top_builddir)/temp-mime-dir/" $(XDGMIME_PATH)/src/test-mime$(EXEEXT) || exit 1; \ - XDG_DATA_DIRS="$(top_builddir)/temp-mime-dir/" $(top_builddir)/test-tree-magic$(EXEEXT) $(top_srcdir)/tests/mime-detection/tree-list || exit 1; \ - rm -rf "$(top_builddir)/temp-mime-dir/" ; \ + $(srcdir)/tests/test_mime.sh "$(top_srcdir)" "$(top_builddir)" "$(top_builddir)/freedesktop.org.xml" "$(top_builddir)/update-mime-database$(EXEEXT)" "$(XDGMIME_PATH)/src/test-mime-data$(EXEEXT)" "$(XDGMIME_PATH)/src/test-mime$(EXEEXT)" "$(top_builddir)/test-tree-magic$(EXEEXT)" || exit 1; \ fi; \ fi @$(srcdir)/tests/test_duplicate_mime_types.sh $(srcdir)/data/freedesktop.org.xml.in diff --git a/tests/test_mime.sh b/tests/test_mime.sh new file mode 100755 index 00000000..49c531b6 --- /dev/null +++ b/tests/test_mime.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -e + +source_root="${1}" +build_root="${2}" +xml_db_file="${3}" +update_mime_database="${4}" +xdgmime_test_mime_data="${5}" +xdgmime_test_mime="${6}" +test_tree_magic="${7}" + +tmp_dir=`mktemp -d` + +mkdir -p "${tmp_dir}/mime/packages" + +cp -a "${xml_db_file}" "${tmp_dir}/mime/packages/" + +export XDG_DATA_DIRS="${tmp_dir}" +export XDG_DATA_HOME="${tmp_dir}" + +"${update_mime_database}" "${tmp_dir}/mime/" +"${xdgmime_test_mime_data}" -v "${source_root}/tests/mime-detection/list" +"${xdgmime_test_mime}" +"${test_tree_magic}" "${source_root}/tests/mime-detection/tree-list" + +rm -rf "${tmp_dir}" |