From: Colin Clark Date: Tue, 4 Jul 2023 09:39:25 +0000 (+0100) Subject: Include image tests in GitHub workflow X-Git-Tag: v2.2~235 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=73e987c4ce2d1fa2c74b50c12846e4b93ef50284 Include image tests in GitHub workflow --- diff --git a/.github/workflows/check-build-actions.yml b/.github/workflows/check-build-actions.yml index cd13fe24..73edc3e8 100644 --- a/.github/workflows/check-build-actions.yml +++ b/.github/workflows/check-build-actions.yml @@ -51,6 +51,7 @@ jobs: with: action: test directory: build + setup-options: -Ddevel=enabled options: --verbose meson-version: 0.56.2 - name: Upload logs diff --git a/meson.build b/meson.build index 4f28d8b5..c1c3de85 100644 --- a/meson.build +++ b/meson.build @@ -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 index 00000000..103c0cb4 --- /dev/null +++ b/scripts/get-test-images.sh @@ -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 index 00000000..f5f9aff8 --- /dev/null +++ b/scripts/image-test.sh @@ -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 + diff --git a/scripts/meson.build b/scripts/meson.build index 10df63c6..28f2bf77 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -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',