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.

Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pi...@baylibre.com>
---
 .../lib/oeqa/selftest/cases/usergrouptests.py | 45 +++++++++++++++----
 1 file changed, 37 insertions(+), 8 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/usergrouptests.py 
b/meta/lib/oeqa/selftest/cases/usergrouptests.py
index a63fce54dc9..c74b5678d00 100644
--- a/meta/lib/oeqa/selftest/cases/usergrouptests.py
+++ b/meta/lib/oeqa/selftest/cases/usergrouptests.py
@@ -5,11 +5,15 @@
 #
 
 from oeqa.selftest.case import OESelftestTestCase
-from oeqa.utils.commands import bitbake, get_bb_var
-import bb.utils
+from oeqa.utils.commands import bitbake, get_bb_var, get_test_layer
 import os
 
 class UserGroupTests(OESelftestTestCase):
+    def _test_add_task_between_p_sysroot_and_package(self):
+        self.logger.info("Building useraddbadtask")
+        # This is expected to fail due to bug #14961
+        self.assertTrue(bitbake(' useraddbadtask -C fetch'))
+
     def test_group_from_dep_package(self):
         self.logger.info("Building creategroup2")
         bitbake(' creategroup2 creategroup1')
@@ -17,10 +21,35 @@ class UserGroupTests(OESelftestTestCase):
         self.logger.info("Packaging creategroup2")
         self.assertTrue(bitbake(' creategroup2 -c package'))
 
-    def _test_add_task_between_p_sysroot_and_package(self):
-        self.logger.info("Cleaning sstate for useraddbadtask")
-        #bitbake(' useraddbadtask -f -c cleansstate')
-        self.logger.info("Building useraddbadtask")
-        # This is expected to fail due to bug #14961
-        self.assertTrue(bitbake(' useraddbadtask -C fetch'))
+    def test_static_useradd_from_dynamic(self):
+        metaselftestpath = get_test_layer()
+        self.logger.info("Building core-image-minimal to generate passwd/group 
file")
+        bitbake(' core-image-minimal')
+        self.logger.info("Setting up useradd-staticids")
+        repropassdir = os.path.join(metaselftestpath, "conf/include")
+        os.makedirs(repropassdir)
+        etcdir=os.path.join(os.path.join(os.path.join(get_bb_var("TMPDIR"), 
"work"), \
+                            
os.path.join(get_bb_var("MACHINE").replace("-","_")+"-poky-linux", 
"core-image-minimal/1.0/rootfs/etc")))
+        import shutil
+        shutil.copy(os.path.join(etcdir, "passwd"), os.path.join(repropassdir, 
"reproducable-passwd"))
+        shutil.copy(os.path.join(etcdir, "group"), os.path.join(repropassdir, 
"reproducable-group"))
+        # Copy the original local.conf
+        shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 
'conf/local.conf'), os.path.join(os.environ.get('BUILDDIR'), 
'conf/local.conf.orig'))
+
+        self.write_config("USERADDEXTENSION = \"useradd-staticids\"")
+        self.write_config("USERADD_ERROR_DYNAMIC ??= \"error\"")
+        self.write_config("USERADD_UID_TABLES += 
\"conf/include/reproducible-passwd\"")
+        self.write_config("USERADD_GID_TABLES += 
\"conf/include/reproducible-group\"")
+        self.logger.info("Rebuild with staticids")
+        bitbake(' core-image-minimal')
+        shutil.copyfile(os.path.join(os.environ.get('BUILDDIR'), 
'conf/local.conf.orig'), os.path.join(os.environ.get('BUILDDIR'), 
'conf/local.conf'))
+        self.logger.info("Rebuild without staticids")
+        bitbake(' core-image-minimal')
+        self.write_config("USERADDEXTENSION = \"useradd-staticids\"")
+        self.write_config("USERADD_ERROR_DYNAMIC ??= \"error\"")
+        self.write_config("USERADD_UID_TABLES += \"files/static-passwd\"")
+        self.write_config("USERADD_GID_TABLES += \"files/static-group\"")
+        self.logger.info("Rebuild with other staticids")
+        self.assertTrue(bitbake(' core-image-minimal'))
+    
     
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#191950): 
https://lists.openembedded.org/g/openembedded-core/message/191950
Mute This Topic: https://lists.openembedded.org/mt/103033149/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to