aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-27 11:19:49 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-05 11:49:37 +0100
commit8818478420a5c73b1dc1710774545f7e984307da (patch)
treeb762af19953694b54656fcc39a681f9213d63f38
parent958ee0eede859bdba659e3343856b1c226207854 (diff)
downloadopenembedded-core-master.tar.gz
openembedded-core-master.tar.bz2
openembedded-core-master.zip
oeqa/selftest/sstate: Ensure tests are deterministicHEADmaster
glob.glob() depends on the order of files on disk and selecting [0] is race prone. We should cover all the nativesdk files so rework the function to do this. Spotted as some oe-selftests failed, some passed and it raised a question of why! Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/sstatetests.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py
index 63827f3068..0ba1d86696 100644
--- a/meta/lib/oeqa/selftest/cases/sstatetests.py
+++ b/meta/lib/oeqa/selftest/cases/sstatetests.py
@@ -384,8 +384,7 @@ BB_SIGNATURE_HANDLER = "OEBasicHash"
self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2")
bitbake("world meta-toolchain -S none")
- def get_files(d):
- f = {}
+ def get_files(d, result):
for root, dirs, files in os.walk(d):
for name in files:
if "meta-environment" in root or "cross-canadian" in root:
@@ -393,23 +392,22 @@ BB_SIGNATURE_HANDLER = "OEBasicHash"
if "do_build" not in name:
# 1.4.1+gitAUTOINC+302fca9f4c-r0.do_package_write_ipk.sigdata.f3a2a38697da743f0dbed8b56aafcf79
(_, task, _, shash) = name.rsplit(".", 3)
- f[os.path.join(os.path.basename(root), task)] = shash
- return f
+ result[os.path.join(os.path.basename(root), task)] = shash
+
+ files1 = {}
+ files2 = {}
+ subdirs = sorted(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/*-nativesdk*-linux"))
+ if allarch:
+ subdirs.extend(sorted(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/all-*-linux")))
- nativesdkdir = os.path.basename(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/*-nativesdk*-linux")[0])
+ for subdir in subdirs:
+ nativesdkdir = os.path.basename(subdir)
+ get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + nativesdkdir, files1)
+ get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + nativesdkdir, files2)
- files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + nativesdkdir)
- files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + nativesdkdir)
self.maxDiff = None
self.assertEqual(files1, files2)
- if allarch:
- allarchdir = os.path.basename(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/all-*-linux")[0])
-
- files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + allarchdir)
- files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + allarchdir)
- self.assertEqual(files1, files2)
-
def test_sstate_sametune_samesigs(self):
"""
The sstate checksums of two identical machines (using the same tune) should be the