diff options
| -rw-r--r-- | meta/lib/oeqa/selftest/cases/usergrouptests.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/usergrouptests.py b/meta/lib/oeqa/selftest/cases/usergrouptests.py index 586d4bc0ee..f6a40b21e7 100644 --- a/meta/lib/oeqa/selftest/cases/usergrouptests.py +++ b/meta/lib/oeqa/selftest/cases/usergrouptests.py | |||
| @@ -4,8 +4,11 @@ | |||
| 4 | # SPDX-License-Identifier: MIT | 4 | # SPDX-License-Identifier: MIT |
| 5 | # | 5 | # |
| 6 | 6 | ||
| 7 | import os | ||
| 8 | import shutil | ||
| 7 | from oeqa.selftest.case import OESelftestTestCase | 9 | from oeqa.selftest.case import OESelftestTestCase |
| 8 | from oeqa.utils.commands import bitbake | 10 | from oeqa.utils.commands import bitbake |
| 11 | from oeqa.utils.commands import bitbake, get_bb_var, get_test_layer | ||
| 9 | 12 | ||
| 10 | class UserGroupTests(OESelftestTestCase): | 13 | class UserGroupTests(OESelftestTestCase): |
| 11 | def test_group_from_dep_package(self): | 14 | def test_group_from_dep_package(self): |
| @@ -20,3 +23,33 @@ class UserGroupTests(OESelftestTestCase): | |||
| 20 | self.logger.info("Building useraddbadtask") | 23 | self.logger.info("Building useraddbadtask") |
| 21 | # fails due to bug #14961 | 24 | # fails due to bug #14961 |
| 22 | self.assertTrue(bitbake(' useraddbadtask -C fetch')) | 25 | self.assertTrue(bitbake(' useraddbadtask -C fetch')) |
| 26 | |||
| 27 | def test_static_useradd_from_dynamic(self): | ||
| 28 | metaselftestpath = get_test_layer() | ||
| 29 | self.logger.info("Building core-image-minimal to generate passwd/group file") | ||
| 30 | bitbake(' core-image-minimal') | ||
| 31 | self.logger.info("Setting up useradd-staticids") | ||
| 32 | repropassdir = os.path.join(metaselftestpath, "conf/include") | ||
| 33 | os.makedirs(repropassdir) | ||
| 34 | etcdir=os.path.join(os.path.join(os.path.join(get_bb_var("TMPDIR"), "work"), \ | ||
| 35 | os.path.join(get_bb_var("MACHINE").replace("-","_")+"-poky-linux", "core-image-minimal/1.0/rootfs/etc"))) | ||
| 36 | shutil.copy(os.path.join(etcdir, "passwd"), os.path.join(repropassdir, "reproducable-passwd")) | ||
| 37 | shutil.copy(os.path.join(etcdir, "group"), os.path.join(repropassdir, "reproducable-group")) | ||
| 38 | # Copy the original local.conf | ||
| 39 | shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf'), os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf.orig')) | ||
| 40 | |||
| 41 | self.write_config("USERADDEXTENSION = \"useradd-staticids\"") | ||
| 42 | self.write_config("USERADD_ERROR_DYNAMIC ??= \"error\"") | ||
| 43 | self.write_config("USERADD_UID_TABLES += \"conf/include/reproducible-passwd\"") | ||
| 44 | self.write_config("USERADD_GID_TABLES += \"conf/include/reproducible-group\"") | ||
| 45 | self.logger.info("Rebuild with staticids") | ||
| 46 | bitbake(' core-image-minimal') | ||
| 47 | shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf.orig'), os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf')) | ||
| 48 | self.logger.info("Rebuild without staticids") | ||
| 49 | bitbake(' core-image-minimal') | ||
| 50 | self.write_config("USERADDEXTENSION = \"useradd-staticids\"") | ||
| 51 | self.write_config("USERADD_ERROR_DYNAMIC ??= \"error\"") | ||
| 52 | self.write_config("USERADD_UID_TABLES += \"files/static-passwd\"") | ||
| 53 | self.write_config("USERADD_GID_TABLES += \"files/static-group\"") | ||
| 54 | self.logger.info("Rebuild with other staticids") | ||
| 55 | self.assertTrue(bitbake(' core-image-minimal')) | ||
