summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/usergrouptests.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/usergrouptests.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/usergrouptests.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/usergrouptests.py b/meta/lib/oeqa/selftest/cases/usergrouptests.py
new file mode 100644
index 0000000000..3c59b0f290
--- /dev/null
+++ b/meta/lib/oeqa/selftest/cases/usergrouptests.py
@@ -0,0 +1,57 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7import os
8import shutil
9from oeqa.selftest.case import OESelftestTestCase
10from oeqa.utils.commands import bitbake
11from oeqa.utils.commands import bitbake, get_bb_var, get_test_layer
12
13class UserGroupTests(OESelftestTestCase):
14 def test_group_from_dep_package(self):
15 self.logger.info("Building creategroup2")
16 bitbake(' creategroup2 creategroup1')
17 bitbake(' creategroup2 creategroup1 -c clean')
18 self.logger.info("Packaging creategroup2")
19 self.assertTrue(bitbake(' creategroup2 -c package'))
20
21 def test_add_task_between_p_sysroot_and_package(self):
22 # Test for YOCTO #14961
23 self.assertTrue(bitbake('useraddbadtask -C fetch'))
24
25 def test_postinst_order(self):
26 self.logger.info("Building dcreategroup")
27 self.assertTrue(bitbake(' dcreategroup'))
28
29 def test_static_useradd_from_dynamic(self):
30 metaselftestpath = get_test_layer()
31 self.logger.info("Building core-image-minimal to generate passwd/group file")
32 bitbake(' core-image-minimal')
33 self.logger.info("Setting up useradd-staticids")
34 repropassdir = os.path.join(metaselftestpath, "conf/include")
35 os.makedirs(repropassdir)
36 etcdir=os.path.join(os.path.join(os.path.join(get_bb_var("TMPDIR"), "work"), \
37 os.path.join(get_bb_var("MACHINE").replace("-","_")+"-poky-linux", "core-image-minimal/1.0/rootfs/etc")))
38 shutil.copy(os.path.join(etcdir, "passwd"), os.path.join(repropassdir, "reproducable-passwd"))
39 shutil.copy(os.path.join(etcdir, "group"), os.path.join(repropassdir, "reproducable-group"))
40 # Copy the original local.conf
41 shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf'), os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf.orig'))
42
43 self.write_config("USERADDEXTENSION = \"useradd-staticids\"")
44 self.write_config("USERADD_ERROR_DYNAMIC ??= \"error\"")
45 self.write_config("USERADD_UID_TABLES += \"conf/include/reproducible-passwd\"")
46 self.write_config("USERADD_GID_TABLES += \"conf/include/reproducible-group\"")
47 self.logger.info("Rebuild with staticids")
48 bitbake(' core-image-minimal')
49 shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf.orig'), os.path.join(os.environ.get('BUILDDIR'), 'conf/local.conf'))
50 self.logger.info("Rebuild without staticids")
51 bitbake(' core-image-minimal')
52 self.write_config("USERADDEXTENSION = \"useradd-staticids\"")
53 self.write_config("USERADD_ERROR_DYNAMIC ??= \"error\"")
54 self.write_config("USERADD_UID_TABLES += \"files/static-passwd\"")
55 self.write_config("USERADD_GID_TABLES += \"files/static-group\"")
56 self.logger.info("Rebuild with other staticids")
57 self.assertTrue(bitbake(' core-image-minimal'))