diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:35:19 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:35:19 +0000 |
commit | b7e8d5af06ee840cc48217ca4629cf28aeeb3c50 (patch) | |
tree | 6aa8dc840b085de50db46e2ad0725eae248fef02 /debian/tests/localed-locale | |
parent | Adding upstream version 252.22. (diff) | |
download | systemd-b7e8d5af06ee840cc48217ca4629cf28aeeb3c50.tar.xz systemd-b7e8d5af06ee840cc48217ca4629cf28aeeb3c50.zip |
Adding debian version 252.22-1~deb12u1.debian/252.22-1_deb12u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/localed-locale')
-rwxr-xr-x | debian/tests/localed-locale | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/debian/tests/localed-locale b/debian/tests/localed-locale new file mode 100755 index 0000000..472518f --- /dev/null +++ b/debian/tests/localed-locale @@ -0,0 +1,63 @@ +#!/bin/sh +set -e + +. `dirname $0`/assert.sh + +if [ -n "$TEST_UPSTREAM" ]; then + LOCALE_CONF=/etc/locale.conf +else + LOCALE_CONF=/etc/default/locale +fi + +if [ -f "$LOCALE_CONF" ]; then + cp "$LOCALE_CONF" "${LOCALE_CONF}.orig" +fi + +# ensure tested locale exist +mv /etc/locale.gen /etc/locale.gen.orig +echo "en_US.UTF-8 UTF-8" > /etc/locale.gen +locale-gen en_US.UTF-8 + +if ! [ -e /etc/default/keyboard ]; then + /bin/echo -e 'XKBMODEL=us\nXKBLAYOUT=pc105' > /etc/default/keyboard +fi + +# should activate daemon and work +assert_in "System Locale:" "`localectl --no-pager`" + +# change locale +assert_eq "`localectl --no-pager set-locale LANG=C LC_CTYPE=en_US.UTF-8 2>&1`" "" +sync +assert_eq "`cat $LOCALE_CONF`" "LANG=C +LC_CTYPE=en_US.UTF-8" + +if [ -z "$TEST_UPSTREAM" ]; then + ! [ -f /etc/locale.conf ] +fi + +STATUS=`localectl` +assert_in "System Locale: LANG=C" "$STATUS" +assert_in "LC_CTYPE=en_US.UTF-8" "$STATUS" + +# test if localed auto-runs locale-gen + +# ensure tested locale does not exist +assert_rc 1 validlocale de_DE.UTF-8 2>&1 + +# change locale +assert_eq "`localectl --no-pager set-locale de_DE.UTF-8 2>&1`" "" +sync +assert_eq "`cat $LOCALE_CONF`" "LANG=de_DE.UTF-8 +LC_CTYPE=en_US.UTF-8" + +# ensure tested locale exists and works now +assert_rc 0 validlocale de_DE.UTF-8 2>&1 + +# reset locale to original +if [ -f "${LOCALE_CONF}.orig" ]; then + mv "${LOCALE_CONF}.orig" "$LOCALE_CONF" +else + rm "$LOCALE_CONF" +fi +mv /etc/locale.gen.orig /etc/locale.gen +locale-gen |