From be0cc2ce6c947aafadb3f42dba405269f670b31c Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Wed, 19 May 2021 14:14:58 +0200 Subject: [PATCH] test-keymap-util: always use kbd-model-map we ship This test makes assumptions on the availability of some mappings contained in kbd-model-map and therefore strongly relies on the version shipped by upstream. IOW the test is likely to fail if it's installed on a system with a more comprehensive kbd-model-map. This patch makes the upstream kbd-model-map file available via a symlink in test/testdata/test-keymap-util dir and makes sure that this specific version is always used by test-keymap-util regardless of whether the test is installed and run on a different system or directly run (optionally via meson) from the project working dir. --- src/locale/test-keymap-util.c | 5 +++++ src/test/meson.build | 1 - test/meson.build | 3 +++ test/test-keymap-util/kbd-model-map | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) create mode 120000 test/test-keymap-util/kbd-model-map diff --git a/src/locale/test-keymap-util.c b/src/locale/test-keymap-util.c index 6f60aba38c..a5d40af448 100644 --- a/src/locale/test-keymap-util.c +++ b/src/locale/test-keymap-util.c @@ -190,12 +190,17 @@ static void test_x11_convert_to_vconsole(void) { } int main(int argc, char **argv) { + _cleanup_free_ char *map = NULL; + test_setup_logging(LOG_DEBUG); test_find_language_fallback(); test_find_converted_keymap(); test_find_legacy_keymap(); + assert_se(get_testdata_dir("test-keymap-util/kbd-model-map", &map) >= 0); + assert_se(setenv("SYSTEMD_KBD_MODEL_MAP", map, 1) == 0); + test_vconsole_convert_to_x11(); test_x11_convert_to_vconsole(); diff --git a/src/test/meson.build b/src/test/meson.build index 7b4df45aac..b22413029d 100644 --- a/src/test/meson.build +++ b/src/test/meson.build @@ -13,7 +13,6 @@ test_include_dir = include_directories('.') path = run_command(sh, '-c', 'echo "$PATH"').stdout().strip() test_env = environment() -test_env.set('SYSTEMD_KBD_MODEL_MAP', kbd_model_map) test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map) test_env.set('PATH', project_build_root + ':' + path) diff --git a/test/meson.build b/test/meson.build index a5bfbb7462..1d63c0c038 100644 --- a/test/meson.build +++ b/test/meson.build @@ -36,6 +36,9 @@ if install_tests install_subdir('testsuite-63.units', install_dir : testdata_dir) + install_data(kbd_model_map, + install_dir : testdata_dir + '/test-keymap-util') + testsuite08_dir = testdata_dir + '/testsuite-08.units' install_data('testsuite-08.units/-.mount', install_dir : testsuite08_dir) diff --git a/test/test-keymap-util/kbd-model-map b/test/test-keymap-util/kbd-model-map new file mode 120000 index 0000000000..3e7c928b26 --- /dev/null +++ b/test/test-keymap-util/kbd-model-map @@ -0,0 +1 @@ +../../src/locale/kbd-model-map \ No newline at end of file