summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest
diff options
context:
space:
mode:
authorEilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com>2023-12-07 12:45:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-08 17:51:10 +0000
commite70f491b7eb2df47be7f9fe919704b5e32b626e5 (patch)
tree0385728fe144ba4834ec6e0a0e95774a32d46e87 /meta/lib/oeqa/selftest
parente3ce7ce2158cff3c4f4f27166fac125d3f664bde (diff)
downloadpoky-e70f491b7eb2df47be7f9fe919704b5e32b626e5.tar.gz
usergrouptests.py: Add test for switching between static-ids
This test is related to https://bugzilla.yoctoproject.org/show_bug.cgi?id=12107 At the moment it doesn't seem to be able to actually replicate this issue in the bug, which tells me it's likely fixed. (From OE-Core rev: 2b3fa9981252d41d3f23592715657fe810f834ad) Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest')
-rw-r--r--meta/lib/oeqa/selftest/cases/usergrouptests.py33
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
7import os
8import shutil
7from oeqa.selftest.case import OESelftestTestCase 9from oeqa.selftest.case import OESelftestTestCase
8from oeqa.utils.commands import bitbake 10from oeqa.utils.commands import bitbake
11from oeqa.utils.commands import bitbake, get_bb_var, get_test_layer
9 12
10class UserGroupTests(OESelftestTestCase): 13class 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'))