Bug 9070 - Add test that locales are working
Summary: Add test that locales are working
Status: RESOLVED FIXED
Alias: None
Product: Runtime Testing
Classification: QA/Testing
Component: general (show other bugs)
Version: 2.5
Hardware: All Multiple
: Medium enhancement
Target Milestone: 5.99
Assignee: New Comer Bugs
QA Contact: Apoorv
URL:
Whiteboard: NEWCOMER
Depends on:
Blocks:
 
Reported: 2016-02-05 13:43 UTC by Ross Burton
Modified: 2024-01-04 20:40 UTC (History)
7 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Burton 2016-02-05 13:43:32 UTC
Basically we need to test that locales are working, both generated on first boot and build time.

IMAGE_LINGUAS="en-us fr-fr"
ENABLE_BINARY_LOCALE_GENERATION="0"
MACHINE=qemuarm
bitbake core-image-base

boot up, ssh in and do (handwavy) something that uses translated strings and won't change.  A reasonable suggestion was LANG=fr_FR df | head -n1.  Check that the string is in fact in French.

Then do that again with ENABLE_BINARY_LOCALE_GENERATION="1".  Using MACHINE=qemuarm is important as we want to make sure that the host and target architectures are not compatible.
Comment 1 Leonardo Sandoval Gonzalez 2016-05-25 20:44:00 UTC
Due to limited resources, moving this to 2.3
Comment 2 Jose Perez C 2017-01-04 20:16:27 UTC
(In reply to comment #0)
> Basically we need to test that locales are working, both generated on first
> boot and build time.
> 
> IMAGE_LINGUAS="en-us fr-fr"
> ENABLE_BINARY_LOCALE_GENERATION="0"
> MACHINE=qemuarm
> bitbake core-image-base
> 
> boot up, ssh in and do (handwavy) something that uses translated strings and
> won't change.  A reasonable suggestion was LANG=fr_FR df | head -n1.  Check
> that the string is in fact in French.
> 
> Then do that again with ENABLE_BINARY_LOCALE_GENERATION="1".  Using
> MACHINE=qemuarm is important as we want to make sure that the host and
> target architectures are not compatible.

I followed the steps mentioned above and still seeing the string in English, there is any extra configuration needed or locales are not working properly?
Comment 3 Stephen K Jolley 2017-02-16 16:06:03 UTC
Ross, please review and close if complete.
Comment 4 Yocto User 2017-03-10 09:00:29 UTC
If the "df" command is from BusyBox (v1.24.1), translation doesn't work. Avoid to use tools from BusyBox to check if translation works.
Comment 5 Robin Jordan 2018-02-26 20:34:03 UTC
Please provide a status on this.  Will it be ready for YP 2.5 M3?
Comment 6 Robin Jordan 2018-02-26 20:43:58 UTC
I now see this is targeted for M4.
Comment 7 Apoorv 2018-03-21 07:09:54 UTC
locales have been tested by doing following steps:

changes made in local.conf:
GLIBC_GENERATE_LOCALES = "en_US.UTF-8 fr_FR.UTF-8"
IMAGE_LINGUAS += "en-us fr-fr"
IMAGE_INSTALL_append +="glibc-utils localedef"
ENABLE_BINARY_LOCALE_GENERATION="1"

Image generated : bitbake core-image-sato-sdk

boot up and run following commands on terminal:
# locale -a
C
POSIX
en_US
fr_FR
# locale
LANG=
LC_CTYPE = "POSIX"
# export LANG=fr.FR.UTF-8
# locale
LANG=fr.FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
#LC_TIME=fr_FR.UTF-8 date
mer.mars 21 13:54:20 UTC 2018
#LC_TIME=fr_FR.UTF-8 date
Wed Mar 21 13:54:45 UTC 2018
Comment 8 Ross Burton 2018-03-21 07:22:42 UTC
We need that, but in an automated test.
Comment 9 Apoorv 2018-03-22 15:24:49 UTC
i will get a runtime automated test case in.
Comment 10 Louis Rannou 2023-01-18 16:40:29 UTC
I cannot use date because it is also from busybox. But I'm adding a check with localedef:

# localedef --list-archive | grep "fr_FR.utf8"
Comment 11 Louis Rannou 2023-01-18 17:03:37 UTC
I have created a meta/lib/oeqa/runtime/cases/locales.py

https://privatebin.net/?eb04f95e2d5a9ba1#5dsY67YYN4swSr5wSF5bsWDCheaxGsXtEuzyXf6PUrGM

It requires the local.conf to have:

IMAGE_INSTALL:append = " dropbear "
IMAGE_FEATURES:append = " empty-root-password allow-empty-password allow-root-login "
IMAGE_INSTALL:append = " glibc-utils localedef "
INHERIT:append = " testimage "
TEST_SUITES = " ping ssh locales "
GLIBC_GENERATE_LOCALES = "en_US.UTF-8 fr_FR.UTF-8"
IMAGE_LINGUAS="en-us fr-fr"
ENABLE_BINARY_LOCALE_GENERATION="1"

Is that good or does it require something that automatically set those before running the test ?
Comment 12 Ross Burton 2023-01-18 17:43:44 UTC
Thanks!

The test should set all the variables that it needs.  Have a look at other tests in eg imagefeatures.py as examples.
Comment 13 Louis Rannou 2023-01-19 12:47:47 UTC
What I have done is a runtime test. As I understand now, it should be placed in selftest instead, right ?
Comment 14 Ross Burton 2023-01-19 13:57:52 UTC
Yes, in selftest we control the environment.
Comment 15 Louis Rannou 2023-01-23 16:08:06 UTC
Do you still require the test when ENABLE_BINARY_LOCALE_GENERATION="0" while this means a complete rebuild (the glibc depends on it) ?
Comment 17 Randy MacLeod 2023-10-24 14:24:56 UTC
Bulk move from 4.99 or 0.00 to 5.99