Include image tests in GitHub workflow
authorColin Clark <colin.clark@cclark.uk>
Tue, 4 Jul 2023 09:39:25 +0000 (10:39 +0100)
committerColin Clark <colin.clark@cclark.uk>
Tue, 4 Jul 2023 09:39:25 +0000 (10:39 +0100)
.github/workflows/check-build-actions.yml
meson.build
scripts/get-test-images.sh [new file with mode: 0755]
scripts/image-test.sh [new file with mode: 0755]
scripts/meson.build

index cd13fe2..73edc3e 100644 (file)
@@ -51,6 +51,7 @@ jobs:
       with:
         action: test
         directory: build
+        setup-options: -Ddevel=enabled
         options: --verbose
         meson-version: 0.56.2
     - name: Upload logs
index 4f28d8b..c1c3de8 100644 (file)
@@ -696,3 +696,28 @@ if option.disabled()
 else
     summary({'gtk-builder-tool xvfb' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
 endif
+
+# Image checks
+option = get_option('devel')
+if option.enabled()
+    get_test_images_sh = find_program('get-test-images.sh', dirs : scriptsdir, required : true)
+    image_test_sh = find_program('image-test.sh', dirs : scriptsdir, required : true)
+
+    images_dir = join_paths(meson.current_build_dir(), 'test-images.p')
+
+    message('Downloading test images')
+    sources_list = run_command(get_test_images_sh, images_dir,  'https://github.com/caclark/geeqie-test.git', check: true)
+
+    sources = sources_list.stdout().strip().split('\n')
+
+    foreach image : sources
+        image_path = '@0@'.format(image)
+        path_array = image_path.split('/')
+        image_name = path_array[path_array.length() - 1]
+
+        test('Image_ ' + image_name, image_test_sh, args: [geeqie_exe, image], is_parallel : false, timeout: 100)
+    endforeach
+    summary({'Image tests' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
+else
+    summary({'Image tests' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
+endif
diff --git a/scripts/get-test-images.sh b/scripts/get-test-images.sh
new file mode 100755 (executable)
index 0000000..103c0cb
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+#**********************************************************************
+# Copyright (C) 2023 - The Geeqie Team
+#
+# Author: Colin Clark
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#**********************************************************************
+
+## @file
+## @brief Download test images
+##
+## $1 destination directory \n
+## $2 git test image repo. \n
+##
+
+mkdir -p "$1"
+
+if ! git clone "$2" "$1"
+then
+       exit 1
+fi
+
+for file in "$1/images/"*
+do
+       echo "$file"
+done
+
+exit 0
diff --git a/scripts/image-test.sh b/scripts/image-test.sh
new file mode 100755 (executable)
index 0000000..f5f9aff
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+#**********************************************************************
+# Copyright (C) 2023 - The Geeqie Team
+#
+# Author: Colin Clark
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#**********************************************************************
+
+## @file
+## @brief Run image tests
+##
+## $1 Geeqie executable
+## $2 Full path to image
+##
+##
+
+"$1" "$2" &
+
+# Wait for remote to initialize
+sleep 1
+
+result=$($1 --remote --get-file-info)
+"$1" --remote --quit
+
+if echo "$result" | grep -q "Class: Unknown"
+then
+       exit 1
+else
+       exit 0
+fi
+
index 10df63c..28f2bf7 100644 (file)
@@ -20,6 +20,8 @@ script_sources += files('authors.sh',
 'generate-appimage.sh',
 'generate-linuxdeploy-for-arm.sh',
 'generate-man-page.sh',
+'get-test-images.sh',
+'image-test.sh',
 'keyword_merge.sh',
 'new-release.sh',
 'template-desktop.sh',