diff options
Diffstat (limited to 'meta')
-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) | ||