diff options
| author | Louis Rannou <lrannou@baylibre.com> | 2023-02-01 16:11:41 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-15 21:46:56 +0000 |
| commit | c30a4e5a04a6ca0e6ad633eb10bb28e593ea9377 (patch) | |
| tree | db0e05d92c217865938c86eafa2c79e562f14402 | |
| parent | 2bc0220290c9a3403f197f0e54b48bb00ac35973 (diff) | |
| download | poky-c30a4e5a04a6ca0e6ad633eb10bb28e593ea9377.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: 7b7a03a5cd8a5c14918f56e4dc00629d0a109a2e)
Signed-off-by: Louis Rannou <lrannou@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 53258fd810bea6475af9f908f7b712a13a02b628)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -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) | ||
