|
|
8d419f |
From 85e06430f03fe3078d5443d80ce53721fa88b285 Mon Sep 17 00:00:00 2001
|
|
|
8d419f |
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
|
8d419f |
Date: Tue, 14 Jun 2022 09:14:00 +0900
|
|
|
8d419f |
Subject: [PATCH] test: import localed tests from debian/ubuntu test suite
|
|
|
8d419f |
|
|
|
8d419f |
(cherry picked from commit 47ba157cc083dcc5e5d7dcbdc1e27db0d6dced3e)
|
|
|
8d419f |
|
|
|
8d419f |
Related: #2087652
|
|
|
8d419f |
---
|
|
|
8d419f |
test/TEST-73-LOCALE/Makefile | 1 +
|
|
|
8d419f |
test/TEST-73-LOCALE/test.sh | 10 +
|
|
|
8d419f |
test/units/testsuite-73.service | 10 +
|
|
|
8d419f |
test/units/testsuite-73.sh | 391 ++++++++++++++++++++++++++++++++
|
|
|
8d419f |
4 files changed, 412 insertions(+)
|
|
|
8d419f |
create mode 120000 test/TEST-73-LOCALE/Makefile
|
|
|
8d419f |
create mode 100755 test/TEST-73-LOCALE/test.sh
|
|
|
8d419f |
create mode 100644 test/units/testsuite-73.service
|
|
|
8d419f |
create mode 100755 test/units/testsuite-73.sh
|
|
|
8d419f |
|
|
|
8d419f |
diff --git a/test/TEST-73-LOCALE/Makefile b/test/TEST-73-LOCALE/Makefile
|
|
|
8d419f |
new file mode 120000
|
|
|
8d419f |
index 0000000000..e9f93b1104
|
|
|
8d419f |
--- /dev/null
|
|
|
8d419f |
+++ b/test/TEST-73-LOCALE/Makefile
|
|
|
8d419f |
@@ -0,0 +1 @@
|
|
|
8d419f |
+../TEST-01-BASIC/Makefile
|
|
|
8d419f |
\ No newline at end of file
|
|
|
8d419f |
diff --git a/test/TEST-73-LOCALE/test.sh b/test/TEST-73-LOCALE/test.sh
|
|
|
8d419f |
new file mode 100755
|
|
|
8d419f |
index 0000000000..a33ddaba86
|
|
|
8d419f |
--- /dev/null
|
|
|
8d419f |
+++ b/test/TEST-73-LOCALE/test.sh
|
|
|
8d419f |
@@ -0,0 +1,10 @@
|
|
|
8d419f |
+#!/usr/bin/env bash
|
|
|
8d419f |
+# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
8d419f |
+set -e
|
|
|
8d419f |
+
|
|
|
8d419f |
+TEST_DESCRIPTION="test localed"
|
|
|
8d419f |
+
|
|
|
8d419f |
+# shellcheck source=test/test-functions
|
|
|
8d419f |
+. "${TEST_BASE_DIR:?}/test-functions"
|
|
|
8d419f |
+
|
|
|
8d419f |
+do_test "$@"
|
|
|
8d419f |
diff --git a/test/units/testsuite-73.service b/test/units/testsuite-73.service
|
|
|
8d419f |
new file mode 100644
|
|
|
8d419f |
index 0000000000..bee8c4215d
|
|
|
8d419f |
--- /dev/null
|
|
|
8d419f |
+++ b/test/units/testsuite-73.service
|
|
|
8d419f |
@@ -0,0 +1,10 @@
|
|
|
8d419f |
+# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
8d419f |
+[Unit]
|
|
|
8d419f |
+Description=TEST-73-LOCALE
|
|
|
8d419f |
+
|
|
|
8d419f |
+[Service]
|
|
|
8d419f |
+ExecStartPre=rm -f /failed /testok
|
|
|
8d419f |
+ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
|
|
|
8d419f |
+StandardOutput=journal+console
|
|
|
8d419f |
+StandardError=journal+console
|
|
|
8d419f |
+Type=oneshot
|
|
|
8d419f |
diff --git a/test/units/testsuite-73.sh b/test/units/testsuite-73.sh
|
|
|
8d419f |
new file mode 100755
|
|
|
8d419f |
index 0000000000..d96e9f4151
|
|
|
8d419f |
--- /dev/null
|
|
|
8d419f |
+++ b/test/units/testsuite-73.sh
|
|
|
8d419f |
@@ -0,0 +1,391 @@
|
|
|
8d419f |
+#!/usr/bin/env bash
|
|
|
8d419f |
+# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
8d419f |
+
|
|
|
8d419f |
+set -eux
|
|
|
8d419f |
+set -o pipefail
|
|
|
8d419f |
+
|
|
|
8d419f |
+# shellcheck source=test/units/assert.sh
|
|
|
8d419f |
+. "$(dirname "$0")"/assert.sh
|
|
|
8d419f |
+
|
|
|
8d419f |
+enable_debug() {
|
|
|
8d419f |
+ mkdir -p /run/systemd/system/systemd-localed.service.d
|
|
|
8d419f |
+ cat >>/run/systemd/system/systemd-localed.service.d/override.conf <
|
|
|
8d419f |
+[Service]
|
|
|
8d419f |
+Environment=SYSTEMD_LOG_LEVEL=debug
|
|
|
8d419f |
+EOF
|
|
|
8d419f |
+
|
|
|
8d419f |
+ mkdir -p /run/systemd/system/systemd-vconsole-setup.service.d
|
|
|
8d419f |
+ cat >>/run/systemd/system/systemd-vconsole-setup.service.d/override.conf <
|
|
|
8d419f |
+[Unit]
|
|
|
8d419f |
+StartLimitIntervalSec=0
|
|
|
8d419f |
+
|
|
|
8d419f |
+[Service]
|
|
|
8d419f |
+Environment=SYSTEMD_LOG_LEVEL=debug
|
|
|
8d419f |
+EOF
|
|
|
8d419f |
+
|
|
|
8d419f |
+ systemctl daemon-reload
|
|
|
8d419f |
+}
|
|
|
8d419f |
+
|
|
|
8d419f |
+restore_locale() {
|
|
|
8d419f |
+ if [[ -d /usr/lib/locale/xx_XX.UTF-8 ]]; then
|
|
|
8d419f |
+ rmdir /usr/lib/locale/xx_XX.UTF-8
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /tmp/locale.conf.bak ]]; then
|
|
|
8d419f |
+ mv /tmp/locale.conf.bak /etc/locale.conf
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ rm -f /etc/locale.conf
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /tmp/default-locale.bak ]]; then
|
|
|
8d419f |
+ mv /tmp/default-locale.bak /etc/default/locale
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ rm -f /etc/default/locale
|
|
|
8d419f |
+ rmdir --ignore-fail-on-non-empty /etc/default
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /tmp/locale.gen.bak ]]; then
|
|
|
8d419f |
+ mv /tmp/locale.gen.bak /etc/locale.gen
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ rm -f /etc/locale.gen
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+}
|
|
|
8d419f |
+
|
|
|
8d419f |
+test_locale() {
|
|
|
8d419f |
+ local i output
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /etc/locale.conf ]]; then
|
|
|
8d419f |
+ cp /etc/locale.conf /tmp/locale.conf.bak
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # Debian/Ubuntu specific file
|
|
|
8d419f |
+ if [[ -f /etc/default/locale ]]; then
|
|
|
8d419f |
+ cp /etc/default/locale /tmp/default-locale.bak
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /etc/locale.gen ]]; then
|
|
|
8d419f |
+ cp /etc/locale.gen /tmp/locale.gen.bak
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # remove locale.conf to make /etc/default/locale used by Debian/Ubuntu
|
|
|
8d419f |
+ rm -f /etc/locale.conf
|
|
|
8d419f |
+ # also remove /etc/default/locale
|
|
|
8d419f |
+ rm -f /etc/default/locale
|
|
|
8d419f |
+ # and create /etc/default to make /etc/default/locale created by localed
|
|
|
8d419f |
+ mkdir -p /etc/default
|
|
|
8d419f |
+
|
|
|
8d419f |
+ trap restore_locale RETURN
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if command -v locale-gen >/dev/null 2>&1 &&
|
|
|
8d419f |
+ ! localectl list-locales | grep -F "en_US.UTF-8"; then
|
|
|
8d419f |
+ # ensure at least one utf8 locale exist
|
|
|
8d419f |
+ echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
|
|
8d419f |
+ locale-gen en_US.UTF-8
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # create invalid locale
|
|
|
8d419f |
+ mkdir -p /usr/lib/locale/xx_XX.UTF-8
|
|
|
8d419f |
+ assert_not_in "xx_XX.UTF-8" "$(localectl list-locales)"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -z "$(localectl list-locales)" ]]; then
|
|
|
8d419f |
+ echo "No locale installed, skipping test."
|
|
|
8d419f |
+ return
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # warn when kernel command line has locale settings
|
|
|
8d419f |
+ output=$(SYSTEMD_PROC_CMDLINE="locale.LANG=C.UTF-8 locale.LC_CTYPE=ja_JP.UTF-8" localectl 2>&1)
|
|
|
8d419f |
+ assert_in "Warning:" "$output"
|
|
|
8d419f |
+ assert_in "Command Line: LANG=C.UTF-8" "$output"
|
|
|
8d419f |
+ assert_in "LC_CTYPE=ja_JP.UTF-8" "$output"
|
|
|
8d419f |
+ assert_in "System Locale:" "$output"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # change locale
|
|
|
8d419f |
+ for i in $(localectl list-locales); do
|
|
|
8d419f |
+ assert_rc 0 localectl set-locale "LANG=C" "LC_CTYPE=$i"
|
|
|
8d419f |
+ if [[ -f /etc/default/locale ]]; then
|
|
|
8d419f |
+ assert_eq "$(cat /etc/default/locale)" "LANG=C
|
|
|
8d419f |
+LC_CTYPE=$i"
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ assert_eq "$(cat /etc/locale.conf)" "LANG=C
|
|
|
8d419f |
+LC_CTYPE=$i"
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+ output=$(localectl)
|
|
|
8d419f |
+ assert_in "System Locale: LANG=C" "$output"
|
|
|
8d419f |
+ assert_in "LC_CTYPE=$i" "$output"
|
|
|
8d419f |
+ output=$(systemctl show-environment)
|
|
|
8d419f |
+ assert_in "LANG=C" "$output"
|
|
|
8d419f |
+ assert_in "LC_CTYPE=$i" "$output"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ assert_rc 0 localectl set-locale "$i"
|
|
|
8d419f |
+ if [[ -f /etc/default/locale ]]; then
|
|
|
8d419f |
+ # Debian/Ubuntu patch is buggy, and LC_CTYPE= still exists.
|
|
|
8d419f |
+ assert_eq "$(cat /etc/default/locale)" "LANG=$i
|
|
|
8d419f |
+LC_CTYPE=$i"
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ assert_eq "$(cat /etc/locale.conf)" "LANG=$i"
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+ output=$(localectl)
|
|
|
8d419f |
+ assert_in "System Locale: LANG=$i" "$output"
|
|
|
8d419f |
+ assert_not_in "LC_CTYPE=" "$output"
|
|
|
8d419f |
+ output=$(systemctl show-environment)
|
|
|
8d419f |
+ assert_in "LANG=$i" "$output"
|
|
|
8d419f |
+ assert_not_in "LC_CTYPE=" "$output"
|
|
|
8d419f |
+ done
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # test if localed auto-runs locale-gen
|
|
|
8d419f |
+ if command -v locale-gen >/dev/null 2>&1 &&
|
|
|
8d419f |
+ ! localectl list-locales | grep -F "de_DE.UTF-8"; then
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # clear previous locale
|
|
|
8d419f |
+ systemctl stop systemd-localed.service
|
|
|
8d419f |
+ rm -f /etc/locale.conf /etc/default/locale
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # change locale
|
|
|
8d419f |
+ assert_rc 0 localectl set-locale de_DE.UTF-8
|
|
|
8d419f |
+ if [[ -f /etc/default/locale ]]; then
|
|
|
8d419f |
+ assert_eq "$(cat /etc/default/locale)" "LANG=de_DE.UTF-8"
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ assert_eq "$(cat /etc/locale.conf)" "LANG=de_DE.UTF-8"
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+ assert_in "System Locale: LANG=de_DE.UTF-8" "$(localectl)"
|
|
|
8d419f |
+ assert_in "LANG=de_DE.UTF-8" "$(systemctl show-environment)"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # ensure tested locale exists and works now
|
|
|
8d419f |
+ assert_in "de_DE.UTF-8" "$(localectl list-locales)"
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+}
|
|
|
8d419f |
+
|
|
|
8d419f |
+backup_keymap() {
|
|
|
8d419f |
+ if [[ -f /etc/vconsole.conf ]]; then
|
|
|
8d419f |
+ cp /etc/vconsole.conf /tmp/vconsole.conf.bak
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /etc/X11/xorg.conf.d/00-keyboard.conf ]]; then
|
|
|
8d419f |
+ cp /etc/X11/xorg.conf.d/00-keyboard.conf /tmp/00-keyboard.conf.bak
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # Debian/Ubuntu specific file
|
|
|
8d419f |
+ if [[ -f /etc/default/keyboard ]]; then
|
|
|
8d419f |
+ cp /etc/default/keyboard /tmp/default-keyboard.bak
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ mkdir -p /etc/default
|
|
|
8d419f |
+}
|
|
|
8d419f |
+
|
|
|
8d419f |
+restore_keymap() {
|
|
|
8d419f |
+ if [[ -f /tmp/vconsole.conf.bak ]]; then
|
|
|
8d419f |
+ mv /tmp/vconsole.conf.bak /etc/vconsole.conf
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ rm -f /etc/vconsole.conf
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /tmp/00-keyboard.conf.bak ]]; then
|
|
|
8d419f |
+ mv /tmp/00-keyboard.conf.bak /etc/X11/xorg.conf.d/00-keyboard.conf
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ rm -f /etc/X11/xorg.conf.d/00-keyboard.conf
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /tmp/default-keyboard.bak ]]; then
|
|
|
8d419f |
+ mv /tmp/default-keyboard.bak /etc/default/keyboard
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ rm -f /etc/default/keyboard
|
|
|
8d419f |
+ rmdir --ignore-fail-on-non-empty /etc/default
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+}
|
|
|
8d419f |
+
|
|
|
8d419f |
+wait_vconsole_setup() {
|
|
|
8d419f |
+ local i ss
|
|
|
8d419f |
+ for ((i = 0; i < 20; i++)); do
|
|
|
8d419f |
+ if (( i != 0 )); then sleep .5; fi
|
|
|
8d419f |
+ ss="$(systemctl --property SubState --value show systemd-vconsole-setup.service)"
|
|
|
8d419f |
+ if [[ "$ss" == "exited" || "$ss" == "dead" || "$ss" == "condition" ]]; then
|
|
|
8d419f |
+ return 0
|
|
|
8d419f |
+ elif [[ "$ss" == "failed" ]]; then
|
|
|
8d419f |
+ echo "WARNING: systemd-vconsole-setup.service failed, ignoring." >&2
|
|
|
8d419f |
+ systemctl reset-failed systemd-vconsole-setup.service
|
|
|
8d419f |
+ return 0
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+ done
|
|
|
8d419f |
+
|
|
|
8d419f |
+ systemctl status systemd-vconsole-setup.service
|
|
|
8d419f |
+ return 1
|
|
|
8d419f |
+}
|
|
|
8d419f |
+
|
|
|
8d419f |
+test_vc_keymap() {
|
|
|
8d419f |
+ local i output
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -z "$(localectl list-keymaps)" ]]; then
|
|
|
8d419f |
+ echo "No vconsole keymap installed, skipping test."
|
|
|
8d419f |
+ return
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ backup_keymap
|
|
|
8d419f |
+ trap restore_keymap RETURN
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # should activate daemon and work
|
|
|
8d419f |
+ assert_in "VC Keymap:" "$(localectl)"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ for i in $(localectl list-keymaps); do
|
|
|
8d419f |
+ # clear previous conversion from VC -> X11 keymap
|
|
|
8d419f |
+ systemctl stop systemd-localed.service
|
|
|
8d419f |
+ wait_vconsole_setup
|
|
|
8d419f |
+ rm -f /etc/X11/xorg.conf.d/00-keyboard.conf /etc/default/keyboard
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # set VC keymap
|
|
|
8d419f |
+ assert_rc 0 localectl set-keymap "$i"
|
|
|
8d419f |
+ output=$(localectl)
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # check VC keymap
|
|
|
8d419f |
+ assert_in "KEYMAP=$i" "$(cat /etc/vconsole.conf)"
|
|
|
8d419f |
+ assert_in "VC Keymap: $i" "$output"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # check VC -> X11 keymap conversion
|
|
|
8d419f |
+ if [[ "$i" == "us" ]]; then
|
|
|
8d419f |
+ assert_in "X11 Layout: us" "$output"
|
|
|
8d419f |
+ assert_in "X11 Model: pc105\+inet" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Variant:" "$output"
|
|
|
8d419f |
+ assert_in "X11 Options: terminate:ctrl_alt_bksp" "$output"
|
|
|
8d419f |
+ elif [[ "$i" == "us-acentos" ]]; then
|
|
|
8d419f |
+ assert_in "X11 Layout: us" "$output"
|
|
|
8d419f |
+ assert_in 'X11 Model: pc105$' "$output"
|
|
|
8d419f |
+ assert_in "X11 Variant: intl" "$output"
|
|
|
8d419f |
+ assert_in "X11 Options: terminate:ctrl_alt_bksp" "$output"
|
|
|
8d419f |
+ elif [[ "$i" =~ ^us-.* ]]; then
|
|
|
8d419f |
+ assert_in "X11 Layout: n/a" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Model:" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Variant:" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Options:" "$output"
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+ done
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # gets along without config file
|
|
|
8d419f |
+ systemctl stop systemd-localed.service
|
|
|
8d419f |
+ wait_vconsole_setup
|
|
|
8d419f |
+ rm -f /etc/vconsole.conf
|
|
|
8d419f |
+ assert_in "VC Keymap: n/a" "$(localectl)"
|
|
|
8d419f |
+}
|
|
|
8d419f |
+
|
|
|
8d419f |
+test_x11_keymap() {
|
|
|
8d419f |
+ local output
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -z "$(localectl list-x11-keymap-layouts)" ]]; then
|
|
|
8d419f |
+ echo "No x11 keymap installed, skipping test."
|
|
|
8d419f |
+ return
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ backup_keymap
|
|
|
8d419f |
+ trap restore_keymap RETURN
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # should activate daemon and work
|
|
|
8d419f |
+ assert_in "X11 Layout:" "$(localectl)"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # set x11 keymap (layout, model, variant, options)
|
|
|
8d419f |
+ assert_rc 0 localectl set-x11-keymap us pc105+inet intl terminate:ctrl_alt_bksp
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /etc/default/keyboard ]]; then
|
|
|
8d419f |
+ assert_eq "$(cat /etc/default/keyboard)" "XKBLAYOUT=us
|
|
|
8d419f |
+XKBMODEL=pc105+inet
|
|
|
8d419f |
+XKBVARIANT=intl
|
|
|
8d419f |
+XKBOPTIONS=terminate:ctrl_alt_bksp"
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ output=$(cat /etc/X11/xorg.conf.d/00-keyboard.conf)
|
|
|
8d419f |
+ assert_in 'Option "XkbLayout" "us"' "$output"
|
|
|
8d419f |
+ assert_in 'Option "XkbModel" "pc105\+inet"' "$output"
|
|
|
8d419f |
+ assert_in 'Option "XkbVariant" "intl"' "$output"
|
|
|
8d419f |
+ assert_in 'Option "XkbOptions" "terminate:ctrl_alt_bksp"' "$output"
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ output=$(localectl)
|
|
|
8d419f |
+ assert_in "X11 Layout: us" "$output"
|
|
|
8d419f |
+ assert_in "X11 Model: pc105\+inet" "$output"
|
|
|
8d419f |
+ assert_in "X11 Variant: intl" "$output"
|
|
|
8d419f |
+ assert_in "X11 Options: terminate:ctrl_alt_bksp" "$output"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # Debian/Ubuntu patch is buggy, unspecified settings are not cleared
|
|
|
8d419f |
+ rm -f /etc/default/keyboard
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # set x11 keymap (layout, model, variant)
|
|
|
8d419f |
+ assert_rc 0 localectl set-x11-keymap us pc105+inet intl
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /etc/default/keyboard ]]; then
|
|
|
8d419f |
+ assert_eq "$(cat /etc/default/keyboard)" "XKBLAYOUT=us
|
|
|
8d419f |
+XKBMODEL=pc105+inet
|
|
|
8d419f |
+XKBVARIANT=intl"
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ output=$(cat /etc/X11/xorg.conf.d/00-keyboard.conf)
|
|
|
8d419f |
+ assert_in 'Option "XkbLayout" "us"' "$output"
|
|
|
8d419f |
+ assert_in 'Option "XkbModel" "pc105\+inet"' "$output"
|
|
|
8d419f |
+ assert_in 'Option "XkbVariant" "intl"' "$output"
|
|
|
8d419f |
+ assert_not_in 'Option "XkbOptions"' "$output"
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ output=$(localectl)
|
|
|
8d419f |
+ assert_in "X11 Layout: us" "$output"
|
|
|
8d419f |
+ assert_in "X11 Model: pc105\+inet" "$output"
|
|
|
8d419f |
+ assert_in "X11 Variant: intl" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Options:" "$output"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # Debian/Ubuntu patch is buggy, unspecified settings are not cleared
|
|
|
8d419f |
+ rm -f /etc/default/keyboard
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # set x11 keymap (layout, model)
|
|
|
8d419f |
+ assert_rc 0 localectl set-x11-keymap us pc105+inet
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /etc/default/keyboard ]]; then
|
|
|
8d419f |
+ assert_eq "$(cat /etc/default/keyboard)" "XKBLAYOUT=us
|
|
|
8d419f |
+XKBMODEL=pc105+inet"
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ output=$(cat /etc/X11/xorg.conf.d/00-keyboard.conf)
|
|
|
8d419f |
+ assert_in 'Option "XkbLayout" "us"' "$output"
|
|
|
8d419f |
+ assert_in 'Option "XkbModel" "pc105\+inet"' "$output"
|
|
|
8d419f |
+ assert_not_in 'Option "XkbVariant"' "$output"
|
|
|
8d419f |
+ assert_not_in 'Option "XkbOptions"' "$output"
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ output=$(localectl)
|
|
|
8d419f |
+ assert_in "X11 Layout: us" "$output"
|
|
|
8d419f |
+ assert_in "X11 Model: pc105\+inet" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Variant:" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Options:" "$output"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # Debian/Ubuntu patch is buggy, unspecified settings are not cleared
|
|
|
8d419f |
+ rm -f /etc/default/keyboard
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # set x11 keymap (layout)
|
|
|
8d419f |
+ assert_rc 0 localectl set-x11-keymap us
|
|
|
8d419f |
+
|
|
|
8d419f |
+ if [[ -f /etc/default/keyboard ]]; then
|
|
|
8d419f |
+ assert_eq "$(cat /etc/default/keyboard)" "XKBLAYOUT=us"
|
|
|
8d419f |
+ else
|
|
|
8d419f |
+ output=$(cat /etc/X11/xorg.conf.d/00-keyboard.conf)
|
|
|
8d419f |
+ assert_in 'Option "XkbLayout" "us"' "$output"
|
|
|
8d419f |
+ assert_not_in 'Option "XkbModel"' "$output"
|
|
|
8d419f |
+ assert_not_in 'Option "XkbVariant"' "$output"
|
|
|
8d419f |
+ assert_not_in 'Option "XkbOptions"' "$output"
|
|
|
8d419f |
+ fi
|
|
|
8d419f |
+
|
|
|
8d419f |
+ output=$(localectl)
|
|
|
8d419f |
+ assert_in "X11 Layout: us" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Model:" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Variant:" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Options:" "$output"
|
|
|
8d419f |
+
|
|
|
8d419f |
+ # gets along without config file
|
|
|
8d419f |
+ systemctl stop systemd-localed.service
|
|
|
8d419f |
+ rm -f /etc/X11/xorg.conf.d/00-keyboard.conf /etc/default/keyboard
|
|
|
8d419f |
+ output=$(localectl)
|
|
|
8d419f |
+ assert_in "X11 Layout: n/a" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Model:" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Variant:" "$output"
|
|
|
8d419f |
+ assert_not_in "X11 Options:" "$output"
|
|
|
8d419f |
+}
|
|
|
8d419f |
+
|
|
|
8d419f |
+: >/failed
|
|
|
8d419f |
+
|
|
|
8d419f |
+enable_debug
|
|
|
8d419f |
+test_locale
|
|
|
8d419f |
+test_vc_keymap
|
|
|
8d419f |
+test_x11_keymap
|
|
|
8d419f |
+
|
|
|
8d419f |
+touch /testok
|
|
|
8d419f |
+rm /failed
|