diff options
author | Louis Rannou <lrannou@baylibre.com> | 2023-02-01 16:11:41 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-02 09:52:52 +0000 |
commit | 912977a3736a67a5322d247eafe4e2c6daf90c6b (patch) | |
tree | aba1ad6d8d505856cc31e4d596069c183f529a0a /meta/lib | |
parent | a08c791bae13bda56ee71e9023329473e8d5baa5 (diff) | |
download | poky-912977a3736a67a5322d247eafe4e2c6daf90c6b.tar.gz |
oeqa/selftest/locales: Add selftest for locale generation/presence
[YOCTO #9070]
Add a new selftest to validate locale generation. This selftest builds a
complete target with GLIBC_GENERATE_LOCALES, IMAGE_LINGUAS,
ENABLE_BINARY_LOCALE_GENERATION set.
(From OE-Core rev: 53258fd810bea6475af9f908f7b712a13a02b628)
Signed-off-by: Louis Rannou <lrannou@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/locales.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/locales.py b/meta/lib/oeqa/selftest/cases/locales.py new file mode 100644 index 0000000000..433991abf9 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/locales.py | |||
@@ -0,0 +1,45 @@ | |||
1 | # | ||
2 | # SPDX-License-Identifier: MIT | ||
3 | # | ||
4 | |||
5 | from oeqa.selftest.case import OESelftestTestCase | ||
6 | from oeqa.core.decorator import OETestTag | ||
7 | from oeqa.utils.commands import bitbake, runqemu | ||
8 | |||
9 | class LocalesTest(OESelftestTestCase): | ||
10 | |||
11 | @OETestTag("runqemu") | ||
12 | def test_locales_on(self): | ||
13 | """ | ||
14 | Summary: Test the locales are generated | ||
15 | Expected: 1. Check the locale exist in the locale-archive | ||
16 | 2. Check the locale exist for the glibc | ||
17 | 3. Check the locale can be generated | ||
18 | Product: oe-core | ||
19 | Author: Louis Rannou <lrannou@baylibre.com> | ||
20 | AutomatedBy: Louis Rannou <lrannou@baylibre.com> | ||
21 | """ | ||
22 | |||
23 | features = [] | ||
24 | features.append('EXTRA_IMAGE_FEATURES = "empty-root-password allow-empty-password allow-root-login"') | ||
25 | features.append('IMAGE_INSTALL:append = " glibc-utils localedef"') | ||
26 | features.append('GLIBC_GENERATE_LOCALES = "en_US.UTF-8 fr_FR.UTF-8"') | ||
27 | features.append('IMAGE_LINGUAS:append = " en-us fr-fr"') | ||
28 | features.append('ENABLE_BINARY_LOCALE_GENERATION = "1"') | ||
29 | self.write_config("\n".join(features)) | ||
30 | |||
31 | # Build a core-image-minimal | ||
32 | bitbake('core-image-minimal') | ||
33 | |||
34 | with runqemu("core-image-minimal", ssh=False, runqemuparams='nographic') as qemu: | ||
35 | cmd = "locale -a" | ||
36 | status, output = qemu.run_serial(cmd) | ||
37 | # output must includes fr_FR or fr_FR.UTF-8 | ||
38 | self.assertEqual(status, 1, msg='locale test command failed: output: %s' % output) | ||
39 | self.assertIn("fr_FR", output, msg='locale -a test failed: output: %s' % output) | ||
40 | |||
41 | cmd = "localedef --list-archive -v" | ||
42 | status, output = qemu.run_serial(cmd) | ||
43 | # output must includes fr_FR.utf8 | ||
44 | self.assertEqual(status, 1, msg='localedef test command failed: output: %s' % output) | ||
45 | self.assertIn("fr_FR.utf8", output, msg='localedef test failed: output: %s' % output) | ||