]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-keymap-util: always use kbd-model-map we ship
authorFranck Bui <fbui@suse.com>
Wed, 19 May 2021 12:14:58 +0000 (14:14 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 2 Nov 2021 15:48:55 +0000 (16:48 +0100)
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
src/test/meson.build
test/meson.build
test/test-keymap-util/kbd-model-map [new symlink]

index 6f60aba38ce53ab7607ac7207986964a3c9f587e..a5d40af448169cf5f3ce3d3695ab8ef283b6b209 100644 (file)
@@ -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();
 
index 7b4df45aac9e0a30ea3ef1931cd325f5557c8f2b..b22413029d2227179c1f7a09078a44516b4cf3a3 100644 (file)
@@ -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)
 
index a5bfbb74621ff38d8a336a4f19b3df60cf3c4a5e..1d63c0c038848de4d58b6feb60c06adf8590434e 100644 (file)
@@ -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 (symlink)
index 0000000..3e7c928
--- /dev/null
@@ -0,0 +1 @@
+../../src/locale/kbd-model-map
\ No newline at end of file