From eb076c08c8f267f7eec65d8d9dc10cfd6debd7fc Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Fri, 20 Jan 2023 18:24:34 +0100 Subject: [PATCH 01/11] chore(linux): Build with meson instead of autotools This change introduces meson for building ibus-keyman instead of autotools. Closes #5981. --- core/src/meson.build | 36 ++- core/tests/unit/kmx/meson.build | 6 +- docs/linux/keyman-config.md | 10 +- linux/.gitignore | 1 - linux/ibus-keyman/icons/meson.build | 6 + linux/ibus-keyman/meson.build | 65 ++++++ linux/ibus-keyman/src/Makefile.am | 4 +- linux/ibus-keyman/src/keyman.xml.in | 17 ++ linux/ibus-keyman/src/meson.build | 43 ++++ linux/ibus-keyman/src/test/meson.build | 65 ++++++ linux/ibus-keyman/src/{ => test}/print_kmp.c | 0 .../src/{ => test}/print_kmpdetails.c | 0 linux/ibus-keyman/src/test/run-tests.sh | 25 ++- linux/ibus-keyman/tests/README.md | 4 +- linux/ibus-keyman/tests/ibusimcontext.c | 2 - linux/ibus-keyman/tests/meson.build | 152 +++++++++++++ linux/ibus-keyman/tests/scripts/find-tests.sh | 6 + .../tests/scripts/run-single-test.sh | 73 +++++++ linux/ibus-keyman/tests/scripts/run-tests.sh | 206 ++++++++++++++++++ .../ibus-keyman/tests/scripts/setup-tests.sh | 111 ++++++++++ .../tests/scripts/teardown-tests.sh | 7 + .../ibus-keyman/tests/scripts/test-helper.sh | 11 + 22 files changed, 814 insertions(+), 36 deletions(-) create mode 100644 linux/ibus-keyman/icons/meson.build create mode 100644 linux/ibus-keyman/meson.build create mode 100644 linux/ibus-keyman/src/keyman.xml.in create mode 100644 linux/ibus-keyman/src/meson.build create mode 100644 linux/ibus-keyman/src/test/meson.build rename linux/ibus-keyman/src/{ => test}/print_kmp.c (100%) rename linux/ibus-keyman/src/{ => test}/print_kmpdetails.c (100%) create mode 100644 linux/ibus-keyman/tests/meson.build create mode 100755 linux/ibus-keyman/tests/scripts/find-tests.sh create mode 100755 linux/ibus-keyman/tests/scripts/run-single-test.sh create mode 100755 linux/ibus-keyman/tests/scripts/run-tests.sh create mode 100755 linux/ibus-keyman/tests/scripts/setup-tests.sh create mode 100755 linux/ibus-keyman/tests/scripts/teardown-tests.sh create mode 100644 linux/ibus-keyman/tests/scripts/test-helper.sh diff --git a/core/src/meson.build b/core/src/meson.build index cbf2f8c6da..254eefcad6 100644 --- a/core/src/meson.build +++ b/core/src/meson.build @@ -58,18 +58,7 @@ if compiler.get_id() == 'emscripten' links = [] endif -lib = library('kmnkbp0', - 'option.cpp', - 'keyboard.cpp', - 'state.cpp', - 'km_kbp_context_api.cpp', - 'km_kbp_keyboard_api.cpp', - 'km_kbp_options_api.cpp', - 'km_kbp_state_api.cpp', - 'km_kbp_debug_api.cpp', - 'km_kbp_processevent_api.cpp', - 'jsonpp.cpp', - 'mock/mock_processor.cpp', +kmxfiles = files( 'kmx/kmx_consts.cpp', 'kmx/kmx_processevent.cpp', 'kmx/kmx_actions.cpp', @@ -84,7 +73,30 @@ lib = library('kmnkbp0', 'kmx/kmx_options.cpp', 'kmx/kmx_processor.cpp', 'kmx/kmx_xstring.cpp', +) + +apifiles = files( + 'km_kbp_context_api.cpp', + 'km_kbp_keyboard_api.cpp', + 'km_kbp_options_api.cpp', + 'km_kbp_state_api.cpp', + 'km_kbp_debug_api.cpp', + 'km_kbp_processevent_api.cpp', +) + +corefiles = files( + 'option.cpp', + 'keyboard.cpp', + 'state.cpp', + 'jsonpp.cpp', 'utfcodec.cpp', +) + +lib = library('kmnkbp0', + apifiles, + corefiles, + kmxfiles, + 'mock/mock_processor.cpp', version_res, cpp_args: defns + warns + flags, link_args: links, diff --git a/core/tests/unit/kmx/meson.build b/core/tests/unit/kmx/meson.build index 63188c764a..014983a9af 100644 --- a/core/tests/unit/kmx/meson.build +++ b/core/tests/unit/kmx/meson.build @@ -25,9 +25,13 @@ else test_path = meson.current_build_dir() endif +coretestfiles = files( + 'kmx_test_source.cpp', +) + kmx = executable('kmx', 'kmx.cpp', - 'kmx_test_source.cpp', + coretestfiles, cpp_args: defns + warns, include_directories: [inc, libsrc], link_args: links + tests_flags, diff --git a/docs/linux/keyman-config.md b/docs/linux/keyman-config.md index c12db30c94..f050fd96ad 100644 --- a/docs/linux/keyman-config.md +++ b/docs/linux/keyman-config.md @@ -13,7 +13,8 @@ sudo apt install python3-lxml python3-magic python3-numpy python3-qrcode python3 python3-setuptools python3-pip python3-dbus ibus libglib2.0-bin liblocale-gettext-perl ``` -Either `python3-raven` or `python3-sentry-sdk` (>= 1.4) is required as well. On Ubuntu 22.04 and later run: +Either `python3-raven` or `python3-sentry-sdk` (>= 1.4) is required as well. +On Ubuntu 22.04 and later run: ```bash sudo apt install python3-sentry-sdk @@ -34,8 +35,8 @@ or install it with pip: pip3 install sentry-sdk ``` -Run the script `./createkeymandirs.sh` to create the directories for these programs to -install the packages to. +Run the script `./createkeymandirs.sh` to create the directories for these +programs to install the packages to. Also copy and compile the GSettings schema: @@ -65,7 +66,8 @@ To uninstall you can run `sudo make uninstall`. `./km-config` -This displays a configuration panel that shows the currently installed Keyman keyboard packages and can download and install additional keyboards. +This displays a configuration panel that shows the currently installed Keyman +keyboard packages and can download and install additional keyboards. #### Buttons diff --git a/linux/.gitignore b/linux/.gitignore index cf78b5ab49..bb6ad7a741 100644 --- a/linux/.gitignore +++ b/linux/.gitignore @@ -92,7 +92,6 @@ test.sh debianpackage/ *.deb *.ddeb -*.build *.buildinfo *.changes *.tar.xz diff --git a/linux/ibus-keyman/icons/meson.build b/linux/ibus-keyman/icons/meson.build new file mode 100644 index 0000000000..dce1d23614 --- /dev/null +++ b/linux/ibus-keyman/icons/meson.build @@ -0,0 +1,6 @@ +icons = files('default.png') + +install_data( + icons, + install_dir: '{datadir}/keyman/icons' +) diff --git a/linux/ibus-keyman/meson.build b/linux/ibus-keyman/meson.build new file mode 100644 index 0000000000..fa807e8842 --- /dev/null +++ b/linux/ibus-keyman/meson.build @@ -0,0 +1,65 @@ +project('ibus-keyman', 'c', 'cpp', + version: run_command('cat', '../../VERSION.md', check: true).stdout().strip(), + license: 'GPL-2+', + # default_options : ['buildtype=release', + # 'cpp_std=c++14', + # 'b_vscrt=static_from_buildtype', + # 'warning_level=2'], + meson_version: '>=0.53.0') +cc = meson.get_compiler('c') +conf = configuration_data() + +ibus = dependency('ibus-1.0', version: '>= 1.2.0') +gtk = dependency('gtk+-3.0', version: '>= 2.4') +x11 = dependency('x11', version: '>= 1.6') +json_glib = dependency('json-glib-1.0', version: '>= 1.0') +kmnkbp = dependency('keyman_kmn_processor', version: '>= 0.0.0') + +env = find_program('env') + +# define some variables. We wouldn't need this if we'd have a meson.build file +# in the Keyman root directory... +coredir = '@0@/../../core'.format(meson.current_source_dir()) + +kmxfiles = files( + join_paths(coredir, 'src/kmx/kmx_consts.cpp'), + join_paths(coredir, 'src/kmx/kmx_processevent.cpp'), + join_paths(coredir, 'src/kmx/kmx_actions.cpp'), + join_paths(coredir, 'src/kmx/kmx_capslock.cpp'), + join_paths(coredir, 'src/kmx/kmx_context.cpp'), + join_paths(coredir, 'src/kmx/kmx_conversion.cpp'), + join_paths(coredir, 'src/kmx/kmx_debug.cpp'), + join_paths(coredir, 'src/kmx/kmx_debugger.cpp'), + join_paths(coredir, 'src/kmx/kmx_environment.cpp'), + join_paths(coredir, 'src/kmx/kmx_file.cpp'), + join_paths(coredir, 'src/kmx/kmx_modifiers.cpp'), + join_paths(coredir, 'src/kmx/kmx_options.cpp'), + join_paths(coredir, 'src/kmx/kmx_processor.cpp'), + join_paths(coredir, 'src/kmx/kmx_xstring.cpp'), +) +corefiles = files( + join_paths(coredir, 'src/option.cpp'), + join_paths(coredir, 'src/keyboard.cpp'), + join_paths(coredir, 'src/state.cpp'), + join_paths(coredir, 'src/jsonpp.cpp'), + join_paths(coredir, 'src/utfcodec.cpp'), +) +coretestfiles = files( + join_paths(coredir, 'tests/unit/kmx/kmx_test_source.cpp'), +) + +# Check if we have patched ibus +code = '''#include +int x = IBUS_PREFILTER_MASK | IBUS_CAP_PREFILTER; +''' +if cc.compiles(code, dependencies: [ibus], name: 'check for patched ibus') + conf.set('IBUS_HAS_PREFILTER', 1) +endif + +conf.set('HAVE_CONFIG_H', 1) +configure_file(output : 'config.h', + configuration : conf) + +subdir('icons') +subdir('src') +subdir('tests') diff --git a/linux/ibus-keyman/src/Makefile.am b/linux/ibus-keyman/src/Makefile.am index 95361020c5..ce9f72640a 100644 --- a/linux/ibus-keyman/src/Makefile.am +++ b/linux/ibus-keyman/src/Makefile.am @@ -50,11 +50,11 @@ TESTS = \ $(NULL) print_kmp_SOURCES = \ - print_kmp.c + test/print_kmp.c print_kmpdetails_SOURCES = \ kmpdetails.c \ - print_kmpdetails.c \ + test/print_kmpdetails.c \ $(NULL) print_kmpdetails_CFLAGS = \ $(AM_CFLAGS) \ diff --git a/linux/ibus-keyman/src/keyman.xml.in b/linux/ibus-keyman/src/keyman.xml.in new file mode 100644 index 0000000000..d41cc8021c --- /dev/null +++ b/linux/ibus-keyman/src/keyman.xml.in @@ -0,0 +1,17 @@ + + + org.freedesktop.IBus.Keyman + Keyman Component + @libexecdir@/ibus-engine-keyman --ibus + @VERSION@ + Keyman Team <support@keyman.com> + GPL + https://keyman.com + ibus-keyman + + /usr/share/keyman/ + /usr/local/share/keyman/ + ~/.local/share/keyman/ + + + diff --git a/linux/ibus-keyman/src/meson.build b/linux/ibus-keyman/src/meson.build new file mode 100644 index 0000000000..63ab8ded94 --- /dev/null +++ b/linux/ibus-keyman/src/meson.build @@ -0,0 +1,43 @@ +utilfiles = files( + 'keymanutil.c', + 'keymanutil.h', + 'kmpdetails.c', + 'kmpdetails.h', +) + +engine_sources = files( + 'main.c', + 'engine.c', + 'engine.h', + 'keycodes.h', + 'keyman-service.c', + 'keyman-service.h', +) + +deps = [ibus, gtk, x11, json_glib, kmnkbp] + +prefix = get_option('prefix') +cfg = configuration_data() +cfg.set('VERSION', meson.project_version()) +cfg.set('libexecdir', join_paths(prefix, get_option('libexecdir'))) + +configure_file( + configuration: cfg, + input: 'keyman.xml.in', + output: 'keyman.xml' +) + +configure_file( + configuration: cfg, + input: 'keyman-version.h.in', + output: 'keyman-version.h' +) + +exe = executable( + 'ibus-engine-keyman', + sources: [engine_sources, utilfiles], + dependencies: deps, + include_directories: include_directories('@0@/..'.format(meson.current_build_dir())), +) + +subdir('test') diff --git a/linux/ibus-keyman/src/test/meson.build b/linux/ibus-keyman/src/test/meson.build new file mode 100644 index 0000000000..57302d2dcf --- /dev/null +++ b/linux/ibus-keyman/src/test/meson.build @@ -0,0 +1,65 @@ +keymanutil_sources = [ + 'keymanutil_tests.c', + utilfiles, +] + +keymanutil_deps = [ibus, gtk, x11, json_glib, kmnkbp] + +include_dirs = [ + include_directories('@0@/..'.format(meson.current_build_dir())), + '..' +] + +executable( + 'keymanutil-tests', + sources: keymanutil_sources, + dependencies: keymanutil_deps, + include_directories : include_dirs +) + +test( + 'keymanutil-tests', + find_program('run-tests.sh'), + env: [ + 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), + 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), + ], + protocol: 'tap', +) + +test( + 'print-kmpdetails-test', + executable( + 'print_kmpdetails', + sources: [ + 'print_kmpdetails.c', + '../kmpdetails.c' + ], + dependencies: [ json_glib ], + include_directories: include_dirs + ), + args: [ '@0@'.format(meson.current_source_dir()) ], + env: [ + 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), + 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), + ], + protocol: 'exitcode', +) + +test( + 'print-kmp-test', + executable( + 'print_kmp', + sources: [ + 'print_kmp.c', + ], + dependencies: [ json_glib ], + include_directories: include_dirs + ), + args: [ join_paths('@0@'.format(meson.current_source_dir()), 'kmp.json') ], + env: [ + 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), + 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), + ], + protocol: 'exitcode', +) diff --git a/linux/ibus-keyman/src/print_kmp.c b/linux/ibus-keyman/src/test/print_kmp.c similarity index 100% rename from linux/ibus-keyman/src/print_kmp.c rename to linux/ibus-keyman/src/test/print_kmp.c diff --git a/linux/ibus-keyman/src/print_kmpdetails.c b/linux/ibus-keyman/src/test/print_kmpdetails.c similarity index 100% rename from linux/ibus-keyman/src/print_kmpdetails.c rename to linux/ibus-keyman/src/test/print_kmpdetails.c diff --git a/linux/ibus-keyman/src/test/run-tests.sh b/linux/ibus-keyman/src/test/run-tests.sh index 04b78a95fe..932f64b886 100755 --- a/linux/ibus-keyman/src/test/run-tests.sh +++ b/linux/ibus-keyman/src/test/run-tests.sh @@ -1,6 +1,6 @@ #!/bin/bash -SRCDIR=${top_srcdir:-$(realpath $(dirname $0)/../..)} +SRCDIR=${top_srcdir:-$(realpath "$(dirname $0)/../..")} PID_FILE=/tmp/keymanutil-tests-pids if [ -v KEYMAN_PKG_BUILD ]; then @@ -12,19 +12,20 @@ if [ -v KEYMAN_PKG_BUILD ]; then exit 0 fi + if ! which Xvfb > /dev/null || ! which Xephyr > /dev/null || ! which metacity > /dev/null; then - echo "Please install Xvfb, Xephyr and metacity before running these tests!" + echo "# Please install Xvfb, Xephyr and metacity before running these tests!" exit 1 fi function cleanup() { if [ -f $PID_FILE ]; then echo - echo "Shutting down processes..." + echo "# Shutting down processes..." bash $PID_FILE > /dev/null 2>&1 rm $PID_FILE - rm -rf $TEMP_DATA_DIR - echo "Finished shutdown of processes." + rm -rf "$TEMP_DATA_DIR" + echo "# Finished shutdown of processes." fi } @@ -32,15 +33,15 @@ echo > $PID_FILE trap cleanup EXIT SIGINT -echo "Starting Xvfb..." +echo "# Starting Xvfb..." Xvfb -screen 0 1024x768x24 :33 &> /dev/null & echo "kill -9 $!" >> $PID_FILE sleep 1 -echo "Starting Xephyr..." +echo "# Starting Xephyr..." DISPLAY=:33 Xephyr :32 -screen 1024x768 &> /dev/null & echo "kill -9 $!" >> $PID_FILE sleep 1 -echo "Starting metacity" +echo "# Starting metacity" metacity --display=:32 &> /dev/null & echo "kill -9 $!" >> $PID_FILE @@ -51,10 +52,10 @@ TEMP_DATA_DIR=$(mktemp --directory) SCHEMA_DIR=$TEMP_DATA_DIR/glib-2.0/schemas export XDG_DATA_DIRS=$TEMP_DATA_DIR:$XDG_DATA_DIRS -mkdir -p $SCHEMA_DIR -cp $SRCDIR/../keyman-config/com.keyman.gschema.xml $SCHEMA_DIR/ -glib-compile-schemas $SCHEMA_DIR +mkdir -p "$SCHEMA_DIR" +cp "$SRCDIR/../keyman-config/com.keyman.gschema.xml" "$SCHEMA_DIR/" +glib-compile-schemas "$SCHEMA_DIR" export GSETTINGS_BACKEND=memory -./keymanutil-tests $@ +${G_TEST_BUILDDIR:-.}/keymanutil-tests "$@" diff --git a/linux/ibus-keyman/tests/README.md b/linux/ibus-keyman/tests/README.md index 8088f2f534..f7537a79fd 100644 --- a/linux/ibus-keyman/tests/README.md +++ b/linux/ibus-keyman/tests/README.md @@ -13,7 +13,7 @@ The tests get run as part of building `ibus-keyman`, more specifically when runn All tests can be run with the test script: ```bash -./run-tests.sh +scripts/run-tests.sh ``` ### Run specific tests @@ -22,5 +22,5 @@ To run a single test you pass the testname (as found in `core/build/arch/*/tests/unit/kmx`). Multiple tests should be separated by space. ```bash -./run-tests.sh -- k_000___null_keyboard k_005___nul_with_initial_context +scripts/run-tests.sh -- k_000___null_keyboard k_005___nul_with_initial_context ``` diff --git a/linux/ibus-keyman/tests/ibusimcontext.c b/linux/ibus-keyman/tests/ibusimcontext.c index d35441a695..dc83cf8b97 100644 --- a/linux/ibus-keyman/tests/ibusimcontext.c +++ b/linux/ibus-keyman/tests/ibusimcontext.c @@ -28,9 +28,7 @@ // simplyfying the code a bit by replacing async calls with direct synchronous // method calls. -#ifdef HAVE_CONFIG_H #include -#endif #ifndef IBUS_HAS_PREFILTER #warning Compiling against ibus version that does not include prefilter mask patch (https://github.com/ibus/ibus/pull/2440). Output ordering guarantees will be disabled. diff --git a/linux/ibus-keyman/tests/meson.build b/linux/ibus-keyman/tests/meson.build new file mode 100644 index 0000000000..494196cc35 --- /dev/null +++ b/linux/ibus-keyman/tests/meson.build @@ -0,0 +1,152 @@ +sources = [ + 'ibusimcontext.c', + 'ibusimcontext.h', + 'testfixture.cpp', + 'testmodule.c', + 'testmodule.h', + kmxfiles, + corefiles, + utilfiles, + coretestfiles, +] + +deps = [ibus, gtk, x11, json_glib, kmnkbp] + +include_dirs = [ + include_directories('../../../core/src'), + include_directories('../../../core/src/kmx'), + include_directories('../../../core/tests/unit/kmx'), + include_directories('../../../common/include'), + include_directories('../src'), + include_directories('..'), +] + +test_exe = executable( + 'ibus-keyman-tests', + sources: sources, + dependencies: deps, + include_directories: include_dirs +) + +env_file = '/tmp/env.txt' +pid_file = '/tmp/ibus-keyman-test-pids' + +setup_tests = find_program('setup-tests.sh', dirs: [join_paths(meson.current_source_dir(), 'scripts')]) +teardown_tests = find_program('teardown-tests.sh', dirs: [join_paths(meson.current_source_dir(), 'scripts')]) +run_test = find_program('run-single-test.sh', dirs: [join_paths(meson.current_source_dir(), 'scripts')]) +find_tests = find_program('find-tests.sh', dirs: [join_paths(meson.current_source_dir(), 'scripts')]) + +test( + 'setup-x11', + setup_tests, + args: ['--x11', env_file, pid_file], + env: [ + 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), + 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), + ], + priority: -10, + is_parallel: false, + protocol: 'exitcode' +) + +test( + 'setup-wayland', + setup_tests, + args: ['--wayland', env_file, pid_file], + env: [ + 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), + 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), + ], + priority: -20, + is_parallel: false, + protocol: 'exitcode' +) + +test( + 'teardown-x11', + teardown_tests, + args: [pid_file], + priority: -19, + is_parallel: false, + protocol: 'exitcode' +) + +test( + 'teardown-wayland', + teardown_tests, + args: [pid_file], + priority: -29, + is_parallel: false, + protocol: 'exitcode' +) + +kmx_dir = join_paths(meson.current_source_dir(), '../../../core/build/arch/debug/tests/unit/kmx') +kmx_files = run_command( + find_tests, + kmx_dir, + check: true, +).stdout().split('\n') + +foreach kmx: kmx_files + filename = kmx.split('\t') + if filename[0] == '' + continue + endif + testname = filename[1].split('.kmx')[0] + test( + 'X11-' + testname + '__surrounding-text', + run_test, + args: [ '--tap', '-k', '--x11', '--env', env_file, '--surrounding-text', '--', filename], + env: [ + 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), + 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), + ], + depends: [test_exe], + priority: -11, + is_parallel: false, + timeout: 120, + protocol: 'tap', + ) + test( + 'X11-' + testname + '__no-surrounding-text', + run_test, + args: [ '--tap', '-k', '--x11', '--env', env_file, '--no-surrounding-text', '--', filename], + env: [ + 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), + 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), + ], + depends: [test_exe], + priority: -12, + is_parallel: false, + timeout: 120, + protocol: 'tap', + ) + test( + 'Wayland-' + testname + '__surrounding-text', + run_test, + args: [ '--tap', '-k', '--wayland', '--env', env_file, '--surrounding-text', '--', filename], + env: [ + 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), + 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), + ], + depends: [test_exe], + priority: -21, + is_parallel: false, + timeout: 120, + protocol: 'tap', + ) + test( + 'Wayland-' + testname + '__no-surrounding-text', + run_test, + args: [ '--tap', '-k', '--wayland', '--env', env_file, '--no-surrounding-text', '--', filename], + env: [ + 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), + 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), + ], + depends: [test_exe], + priority: -22, + is_parallel: false, + timeout: 120, + protocol: 'tap', + ) +endforeach diff --git a/linux/ibus-keyman/tests/scripts/find-tests.sh b/linux/ibus-keyman/tests/scripts/find-tests.sh new file mode 100755 index 0000000000..e5a144225f --- /dev/null +++ b/linux/ibus-keyman/tests/scripts/find-tests.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +cd "$1" || exit +while IFS= read -r -d '' file; do + testname=$(basename "$file" .kmx) + printf "$(basename "$file")\t${testname#k_}\n" +done < <(find . -name \*.kmx -print0 | sort -z) diff --git a/linux/ibus-keyman/tests/scripts/run-single-test.sh b/linux/ibus-keyman/tests/scripts/run-single-test.sh new file mode 100755 index 0000000000..c265c27ccd --- /dev/null +++ b/linux/ibus-keyman/tests/scripts/run-single-test.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +TESTDIR=${XDG_DATA_HOME:-$HOME/.local/share}/keyman/test_kmx + +. "$(dirname "$0")"/test-helper.sh + +if [ -v KEYMAN_PKG_BUILD ]; then + # During package builds we skip these tests that require to start ibus because + # ibus requires to find /var/lib/dbus/machine-id or /etc/machine-id, otherwise it fails with: + # "Bail out! IBUS-FATAL-WARNING: Unable to load /var/lib/dbus/machine-id: Failed to open file + # “/var/lib/dbus/machine-id”: No such file or directory" + echo "1..1" + echo "ok 1 - Integration tests # SKIP on package build" + exit 0 +fi + +if ! which Xvfb > /dev/null || ! which Xephyr > /dev/null || ! which metacity > /dev/null || ! which mutter > /dev/null; then + echo "Please install Xvfb, Xephyr, metacity and mutter before running these tests!" + exit 1 +fi + +function help() { + echo "Usage:" + echo " $0 [--env ] [-k] [--tap] [--surrounding-text] [--no-surrounding-text] [--wayland|--x11] [--] TEST" + echo + echo "Arguments:" + echo " --help, -h, -? Display this help" + echo " --verbose, -v Run tests verbosely" + echo " --debug debug test logging output" + echo " -k passed to GLib testing framework" + echo " --tap output in TAP format. Passed to GLib testing framework" + echo " --surrounding-text run tests with surrounding texts enabled" + echo " --no-surrounding-text run tests without support for surrounding text" + echo " --wayland run tests with Wayland" + echo " --x11 run tests with X11" + echo " --env Name of the file containing environment variables to use" + exit 0 +} + +function run_tests() { + echo "# NOTE: When the tests fail check /tmp/ibus-engine-keyman.log and /tmp/ibus-daemon.log!" + echo "" + + echo "# Starting tests..." + # Note: -k and --tap are consumed by the GLib testing framework + # shellcheck disable=SC2086 + "${G_TEST_BUILDDIR:-.}"/ibus-keyman-tests ${ARG_K-} ${ARG_TAP-} \ + ${ARG_VERBOSE-} ${ARG_DEBUG-} ${ARG_SURROUNDING_TEXT-} ${ARG_NO_SURROUNDING_TEXT-} \ + --directory "$TESTDIR" ${ARG_DISPLAY_SERVER} "$TESTFILE" + echo "# Finished tests." +} + +while (( $# )); do + case $1 in + --help|-h|-\?) help ;; + -k) ARG_K=$1 ;; + --tap) ARG_TAP=$1 ;; + --surrounding-text) ARG_SURROUNDING_TEXT=$1 ;; + --no-surrounding-text) ARG_NO_SURROUNDING_TEXT=$1 ;; + --wayland) ARG_DISPLAY_SERVER=$1 ;; + --x11) ARG_DISPLAY_SERVER=$1 ;; + --verbose|-v) ARG_VERBOSE=--verbose;; + --debug) ARG_DEBUG=--debug-log;; + --env) shift ; ARG_ENV=$1 ;; + --) shift ; TESTFILE=$1; break ;; + *) echo "Error: Unexpected argument \"$1\". Exiting." ; exit 4 ;; + esac + shift || (echo "Error: The last argument is missing a value. Exiting."; false) || exit 5 +done + +# shellcheck source=/dev/null +. "$ARG_ENV" + +run_tests diff --git a/linux/ibus-keyman/tests/scripts/run-tests.sh b/linux/ibus-keyman/tests/scripts/run-tests.sh new file mode 100755 index 0000000000..b80dd1a5f4 --- /dev/null +++ b/linux/ibus-keyman/tests/scripts/run-tests.sh @@ -0,0 +1,206 @@ +#!/usr/bin/env bash + +TOP_SRCDIR=${top_srcdir:-$(realpath "$(dirname "$0")/..")} +TESTDIR=${XDG_DATA_HOME:-$HOME/.local/share}/keyman/test_kmx + +. "$(dirname "$0")"/test-helper.sh + +if [ -v KEYMAN_PKG_BUILD ]; then + # During package builds we skip these tests that require to start ibus because + # ibus requires to find /var/lib/dbus/machine-id or /etc/machine-id, otherwise it fails with: + # "Bail out! IBUS-FATAL-WARNING: Unable to load /var/lib/dbus/machine-id: Failed to open file + # “/var/lib/dbus/machine-id”: No such file or directory" + echo "1..1" + echo "ok 1 - Integration tests # SKIP on package build" + exit 0 +fi + +if ! which Xvfb > /dev/null || ! which Xephyr > /dev/null || ! which metacity > /dev/null || ! which mutter > /dev/null; then + echo "Please install Xvfb, Xephyr, metacity and mutter before running these tests!" + exit 1 +fi + +function cleanup() { + if [ -f "$PID_FILE" ]; then + echo + echo "# Shutting down processes..." + bash "$PID_FILE" > /dev/null 2>&1 + rm "$PID_FILE" + echo "# Finished shutdown of processes." + fi +} + +function help() { + echo "Usage:" + echo " $0 [-k] [--tap] [--surrounding-text] [--no-surrounding-text] [--no-wayland] [--no-x11] [[--] TEST...]" + echo + echo "Arguments:" + echo " --help, -h, -? Display this help" + echo " --verbose, -v Run tests verbosely" + echo " --debug debug test logging output" + echo " -k passed to GLib testing framework" + echo " --tap output in TAP format. Passed to GLib testing framework" + echo " --surrounding-text run tests with surrounding texts enabled" + echo " --no-surrounding-text run tests without support for surrounding text" + echo " --no-wayland don't run tests with Wayland" + echo " --no-x11 don't run tests with X11" + echo + echo "If no TESTs are specified then all tests are run." + echo "If neither --surrounding-text nor --no-surrounding-text are specified then the tests run with both settings." + exit 0 +} + +function run_tests() { + DISPLAY_SERVER=$1 + shift + + echo > "$PID_FILE" + TEMP_DATA_DIR=$(mktemp --directory) + echo "rm -rf ${TEMP_DATA_DIR}" >> "$PID_FILE" + + COMMON_ARCH_DIR= + [ -d "${TOP_SRCDIR}"/../../core/build/arch ] && COMMON_ARCH_DIR=${TOP_SRCDIR}/../../core/build/arch + [ -d "${TOP_SRCDIR}"/../keyboardprocessor/arch ] && COMMON_ARCH_DIR=${TOP_SRCDIR}/../keyboardprocessor/arch + + if [ -d "${COMMON_ARCH_DIR}"/release ]; then + COMMON_ARCH_DIR=${COMMON_ARCH_DIR}/release + elif [ -d "${COMMON_ARCH_DIR}"/debug ]; then + COMMON_ARCH_DIR=${COMMON_ARCH_DIR}/debug + else + echo "Can't find neither ${COMMON_ARCH_DIR}/release nor ${COMMON_ARCH_DIR}/debug" + exit 2 + fi + + if [ ! -d "$TESTDIR" ] || ! [[ $(find "${TESTDIR}/" -name \*.kmx 2>/dev/null | wc -l) -gt 0 ]]; then + if [[ $(find "${COMMON_ARCH_DIR}/tests/unit/kmx/" -name \*.kmx 2>/dev/null | wc -l) -gt 0 ]]; then + mkdir -p "$(realpath --canonicalize-missing "$TESTDIR"/..)" + ln -sf "$(realpath "${COMMON_ARCH_DIR}"/tests/unit/kmx)" "$TESTDIR" + else + echo "Can't find kmx files in ${COMMON_ARCH_DIR}/tests/unit/kmx" + exit 3 + fi + fi + + echo "# NOTE: When the tests fail check /tmp/ibus-engine-keyman.log and /tmp/ibus-daemon.log!" + echo "" + + if [ "$DISPLAY_SERVER" == "wayland" ]; then + if ! can_run_wayland; then + # support for --headless got added in mutter 40.x + echo "ERROR: mutter doesn't support running headless. Can't run Wayland tests." + exit 7 + fi + echo "# Running on Wayland..." + TMPFILE=$(mktemp) + # mutter-Message: 18:56:15.422: Using Wayland display name 'wayland-1' + mutter --wayland --headless --no-x11 --virtual-monitor 1024x768 &> "$TMPFILE" & + echo "kill -9 $!" >> "$PID_FILE" + sleep 1s + export WAYLAND_DISPLAY + WAYLAND_DISPLAY=$(cat "$TMPFILE" | grep "Using Wayland display" | cut -d"'" -f2) + rm "$TMPFILE" + else + echo "# Starting Xvfb..." + Xvfb -screen 0 1024x768x24 :33 &> /dev/null & + echo "kill -9 $!" >> "$PID_FILE" + sleep 1 + echo "# Starting Xephyr..." + DISPLAY=:33 Xephyr :32 -screen 1024x768 &> /dev/null & + echo "kill -9 $!" >> "$PID_FILE" + sleep 1 + echo "# Starting metacity" + metacity --display=:32 &> /dev/null & + echo "kill -9 $!" >> "$PID_FILE" + + export DISPLAY=:32 + fi + + # Install schema to temporary directory. This removes the build dependency on the keyman package. + SCHEMA_DIR=$TEMP_DATA_DIR/glib-2.0/schemas + export XDG_DATA_DIRS=$TEMP_DATA_DIR:$XDG_DATA_DIRS + + mkdir -p "$SCHEMA_DIR" + cp "${TOP_SRCDIR}"/../keyman-config/com.keyman.gschema.xml "$SCHEMA_DIR"/ + glib-compile-schemas "$SCHEMA_DIR" + + if [ $# -gt 0 ]; then + TESTFILES=($@) + else + pushd "$TESTDIR" > /dev/null || exit + TESTFILES=(*.kmx) + popd > /dev/null || exit + fi + + export LD_LIBRARY_PATH=${COMMON_ARCH_DIR}/src:$LD_LIBRARY_PATH + + # Ubuntu 18.04 Bionic doesn't have ibus-memconf, and glib is not compiled with the keyfile + # backend enabled, so we just use the default backend. Otherwise we use the keyfile + # store which interferes less when running on a dev machine. + if [ -f /usr/libexec/ibus-memconf ]; then + export GSETTINGS_BACKEND=keyfile + IBUS_CONFIG=--config=/usr/libexec/ibus-memconf + fi + + ibus-daemon "${ARG_VERBOSE-}" --panel=disable ${IBUS_CONFIG-} &> /tmp/ibus-daemon.log & + echo "kill -9 $!" >> "$PID_FILE" + sleep 1s + + ../src/ibus-engine-keyman "${ARG_VERBOSE-}" &> /tmp/ibus-engine-keyman.log & + echo "kill -9 $!" >> "$PID_FILE" + sleep 1s + + echo "# Starting tests..." + # Note: -k and --tap are consumed by the GLib testing framework + "${G_TEST_BUILDDIR:-.}"/ibus-keyman-tests "${ARG_K-}" "${ARG_TAP-}" \ + "${ARG_VERBOSE-}" "${ARG_DEBUG-}" "${ARG_SURROUNDING_TEXT-}" "${ARG_NO_SURROUNDING_TEXT-}" \ + --directory "$TESTDIR" --"${DISPLAY_SERVER}" "${TESTFILES[@]}" + echo "# Finished tests." + + cleanup +} + +USE_WAYLAND=1 +USE_X11=1 + +while (( $# )); do + case $1 in + --help|-h|-\?) help ;; + -k) ARG_K=$1 ;; + --tap) ARG_TAP=$1 ;; + --surrounding-text) ARG_SURROUNDING_TEXT=$1 ;; + --no-surrounding-text) ARG_NO_SURROUNDING_TEXT=$1 ;; + --no-wayland) USE_WAYLAND=0;; + --no-x11) USE_X11=0;; + --verbose|-v) ARG_VERBOSE=--verbose;; + --debug) ARG_DEBUG=--debug-log;; + --) shift && break ;; + *) echo "Error: Unexpected argument \"$1\". Exiting." ; exit 4 ;; + esac + shift || (echo "Error: The last argument is missing a value. Exiting."; false) || exit 5 +done + +if ! can_run_wayland; then + # support for --headless got added in mutter 40.x + echo "# WARNING: mutter doesn't support running headless. Skipping Wayland tests." + USE_WAYLAND=0 + if [ "$USE_X11" == "0" ]; then + echo "ERROR: no tests to run. Can't run Wayland tests, and --no-x11 is specified." + exit 8 + fi +fi + +if [ "$USE_WAYLAND" == "0" ] && [ "$USE_X11" == "0" ]; then + echo "ERROR: I'll have to run somewhere. Specifying both --no-wayland and --no-x11 is not allowed." + exit 6 +fi + +echo > "$PID_FILE" +trap cleanup EXIT SIGINT + +if [ "$USE_WAYLAND" == "1" ]; then + run_tests wayland "$@" +fi + +if [ "$USE_X11" == "1" ]; then + run_tests x11 "$@" +fi diff --git a/linux/ibus-keyman/tests/scripts/setup-tests.sh b/linux/ibus-keyman/tests/scripts/setup-tests.sh new file mode 100755 index 0000000000..e48d36eba9 --- /dev/null +++ b/linux/ibus-keyman/tests/scripts/setup-tests.sh @@ -0,0 +1,111 @@ +#!/usr/bin/env bash +DISPLAY_SERVER=$1 +ENV_FILE=$2 +PID_FILE=$3 + +TOP_SRCDIR=${G_TEST_SRCDIR:-$(realpath "$(dirname "$0")/..")}/.. +TOP_BINDIR=${G_TEST_BUILDDIR:-$(realpath "$(dirname "$0/..")")}/.. +TESTDIR=${XDG_DATA_HOME:-$HOME/.local/share}/keyman/test_kmx + +. "$(dirname "$0")/"/test-helper.sh + +echo > "$ENV_FILE" + +if [ -f "$PID_FILE" ]; then + # kill previous instances + "$(dirname "$0")"/teardown-tests.sh "$PID_FILE" +fi + +echo > "$PID_FILE" +TEMP_DATA_DIR=$(mktemp --directory) +echo "rm -rf ${TEMP_DATA_DIR}" >> "$PID_FILE" + +COMMON_ARCH_DIR= +[ -d "${TOP_SRCDIR}"/../../core/build/arch ] && COMMON_ARCH_DIR=${TOP_SRCDIR}/../../core/build/arch +[ -d "${TOP_SRCDIR}"/../keyboardprocessor/arch ] && COMMON_ARCH_DIR=${TOP_SRCDIR}/../keyboardprocessor/arch + +if [ -d "${COMMON_ARCH_DIR}"/release ]; then + COMMON_ARCH_DIR=${COMMON_ARCH_DIR}/release +elif [ -d "${COMMON_ARCH_DIR}"/debug ]; then + COMMON_ARCH_DIR=${COMMON_ARCH_DIR}/debug +else + echo "Can't find neither ${COMMON_ARCH_DIR}/release nor ${COMMON_ARCH_DIR}/debug" + exit 2 +fi + +if [ ! -d "$TESTDIR" ] || ! [[ $(find "${TESTDIR}/" -name \*.kmx 2>/dev/null | wc -l) -gt 0 ]]; then + if [[ $(find "${COMMON_ARCH_DIR}/tests/unit/kmx/" -name \*.kmx 2>/dev/null | wc -l) -gt 0 ]]; then + mkdir -p "$(realpath --canonicalize-missing "$TESTDIR"/..)" + ln -sf "$(realpath "${COMMON_ARCH_DIR}"/tests/unit/kmx)" "$TESTDIR" + else + echo "Can't find kmx files in ${COMMON_ARCH_DIR}/tests/unit/kmx" + exit 3 + fi +fi + +if [ "$DISPLAY_SERVER" == "wayland" ]; then + if ! can_run_wayland; then + # support for --headless got added in mutter 40.x + echo "ERROR: mutter doesn't support running headless. Can't run Wayland tests." + exit 7 + fi + echo "Running on Wayland..." + TMPFILE=$(mktemp) + # mutter-Message: 18:56:15.422: Using Wayland display name 'wayland-1' + mutter --wayland --headless --no-x11 --virtual-monitor 1024x768 &> "$TMPFILE" & + echo "kill -9 $!" >> "$PID_FILE" + sleep 1s + export WAYLAND_DISPLAY + WAYLAND_DISPLAY=$(grep "Using Wayland display" "$TMPFILE" | cut -d"'" -f2) + rm "$TMPFILE" + echo "export WAYLAND_DISPLAY=\"$WAYLAND_DISPLAY\"" >> "$ENV_FILE" +else + echo "Starting Xvfb..." + Xvfb -screen 0 1024x768x24 :33 &> /dev/null & + echo "kill -9 $!" >> "$PID_FILE" + sleep 1 + echo "Starting Xephyr..." + DISPLAY=:33 Xephyr :32 -screen 1024x768 &> /dev/null & + echo "kill -9 $!" >> "$PID_FILE" + sleep 1 + echo "Starting metacity" + metacity --display=:32 &> /dev/null & + echo "kill -9 $!" >> "$PID_FILE" + + export DISPLAY=:32 + echo "export DISPLAY=\"$DISPLAY\"" >> "$ENV_FILE" +fi + + # Install schema to temporary directory. This removes the build dependency on the keyman package. + SCHEMA_DIR=$TEMP_DATA_DIR/glib-2.0/schemas + export XDG_DATA_DIRS=$TEMP_DATA_DIR:$XDG_DATA_DIRS + echo "export XDG_DATA_DIRS=\"$XDG_DATA_DIRS\"" >> "$ENV_FILE" + + mkdir -p "$SCHEMA_DIR" + cp "${TOP_SRCDIR}"/../keyman-config/com.keyman.gschema.xml "$SCHEMA_DIR"/ + glib-compile-schemas "$SCHEMA_DIR" + + export LD_LIBRARY_PATH=${COMMON_ARCH_DIR}/src:$LD_LIBRARY_PATH + echo "export LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"" >> "$ENV_FILE" + + # Ubuntu 18.04 Bionic doesn't have ibus-memconf, and glib is not compiled with the keyfile + # backend enabled, so we just use the default backend. Otherwise we use the keyfile + # store which interferes less when running on a dev machine. + if [ -f /usr/libexec/ibus-memconf ]; then + export GSETTINGS_BACKEND=keyfile + echo "export GSETTINGS_BACKEND=\"$GSETTINGS_BACKEND\"" >> "$ENV_FILE" + IBUS_CONFIG=--config=/usr/libexec/ibus-memconf + fi + + ibus-daemon "${ARG_VERBOSE-}" --daemonize --panel=disable ${IBUS_CONFIG-} &> /tmp/ibus-daemon.log + echo "kill -9 $!" >> "$PID_FILE" + sleep 1s + + IBUS_ADDRESS=$(ibus address) + export IBUS_ADDRESS + + echo "export IBUS_ADDRESS=\"$IBUS_ADDRESS\"" >> "$ENV_FILE" + + "${TOP_BINDIR}"/src/ibus-engine-keyman "${ARG_VERBOSE-}" &> /tmp/ibus-engine-keyman.log & + echo "kill -9 $!" >> "$PID_FILE" + sleep 1s diff --git a/linux/ibus-keyman/tests/scripts/teardown-tests.sh b/linux/ibus-keyman/tests/scripts/teardown-tests.sh new file mode 100755 index 0000000000..489769d721 --- /dev/null +++ b/linux/ibus-keyman/tests/scripts/teardown-tests.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +PID_FILE=$1 + +echo "Shutting down processes..." +bash "$PID_FILE" > /dev/null 2>&1 +rm "$PID_FILE" +echo "Finished shutdown of processes." diff --git a/linux/ibus-keyman/tests/scripts/test-helper.sh b/linux/ibus-keyman/tests/scripts/test-helper.sh new file mode 100644 index 0000000000..92c8a7e528 --- /dev/null +++ b/linux/ibus-keyman/tests/scripts/test-helper.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +function can_run_wayland() { + local MUTTER_VERSION + MUTTER_VERSION=$(mutter --version | head -1 | cut -f2 -d' ' | cut -f1 -d'.') + if (( MUTTER_VERSION < 40 )); then + return 1 + else + return 0 + fi +} From c176ebc6af339c04baef33f78b99d97fc6191898 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Tue, 31 Jan 2023 11:59:03 +0100 Subject: [PATCH 02/11] chore(linux): Address code review comments --- core/src/meson.build | 19 +++++++---- core/tests/meson.build | 2 +- core/tests/unit/kmx/meson.build | 16 +++++++-- linux/ibus-keyman/meson.build | 47 ++++++-------------------- linux/ibus-keyman/src/meson.build | 8 ++--- linux/ibus-keyman/src/test/meson.build | 4 +-- linux/ibus-keyman/tests/meson.build | 33 ++++++++++-------- 7 files changed, 61 insertions(+), 68 deletions(-) diff --git a/core/src/meson.build b/core/src/meson.build index 254eefcad6..a2cf734b73 100644 --- a/core/src/meson.build +++ b/core/src/meson.build @@ -58,7 +58,7 @@ if compiler.get_id() == 'emscripten' links = [] endif -kmxfiles = files( +kmx_files = files( 'kmx/kmx_consts.cpp', 'kmx/kmx_processevent.cpp', 'kmx/kmx_actions.cpp', @@ -75,7 +75,7 @@ kmxfiles = files( 'kmx/kmx_xstring.cpp', ) -apifiles = files( +api_files = files( 'km_kbp_context_api.cpp', 'km_kbp_keyboard_api.cpp', 'km_kbp_options_api.cpp', @@ -84,7 +84,7 @@ apifiles = files( 'km_kbp_processevent_api.cpp', ) -corefiles = files( +core_files = files( 'option.cpp', 'keyboard.cpp', 'state.cpp', @@ -92,16 +92,21 @@ corefiles = files( 'utfcodec.cpp', ) -lib = library('kmnkbp0', - apifiles, - corefiles, - kmxfiles, +mock_files = files( 'mock/mock_processor.cpp', +) + +lib = both_libraries('kmnkbp0', + api_files, + core_files, + kmx_files, + mock_files, version_res, cpp_args: defns + warns + flags, link_args: links, version: lib_version, include_directories: inc, + pic: true, install: true) headerdirs = [ '.', 'keyman' ] # subdirectories of ${prefix}/include to add to header path diff --git a/core/tests/meson.build b/core/tests/meson.build index 3b33c1ef23..be58e6975c 100644 --- a/core/tests/meson.build +++ b/core/tests/meson.build @@ -8,7 +8,7 @@ # Note: this version of cmpfiles ignores line endings, which is better for platform independence cmpfiles = ['-c', 'import sys; a = open(sys.argv[1], \'r\').read(); b = open(sys.argv[2], \'r\').read(); exit(not (a==b))'] -stnds = join_paths(meson.source_root(), 'tests', 'standards') +stnds = join_paths(meson.current_source_dir(), 'standards') libsrc = include_directories(join_paths('../', 'src')) diff --git a/core/tests/unit/kmx/meson.build b/core/tests/unit/kmx/meson.build index 014983a9af..c347b2e8fd 100644 --- a/core/tests/unit/kmx/meson.build +++ b/core/tests/unit/kmx/meson.build @@ -25,18 +25,28 @@ else test_path = meson.current_build_dir() endif -coretestfiles = files( +coretest_files = files( 'kmx_test_source.cpp', ) kmx = executable('kmx', 'kmx.cpp', - coretestfiles, + coretest_files, cpp_args: defns + warns, include_directories: [inc, libsrc], link_args: links + tests_flags, objects: lib.extract_all_objects()) +test_lib = static_library('kmnkbp-tests', + coretest_files, + cpp_args: defns + warns + flags, + include_directories: [inc, libsrc], + link_args: links + tests_flags, + objects: lib.extract_all_objects(), + pic: true, + install: false +) + tests = [ '000 - null keyboard', '001 - basic input UnicodeI', @@ -91,7 +101,7 @@ tests = [ ] if build_machine.system() == 'windows' - kmcomp = find_program(join_paths(meson.source_root(),'..','..','..','windows','bin','developer','kmcomp.exe'), 'kmcomp.exe', required: false) + kmcomp = find_program(join_paths(meson.current_source_dir(),'..','..','..','..','windows','bin','developer','kmcomp.exe'), 'kmcomp.exe', required: false) kmcomp_cmd = [kmcomp] copy_cmd = [find_program('cmd.exe', required: true), '/c', 'copy'] cat_cmd = [find_program('cmd.exe', required: true), '/c', 'type'] diff --git a/linux/ibus-keyman/meson.build b/linux/ibus-keyman/meson.build index fa807e8842..5b4b45c890 100644 --- a/linux/ibus-keyman/meson.build +++ b/linux/ibus-keyman/meson.build @@ -13,46 +13,19 @@ ibus = dependency('ibus-1.0', version: '>= 1.2.0') gtk = dependency('gtk+-3.0', version: '>= 2.4') x11 = dependency('x11', version: '>= 1.6') json_glib = dependency('json-glib-1.0', version: '>= 1.0') -kmnkbp = dependency('keyman_kmn_processor', version: '>= 0.0.0') + +kmnkbp_lib = cc.find_library( + 'libkmnkbp0', + dirs: [ + '@0@/../../core/build/arch/debug/src'.format(meson.current_source_dir()), + '@0@/../../core/build/arch/release/src'.format(meson.current_source_dir()) + ] +) env = find_program('env') -# define some variables. We wouldn't need this if we'd have a meson.build file -# in the Keyman root directory... -coredir = '@0@/../../core'.format(meson.current_source_dir()) - -kmxfiles = files( - join_paths(coredir, 'src/kmx/kmx_consts.cpp'), - join_paths(coredir, 'src/kmx/kmx_processevent.cpp'), - join_paths(coredir, 'src/kmx/kmx_actions.cpp'), - join_paths(coredir, 'src/kmx/kmx_capslock.cpp'), - join_paths(coredir, 'src/kmx/kmx_context.cpp'), - join_paths(coredir, 'src/kmx/kmx_conversion.cpp'), - join_paths(coredir, 'src/kmx/kmx_debug.cpp'), - join_paths(coredir, 'src/kmx/kmx_debugger.cpp'), - join_paths(coredir, 'src/kmx/kmx_environment.cpp'), - join_paths(coredir, 'src/kmx/kmx_file.cpp'), - join_paths(coredir, 'src/kmx/kmx_modifiers.cpp'), - join_paths(coredir, 'src/kmx/kmx_options.cpp'), - join_paths(coredir, 'src/kmx/kmx_processor.cpp'), - join_paths(coredir, 'src/kmx/kmx_xstring.cpp'), -) -corefiles = files( - join_paths(coredir, 'src/option.cpp'), - join_paths(coredir, 'src/keyboard.cpp'), - join_paths(coredir, 'src/state.cpp'), - join_paths(coredir, 'src/jsonpp.cpp'), - join_paths(coredir, 'src/utfcodec.cpp'), -) -coretestfiles = files( - join_paths(coredir, 'tests/unit/kmx/kmx_test_source.cpp'), -) - -# Check if we have patched ibus -code = '''#include -int x = IBUS_PREFILTER_MASK | IBUS_CAP_PREFILTER; -''' -if cc.compiles(code, dependencies: [ibus], name: 'check for patched ibus') +# Check if we have patched ibus (https://github.com/ibus/ibus/pull/2440) +if cc.has_header_symbol('ibus.h', 'IBUS_CAP_PREFILTER', dependencies: [ibus], required: false) conf.set('IBUS_HAS_PREFILTER', 1) endif diff --git a/linux/ibus-keyman/src/meson.build b/linux/ibus-keyman/src/meson.build index 63ab8ded94..45c0e29dd9 100644 --- a/linux/ibus-keyman/src/meson.build +++ b/linux/ibus-keyman/src/meson.build @@ -1,11 +1,11 @@ -utilfiles = files( +util_files = files( 'keymanutil.c', 'keymanutil.h', 'kmpdetails.c', 'kmpdetails.h', ) -engine_sources = files( +engine_files = files( 'main.c', 'engine.c', 'engine.h', @@ -14,7 +14,7 @@ engine_sources = files( 'keyman-service.h', ) -deps = [ibus, gtk, x11, json_glib, kmnkbp] +deps = [ibus, gtk, x11, json_glib, kmnkbp_lib] prefix = get_option('prefix') cfg = configuration_data() @@ -35,7 +35,7 @@ configure_file( exe = executable( 'ibus-engine-keyman', - sources: [engine_sources, utilfiles], + sources: [engine_files, util_files], dependencies: deps, include_directories: include_directories('@0@/..'.format(meson.current_build_dir())), ) diff --git a/linux/ibus-keyman/src/test/meson.build b/linux/ibus-keyman/src/test/meson.build index 57302d2dcf..65fb60cabb 100644 --- a/linux/ibus-keyman/src/test/meson.build +++ b/linux/ibus-keyman/src/test/meson.build @@ -1,9 +1,9 @@ keymanutil_sources = [ 'keymanutil_tests.c', - utilfiles, + util_files, ] -keymanutil_deps = [ibus, gtk, x11, json_glib, kmnkbp] +keymanutil_deps = [ibus, gtk, x11, json_glib, kmnkbp_lib] include_dirs = [ include_directories('@0@/..'.format(meson.current_build_dir())), diff --git a/linux/ibus-keyman/tests/meson.build b/linux/ibus-keyman/tests/meson.build index 494196cc35..1283b84cc9 100644 --- a/linux/ibus-keyman/tests/meson.build +++ b/linux/ibus-keyman/tests/meson.build @@ -1,16 +1,20 @@ -sources = [ +test_files = [ 'ibusimcontext.c', 'ibusimcontext.h', 'testfixture.cpp', 'testmodule.c', 'testmodule.h', - kmxfiles, - corefiles, - utilfiles, - coretestfiles, ] -deps = [ibus, gtk, x11, json_glib, kmnkbp] +kmnkbp_tests_lib = cc.find_library( + 'libkmnkbp-tests', + dirs: [ + '@0@/../../../core/build/arch/debug/tests/unit/kmx'.format(meson.current_source_dir()), + '@0@/../../../core/build/arch/release/tests/unit/kmx'.format(meson.current_source_dir()) + ] +) + +deps = [ibus, gtk, x11, json_glib, kmnkbp_lib, kmnkbp_tests_lib] include_dirs = [ include_directories('../../../core/src'), @@ -23,9 +27,9 @@ include_dirs = [ test_exe = executable( 'ibus-keyman-tests', - sources: sources, + test_files, util_files, dependencies: deps, - include_directories: include_dirs + include_directories: include_dirs, ) env_file = '/tmp/env.txt' @@ -81,22 +85,23 @@ test( ) kmx_dir = join_paths(meson.current_source_dir(), '../../../core/build/arch/debug/tests/unit/kmx') -kmx_files = run_command( +kmxtest_files = run_command( find_tests, kmx_dir, check: true, ).stdout().split('\n') -foreach kmx: kmx_files +foreach kmx: kmxtest_files filename = kmx.split('\t') if filename[0] == '' continue endif testname = filename[1].split('.kmx')[0] + test_args = [ '--tap', '-k', '--env', env_file, '--', filename] test( 'X11-' + testname + '__surrounding-text', run_test, - args: [ '--tap', '-k', '--x11', '--env', env_file, '--surrounding-text', '--', filename], + args: [ '--x11', '--surrounding-text', test_args], env: [ 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), @@ -110,7 +115,7 @@ foreach kmx: kmx_files test( 'X11-' + testname + '__no-surrounding-text', run_test, - args: [ '--tap', '-k', '--x11', '--env', env_file, '--no-surrounding-text', '--', filename], + args: [ '--x11', '--no-surrounding-text', test_args], env: [ 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), @@ -124,7 +129,7 @@ foreach kmx: kmx_files test( 'Wayland-' + testname + '__surrounding-text', run_test, - args: [ '--tap', '-k', '--wayland', '--env', env_file, '--surrounding-text', '--', filename], + args: [ '--wayland', '--surrounding-text', test_args], env: [ 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), @@ -138,7 +143,7 @@ foreach kmx: kmx_files test( 'Wayland-' + testname + '__no-surrounding-text', run_test, - args: [ '--tap', '-k', '--wayland', '--env', env_file, '--no-surrounding-text', '--', filename], + args: [ '--wayland', '--no-surrounding-text', test_args], env: [ 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), From d39ba178fa33f72390c3ac51dfbc903d71838de4 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Tue, 31 Jan 2023 19:14:50 +0100 Subject: [PATCH 03/11] chore(linux): Fix wasm build emscripten doesn't support static libraries, so we explicitly build a static library unless we're building for wasm. --- core/src/meson.build | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/core/src/meson.build b/core/src/meson.build index a2cf734b73..4bd27dbb76 100644 --- a/core/src/meson.build +++ b/core/src/meson.build @@ -51,11 +51,14 @@ if compiler.get_id() == 'msvc' version_res += import('windows').compile_resources('version.rc', args:['/n','/c65001']) endif +build_static_lib = true + if compiler.get_id() == 'emscripten' warns = [] flags = [] defns = ['-DKMN_KBP'] links = [] + build_static_lib = disabler() endif kmx_files = files( @@ -96,7 +99,7 @@ mock_files = files( 'mock/mock_processor.cpp', ) -lib = both_libraries('kmnkbp0', +lib = library('kmnkbp0', api_files, core_files, kmx_files, @@ -109,6 +112,21 @@ lib = both_libraries('kmnkbp0', pic: true, install: true) +if build_static_lib + static_library('kmnkbp0-static', + api_files, + core_files, + kmx_files, + mock_files, + version_res, + cpp_args: defns + warns + flags, + link_args: links, + include_directories: inc, + pic: true, + install: false + ) +endif + headerdirs = [ '.', 'keyman' ] # subdirectories of ${prefix}/include to add to header path kmnkbp = declare_dependency(link_with: lib, include_directories: inc) From 1c602b8e6b69b9c5cd5e868adfc9066d333af495 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Wed, 1 Feb 2023 08:38:33 +0100 Subject: [PATCH 04/11] chore(linux): Build static library only on Linux The static library is currently only needed for the ibus-keyman tests, so we only build it on Linux. It can't build with emscripten, and on Windows it'd need some additional work. --- core/src/meson.build | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/src/meson.build b/core/src/meson.build index 4bd27dbb76..79f06a9706 100644 --- a/core/src/meson.build +++ b/core/src/meson.build @@ -51,14 +51,11 @@ if compiler.get_id() == 'msvc' version_res += import('windows').compile_resources('version.rc', args:['/n','/c65001']) endif -build_static_lib = true - if compiler.get_id() == 'emscripten' warns = [] flags = [] defns = ['-DKMN_KBP'] links = [] - build_static_lib = disabler() endif kmx_files = files( @@ -112,7 +109,8 @@ lib = library('kmnkbp0', pic: true, install: true) -if build_static_lib +if host_machine.system() == 'linux' + # on Linux we need the static lib for ibus-keyman tests static_library('kmnkbp0-static', api_files, core_files, From d499bd84e4f832932bdad9cc7d3b5a396098f158 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Thu, 2 Feb 2023 10:53:26 +0100 Subject: [PATCH 05/11] chore(linux): Update debian changelog (cherry picked from commit 3baaf266fbd9e32772bd20ec5bc4ecc9c867d062) --- linux/debian/changelog | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/linux/debian/changelog b/linux/debian/changelog index 90fdff22b0..638743e61e 100644 --- a/linux/debian/changelog +++ b/linux/debian/changelog @@ -1,8 +1,13 @@ -keyman (15.0.274-2) UNRELEASED; urgency=medium +keyman (16.0.138-1) unstable; urgency=medium + [ Jelmer Vernooij ] * Include packaging path in Vcs-Git header. - -- Jelmer Vernooij Wed, 25 Jan 2023 23:46:54 +0000 + [ Eberhard Beilharz ] + * New upstream release. + * Re-release to Debian + + -- Eberhard Beilharz Thu, 02 Feb 2023 10:53:17 +0100 keyman (15.0.274-1) unstable; urgency=medium From 0367df86520693672d0f6bd1162a53d532a08b0c Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Thu, 2 Feb 2023 19:06:55 +0100 Subject: [PATCH 06/11] chore(linux): Fix a few bugs in meson scripts --- linux/ibus-keyman/meson.build | 6 ++++++ linux/ibus-keyman/src/meson.build | 8 +++++++- linux/ibus-keyman/src/test/meson.build | 11 +++++----- linux/ibus-keyman/tests/meson.build | 15 +++++++------- linux/ibus-keyman/tests/scripts/find-tests.sh | 20 ++++++++++++++----- 5 files changed, 42 insertions(+), 18 deletions(-) diff --git a/linux/ibus-keyman/meson.build b/linux/ibus-keyman/meson.build index 5b4b45c890..2771be2af7 100644 --- a/linux/ibus-keyman/meson.build +++ b/linux/ibus-keyman/meson.build @@ -33,6 +33,12 @@ conf.set('HAVE_CONFIG_H', 1) configure_file(output : 'config.h', configuration : conf) +core_include_dirs = [ + include_directories('../../core/src'), + include_directories('../../core/src/kmx'), + include_directories('../../common/include'), +] + subdir('icons') subdir('src') subdir('tests') diff --git a/linux/ibus-keyman/src/meson.build b/linux/ibus-keyman/src/meson.build index 45c0e29dd9..ac1f677b7d 100644 --- a/linux/ibus-keyman/src/meson.build +++ b/linux/ibus-keyman/src/meson.build @@ -14,6 +14,12 @@ engine_files = files( 'keyman-service.h', ) +include_dirs = [ + core_include_dirs, + include_directories('..'), + include_directories('@0@/..'.format(meson.current_build_dir())), +] + deps = [ibus, gtk, x11, json_glib, kmnkbp_lib] prefix = get_option('prefix') @@ -37,7 +43,7 @@ exe = executable( 'ibus-engine-keyman', sources: [engine_files, util_files], dependencies: deps, - include_directories: include_directories('@0@/..'.format(meson.current_build_dir())), + include_directories: include_dirs, ) subdir('test') diff --git a/linux/ibus-keyman/src/test/meson.build b/linux/ibus-keyman/src/test/meson.build index 65fb60cabb..164c158edc 100644 --- a/linux/ibus-keyman/src/test/meson.build +++ b/linux/ibus-keyman/src/test/meson.build @@ -5,16 +5,17 @@ keymanutil_sources = [ keymanutil_deps = [ibus, gtk, x11, json_glib, kmnkbp_lib] -include_dirs = [ +test_include_dirs = [ + include_dirs, + include_directories('..'), include_directories('@0@/..'.format(meson.current_build_dir())), - '..' ] executable( 'keymanutil-tests', sources: keymanutil_sources, dependencies: keymanutil_deps, - include_directories : include_dirs + include_directories : test_include_dirs ) test( @@ -36,7 +37,7 @@ test( '../kmpdetails.c' ], dependencies: [ json_glib ], - include_directories: include_dirs + include_directories: test_include_dirs ), args: [ '@0@'.format(meson.current_source_dir()) ], env: [ @@ -54,7 +55,7 @@ test( 'print_kmp.c', ], dependencies: [ json_glib ], - include_directories: include_dirs + include_directories: test_include_dirs ), args: [ join_paths('@0@'.format(meson.current_source_dir()), 'kmp.json') ], env: [ diff --git a/linux/ibus-keyman/tests/meson.build b/linux/ibus-keyman/tests/meson.build index 1283b84cc9..17cdbe78cb 100644 --- a/linux/ibus-keyman/tests/meson.build +++ b/linux/ibus-keyman/tests/meson.build @@ -16,11 +16,9 @@ kmnkbp_tests_lib = cc.find_library( deps = [ibus, gtk, x11, json_glib, kmnkbp_lib, kmnkbp_tests_lib] -include_dirs = [ - include_directories('../../../core/src'), - include_directories('../../../core/src/kmx'), +test_include_dirs = [ + core_include_dirs, include_directories('../../../core/tests/unit/kmx'), - include_directories('../../../common/include'), include_directories('../src'), include_directories('..'), ] @@ -29,7 +27,7 @@ test_exe = executable( 'ibus-keyman-tests', test_files, util_files, dependencies: deps, - include_directories: include_dirs, + include_directories: test_include_dirs, ) env_file = '/tmp/env.txt' @@ -84,10 +82,13 @@ test( protocol: 'exitcode' ) -kmx_dir = join_paths(meson.current_source_dir(), '../../../core/build/arch/debug/tests/unit/kmx') +kmx_dirs = [ + join_paths(meson.current_source_dir(), '../../../core/build/arch/debug/tests/unit/kmx'), + join_paths(meson.current_source_dir(), '../../../core/build/arch/release/tests/unit/kmx') +] kmxtest_files = run_command( find_tests, - kmx_dir, + kmx_dirs, check: true, ).stdout().split('\n') diff --git a/linux/ibus-keyman/tests/scripts/find-tests.sh b/linux/ibus-keyman/tests/scripts/find-tests.sh index e5a144225f..502cbab55f 100755 --- a/linux/ibus-keyman/tests/scripts/find-tests.sh +++ b/linux/ibus-keyman/tests/scripts/find-tests.sh @@ -1,6 +1,16 @@ #!/usr/bin/env bash -cd "$1" || exit -while IFS= read -r -d '' file; do - testname=$(basename "$file" .kmx) - printf "$(basename "$file")\t${testname#k_}\n" -done < <(find . -name \*.kmx -print0 | sort -z) +set -eu +while [ -n "$1" ]; do + if [ ! -d "$1" ]; then + shift + continue + fi + pushd "$1" > /dev/null + while IFS= read -r -d '' file; do + testname=$(basename "$file" .kmx) + #shellcheck disable=SC2059 + printf "$(basename "$file")\t${testname#k_}\n" + done < <(find . -name \*.kmx -print0 | sort -z) + popd > /dev/null + exit 0 +done From e937e1395c1eed3f726b785291e341d99d1b7c25 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Fri, 3 Feb 2023 09:46:59 +0100 Subject: [PATCH 07/11] chore(linux): Address code review comments - make use of new meson features - some refactoring --- linux/ibus-keyman/meson.build | 8 ++-- linux/ibus-keyman/src/meson.build | 4 +- linux/ibus-keyman/src/test/meson.build | 26 +++++------- linux/ibus-keyman/tests/meson.build | 58 ++++++++++---------------- 4 files changed, 38 insertions(+), 58 deletions(-) diff --git a/linux/ibus-keyman/meson.build b/linux/ibus-keyman/meson.build index 2771be2af7..689cf5a5ec 100644 --- a/linux/ibus-keyman/meson.build +++ b/linux/ibus-keyman/meson.build @@ -14,12 +14,12 @@ gtk = dependency('gtk+-3.0', version: '>= 2.4') x11 = dependency('x11', version: '>= 1.6') json_glib = dependency('json-glib-1.0', version: '>= 1.0') +core_dir = meson.current_source_dir() / '../../core' +common_dir = meson.current_source_dir() / '../../common' + kmnkbp_lib = cc.find_library( 'libkmnkbp0', - dirs: [ - '@0@/../../core/build/arch/debug/src'.format(meson.current_source_dir()), - '@0@/../../core/build/arch/release/src'.format(meson.current_source_dir()) - ] + dirs: [ core_dir / 'build/arch' / get_option('buildtype') / 'src' ] ) env = find_program('env') diff --git a/linux/ibus-keyman/src/meson.build b/linux/ibus-keyman/src/meson.build index ac1f677b7d..708c4751ea 100644 --- a/linux/ibus-keyman/src/meson.build +++ b/linux/ibus-keyman/src/meson.build @@ -17,7 +17,7 @@ engine_files = files( include_dirs = [ core_include_dirs, include_directories('..'), - include_directories('@0@/..'.format(meson.current_build_dir())), + include_directories(meson.current_build_dir() / '..'), ] deps = [ibus, gtk, x11, json_glib, kmnkbp_lib] @@ -25,7 +25,7 @@ deps = [ibus, gtk, x11, json_glib, kmnkbp_lib] prefix = get_option('prefix') cfg = configuration_data() cfg.set('VERSION', meson.project_version()) -cfg.set('libexecdir', join_paths(prefix, get_option('libexecdir'))) +cfg.set('libexecdir', prefix / get_option('libexecdir')) configure_file( configuration: cfg, diff --git a/linux/ibus-keyman/src/test/meson.build b/linux/ibus-keyman/src/test/meson.build index 164c158edc..c652d8f783 100644 --- a/linux/ibus-keyman/src/test/meson.build +++ b/linux/ibus-keyman/src/test/meson.build @@ -5,10 +5,15 @@ keymanutil_sources = [ keymanutil_deps = [ibus, gtk, x11, json_glib, kmnkbp_lib] +test_env = [ + 'G_TEST_SRCDIR=' + meson.current_source_dir(), + 'G_TEST_BUILDDIR=' + meson.current_build_dir(), +] + test_include_dirs = [ include_dirs, include_directories('..'), - include_directories('@0@/..'.format(meson.current_build_dir())), + include_directories(meson.current_build_dir() / '..'), ] executable( @@ -21,10 +26,7 @@ executable( test( 'keymanutil-tests', find_program('run-tests.sh'), - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], + env: test_env, protocol: 'tap', ) @@ -39,11 +41,8 @@ test( dependencies: [ json_glib ], include_directories: test_include_dirs ), - args: [ '@0@'.format(meson.current_source_dir()) ], - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], + args: [ meson.current_source_dir() ], + env: test_env, protocol: 'exitcode', ) @@ -57,10 +56,7 @@ test( dependencies: [ json_glib ], include_directories: test_include_dirs ), - args: [ join_paths('@0@'.format(meson.current_source_dir()), 'kmp.json') ], - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], + args: [ meson.current_source_dir() / 'kmp.json' ], + env: test_env, protocol: 'exitcode', ) diff --git a/linux/ibus-keyman/tests/meson.build b/linux/ibus-keyman/tests/meson.build index 17cdbe78cb..1e5db19573 100644 --- a/linux/ibus-keyman/tests/meson.build +++ b/linux/ibus-keyman/tests/meson.build @@ -6,16 +6,22 @@ test_files = [ 'testmodule.h', ] +kmx_dir = [ + core_dir / 'build/arch' / get_option('buildtype') / 'tests/unit/kmx' +] + kmnkbp_tests_lib = cc.find_library( 'libkmnkbp-tests', - dirs: [ - '@0@/../../../core/build/arch/debug/tests/unit/kmx'.format(meson.current_source_dir()), - '@0@/../../../core/build/arch/release/tests/unit/kmx'.format(meson.current_source_dir()) - ] + dirs: kmx_dir ) deps = [ibus, gtk, x11, json_glib, kmnkbp_lib, kmnkbp_tests_lib] +test_env = [ + 'G_TEST_SRCDIR=' + meson.current_source_dir(), + 'G_TEST_BUILDDIR=' + meson.current_build_dir(), +] + test_include_dirs = [ core_include_dirs, include_directories('../../../core/tests/unit/kmx'), @@ -33,19 +39,16 @@ test_exe = executable( env_file = '/tmp/env.txt' pid_file = '/tmp/ibus-keyman-test-pids' -setup_tests = find_program('setup-tests.sh', dirs: [join_paths(meson.current_source_dir(), 'scripts')]) -teardown_tests = find_program('teardown-tests.sh', dirs: [join_paths(meson.current_source_dir(), 'scripts')]) -run_test = find_program('run-single-test.sh', dirs: [join_paths(meson.current_source_dir(), 'scripts')]) -find_tests = find_program('find-tests.sh', dirs: [join_paths(meson.current_source_dir(), 'scripts')]) +setup_tests = find_program('setup-tests.sh', dirs: [meson.current_source_dir() / 'scripts']) +teardown_tests = find_program('teardown-tests.sh', dirs: [meson.current_source_dir() / 'scripts']) +run_test = find_program('run-single-test.sh', dirs: [meson.current_source_dir() / 'scripts']) +find_tests = find_program('find-tests.sh', dirs: [meson.current_source_dir() / 'scripts']) test( 'setup-x11', setup_tests, args: ['--x11', env_file, pid_file], - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], + env: test_env, priority: -10, is_parallel: false, protocol: 'exitcode' @@ -55,10 +58,7 @@ test( 'setup-wayland', setup_tests, args: ['--wayland', env_file, pid_file], - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], + env: test_env, priority: -20, is_parallel: false, protocol: 'exitcode' @@ -82,13 +82,9 @@ test( protocol: 'exitcode' ) -kmx_dirs = [ - join_paths(meson.current_source_dir(), '../../../core/build/arch/debug/tests/unit/kmx'), - join_paths(meson.current_source_dir(), '../../../core/build/arch/release/tests/unit/kmx') -] kmxtest_files = run_command( find_tests, - kmx_dirs, + kmx_dir, check: true, ).stdout().split('\n') @@ -103,10 +99,7 @@ foreach kmx: kmxtest_files 'X11-' + testname + '__surrounding-text', run_test, args: [ '--x11', '--surrounding-text', test_args], - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], + env: test_env, depends: [test_exe], priority: -11, is_parallel: false, @@ -117,10 +110,7 @@ foreach kmx: kmxtest_files 'X11-' + testname + '__no-surrounding-text', run_test, args: [ '--x11', '--no-surrounding-text', test_args], - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], + env: test_env, depends: [test_exe], priority: -12, is_parallel: false, @@ -131,10 +121,7 @@ foreach kmx: kmxtest_files 'Wayland-' + testname + '__surrounding-text', run_test, args: [ '--wayland', '--surrounding-text', test_args], - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], + env: test_env, depends: [test_exe], priority: -21, is_parallel: false, @@ -145,10 +132,7 @@ foreach kmx: kmxtest_files 'Wayland-' + testname + '__no-surrounding-text', run_test, args: [ '--wayland', '--no-surrounding-text', test_args], - env: [ - 'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()), - 'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()), - ], + env: test_env, depends: [test_exe], priority: -22, is_parallel: false, From 9221e82422d2b2a19773c45ea3655b96418dcfb3 Mon Sep 17 00:00:00 2001 From: Keyman Build Agent Date: Mon, 6 Feb 2023 14:09:19 -0500 Subject: [PATCH 08/11] auto: increment master version to 17.0.44 --- HISTORY.md | 4 ++++ VERSION.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index ce88c9fcdf..867ba7c027 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,9 @@ # Keyman Version History +## 17.0.43 alpha 2023-02-06 + +* chore(linux): Build with meson instead of autotools ️ (#8111) + ## 17.0.42 alpha 2023-02-03 * chore(deps): bump http-cache-semantics from 4.1.0 to 4.1.1 (#8144) diff --git a/VERSION.md b/VERSION.md index 8a45cf78ed..619ebe6b75 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -17.0.43 \ No newline at end of file +17.0.44 \ No newline at end of file From 9a90e1b23368ffb9a268eb65d2a4febd5e897f40 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Tue, 7 Feb 2023 10:31:24 +0700 Subject: [PATCH 09/11] chore(ios): update certificate --- ios/exportAppStore.plist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/exportAppStore.plist b/ios/exportAppStore.plist index 585577ec2d..6393f3c4cb 100644 --- a/ios/exportAppStore.plist +++ b/ios/exportAppStore.plist @@ -7,9 +7,9 @@ teamID 3YE4W86L3G signingCertificate - 3F2AB892E24387929F51C36E7A03EF33502D341A + 05473BF50CCD4B78B304656FB4D93FDC7EE7ACD0 installerSigningCertificate - 3F2AB892E24387929F51C36E7A03EF33502D341A + 05473BF50CCD4B78B304656FB4D93FDC7EE7ACD0 provisioningProfiles Tavultesoft.Keyman From 7a7ba2f70c6da2a7aa1ac8e4d90edb9010e197ca Mon Sep 17 00:00:00 2001 From: Darcy Wong Date: Tue, 7 Feb 2023 10:38:08 +0700 Subject: [PATCH 10/11] chore(linux): Set test-helper script executable --- linux/ibus-keyman/tests/scripts/test-helper.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 linux/ibus-keyman/tests/scripts/test-helper.sh diff --git a/linux/ibus-keyman/tests/scripts/test-helper.sh b/linux/ibus-keyman/tests/scripts/test-helper.sh old mode 100644 new mode 100755 From 78f7ce81b7cb93a42a689eb8e68787e81cdd66dc Mon Sep 17 00:00:00 2001 From: Keyman Build Agent Date: Tue, 7 Feb 2023 13:01:44 -0500 Subject: [PATCH 11/11] auto: increment master version to 17.0.45 --- HISTORY.md | 5 +++++ VERSION.md | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 867ba7c027..2b0aa8171a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,10 @@ # Keyman Version History +## 17.0.44 alpha 2023-02-07 + +* chore(linux): Set test-helper script executable (#8178) +* chore(linux): Update debian changelog (#8156) + ## 17.0.43 alpha 2023-02-06 * chore(linux): Build with meson instead of autotools ️ (#8111) diff --git a/VERSION.md b/VERSION.md index 619ebe6b75..288124f305 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -17.0.44 \ No newline at end of file +17.0.45 \ No newline at end of file