From 1b3e2209a64b1963fb505373fdf70ce855e21ab3 Mon Sep 17 00:00:00 2001 From: Omari Stephens Date: Wed, 10 Jul 2024 02:07:40 +0000 Subject: [PATCH] Replaces image-test.sh with image-test.py --- TESTING.md | 2 +- meson.build | 4 +- scripts/image-test.sh | 85 ------------------------------------------- 3 files changed, 3 insertions(+), 88 deletions(-) delete mode 100755 scripts/image-test.sh diff --git a/TESTING.md b/TESTING.md index 9259ba2d8..44b7f3591 100644 --- a/TESTING.md +++ b/TESTING.md @@ -83,7 +83,7 @@ meson setup -C build -D unit_test=enabled This tests that Geeqie can successfully open and provide metadata info about a library of images of different types. -See `scripts/image-test.sh` for more details. +See `scripts/image-test.py` for more details. ### Lua tests diff --git a/meson.build b/meson.build index 25d6e469f..7dfcb7147 100644 --- a/meson.build +++ b/meson.build @@ -702,7 +702,7 @@ option = get_option('unit_tests') if option.enabled() if xvfb.found() 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) + image_test_py = find_program('image-test.py', dirs : scriptsdir, required : true) images_dir = join_paths(meson.current_build_dir(), 'test-images.p') @@ -716,7 +716,7 @@ if option.enabled() image_name = path_array[path_array.length() - 1] should_fail = image_name.startswith('fail') - test_cmd = [image_test_sh.full_path(), geeqie_exe.full_path(), image] + test_cmd = [image_test_py.full_path(), geeqie_exe.full_path(), image] test('Image_ ' + image_name, isolate_test_sh, args: test_cmd, should_fail : should_fail, timeout: 100, suite: ['functional', 'image']) endforeach summary({'Image tests' : ['Test runs:', true]}, section : 'Testing', bool_yn : true) diff --git a/scripts/image-test.sh b/scripts/image-test.sh deleted file mode 100755 index e7324fad3..000000000 --- a/scripts/image-test.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/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 -## -## - -geeqie_exe="$1" -test_image="$2" - -xvfb-run --auto-servernum "$geeqie_exe" "$test_image" & - -xvfb_pid="$!" - -if [ -z "$XDG_CONFIG_HOME" ] -then - config_home="${HOME}/.config" -else - config_home="$XDG_CONFIG_HOME" -fi -command_fifo="${config_home}/geeqie/.command" - -# Wait for remote to initialize -while [ ! -e "$command_fifo" ] ; -do - sleep 1 -done - -# We make sure Geeqie can stay alive for 2 seconds after initialization. -sleep 2 - -# Check if Geeqie crashed (which would cause xvfb-run to terminate) -if ! ps "$xvfb_pid" >/dev/null 2>&1 -then - exit 1 -fi - -result=$(xvfb-run --auto-servernum "$geeqie_exe" --remote --get-file-info) - -## Teardown: various increasingly-forceful attempts to kill the running geeqie process. -xvfb-run --auto-servernum "$geeqie_exe" --remote --quit - -sleep 1 - -if ps "$xvfb_pid" >/dev/null 2>&1 -then - echo "Quit command for xvfb geeqie failed for pid ${xvfb_pid}; sending sigterm" >&2 - kill -TERM "$xvfb_pid" - - sleep 1 - if ps "$xvfb_pid" >/dev/null 2>&1 - then - echo "kill -TERM failed to stop pid ${xvfb_pid}; sending sigkill" >&2 - kill -KILL "$xvfb_pid" - fi -fi - -if echo "$result" | grep -q "Class: Unknown" -then - exit 1 -else - exit 0 -fi