[gimp/meson] Fix tests ; Add create_test_env.sh script.



commit 155e6ae5c4cc085c74a30ed18e09e3cbeced68ea
Author: Félix Piédallu <felix piedallu me>
Date:   Thu Feb 15 15:38:23 2018 +0100

    Fix tests ; Add create_test_env.sh script.

 app/tests/create_test_env.sh |   29 +++++++++++++++++++++++++++++
 app/tests/meson.build        |   30 ++++++++++++++++--------------
 desktop/meson.build          |   25 ++++++++++++++++++-------
 meson.build                  |   11 ++++++-----
 4 files changed, 69 insertions(+), 26 deletions(-)
---
diff --git a/app/tests/create_test_env.sh b/app/tests/create_test_env.sh
new file mode 100644
index 0000000..4bf5bfd
--- /dev/null
+++ b/app/tests/create_test_env.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+# Copy tests resources
+for dir in files gimpdir gimpdir-empty; do
+    rm -rf "${MESON_BUILD_ROOT}/${MESON_SUBDIR}/${dir}"
+    cp -r "${MESON_SOURCE_ROOT}/${MESON_SUBDIR}/${dir}" \
+        "${MESON_BUILD_ROOT}/${MESON_SUBDIR}"
+done
+
+# Link to Color icon theme for tests
+IconsRoot="${MESON_SOURCE_ROOT}/icons/Color"
+IconsDirs=$(find "${IconsRoot}" -name [0-9]* -type d -printf '%f\n' | sort -n)
+for dir in ${IconsDirs} ; do
+    mkdir  "${MESON_BUILD_ROOT}/${MESON_SUBDIR}/gimp-test-icon-theme/hicolor/${dir}x${dir}" -p
+    LnName="${MESON_BUILD_ROOT}/${MESON_SUBDIR}/gimp-test-icon-theme/hicolor/${dir}x${dir}/apps"
+    rm -rf "${LnName}"
+    ln -s "${IconsRoot}/${dir}" "${LnName}"
+done
+
+LnName="${MESON_BUILD_ROOT}/${MESON_SUBDIR}/gimp-test-icon-theme/hicolor/index.theme"
+rm -rf "${LnName}"
+ln -s "${IconsRoot}/index.theme" "${LnName}"
+
+
+# Create output dirs
+rm -rf "${MESON_BUILD_ROOT}/${MESON_SUBDIR}/gimpdir-output"
+for dir in brushes gradients patterns; do
+    mkdir -p "${MESON_BUILD_ROOT}/${MESON_SUBDIR}/gimpdir-output/${dir}"
+done
diff --git a/app/tests/meson.build b/app/tests/meson.build
index 6002304..a466baa 100644
--- a/app/tests/meson.build
+++ b/app/tests/meson.build
@@ -56,31 +56,31 @@ apptests_links += libapptestutils
 
 
 app_tests = [
-  'test-core',
-  'test-gimpidtable',
-  'test-save-and-export',
-  'test-session-2-6-compatibility',
-  'test-session-2-8-compatibility-multi-window',
-  'test-session-2-8-compatibility-single-window',
-  'test-single-window-mode',
-  'test-tools',
-  'test-ui',
-  'test-xcf',
+  'core',
+  'gimpidtable',
+  'save-and-export',
+  'session-2-6-compatibility',
+  'session-2-8-compatibility-multi-window',
+  'session-2-8-compatibility-single-window',
+  'single-window-mode',
+  'tools',
+  'ui',
+  'xcf',
 ]
 
 foreach test_name : app_tests
   test_exe = executable(test_name,
-    test_name + '.c',
+    'test-@0@.c'.format(test_name),
     include_directories: apptests_includes,
     dependencies: apptests_deps,
     link_with: apptests_links,
   )
 
-  test('app_' + test_name,
+  test(test_name,
     test_exe,
     env: [
-      'GIMP_TESTING_ABS_TOP_SRCDIR=' + meson.source_root(),
-      'GIMP_TESTING_ABS_TOP_BUILDDIR=' + meson.build_root(),
+      'GIMP_TESTING_ABS_TOP_SRCDIR='  + meson.build_root(),
+      'GIMP_TESTING_ABS_TOP_BUILDDIR='+ meson.build_root(),
       'GIMP_TESTING_PLUGINDIRS=' + join_paths(meson.build_root(), 'plug-ins', 'common'),
       'GIMP_TESTING_PLUGINDIRS_BASENAME_IGNORES=mkgen.pl',
     ],
@@ -88,3 +88,5 @@ foreach test_name : app_tests
   )
 
 endforeach
+
+run_target('create_test_env', command: find_program('create_test_env.sh'))
diff --git a/desktop/meson.build b/desktop/meson.build
index b973cfa..c784506 100644
--- a/desktop/meson.build
+++ b/desktop/meson.build
@@ -64,10 +64,10 @@ appdatafile = custom_target(appdatafilename,
   install_dir: join_paths(get_option('datadir'), 'appdata'),
 )
 
-appdatafilename = 'gimp-data-extras.metainfo.xml'
-appdatafile = custom_target(appdatafilename,
-  input : [ appdatafilename+'.in', ],
-  output: [ appdatafilename, ],
+metainfofilename = 'gimp-data-extras.metainfo.xml'
+metainfofile = custom_target(metainfofilename,
+  input : [ metainfofilename+'.in', ],
+  output: [ metainfofilename, ],
   command: [
     intltool_merge,
     po_dir,
@@ -91,11 +91,22 @@ custom_target('validate-desktop',
   build_by_default: false,
 )
 
-if test_appdata
-  test('test_appdata',
-    find_program('test-appdata.sh'),
+if appstream_util.found()
+  test('appdata_file',
+    appstream_util,
+    args: [ 'validate-relax', appdatafile ],
+    env: [
+      'GIMP_TESTING_ABS_TOP_BUILDDIR=' + meson.build_root(),
+    ],
+    suite: 'desktop',
+  )
+
+  test('metainfo_file',
+    appstream_util,
+    args: [ 'validate-relax', metainfofile ],
     env: [
       'GIMP_TESTING_ABS_TOP_BUILDDIR=' + meson.build_root(),
     ],
+    suite: 'desktop',
   )
 endif
diff --git a/meson.build b/meson.build
index 3acd2a5..38a7846 100644
--- a/meson.build
+++ b/meson.build
@@ -727,10 +727,11 @@ intltool_merge      = find_program('intltool-merge')
 desktop_validate    = find_program('desktop-file-validate')
 gdk_pixbuf_csource  = find_program('gdk-pixbuf-csource')
 
-test_appdata = (
-  get_option('with-appdata-test') and find_program('appstream-util').found()
-)
-
+if get_option('with-appdata-test')
+  appstream_util = find_program('appstream-util')
+else
+  appstream_util = dependency('', required: false)
+endif
 
 # Check for vector icons
 have_vector_icons = get_option('with-vec-icons')
@@ -1494,6 +1495,6 @@ Optional Modules:
 
 Tests:
   Use xvfb-run         @0@'''.format(xvfb_run.found()) +'''
-  Test appdata         @0@'''.format(test_appdata) +'''
+  Test appdata         @0@'''.format(appstream_util.found()) +'''
 '''
 )


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