summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
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-07 13:18:56 +0100
commit2ead8dc18bb6dbb9c9cb7448f772651f705f5c2c (patch)
tree7757100a7c4ff14c5dd23d0014919ff30bd33390 /meta/lib/oeqa
parentfc59c287247b5b4d2c0266d72a2b2830dc6e1ef8 (diff)
downloadpoky-2ead8dc18bb6dbb9c9cb7448f772651f705f5c2c.tar.gz
oeqa/selftest/sstate: Ensure tests are deterministic
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! (From OE-Core rev: 8818478420a5c73b1dc1710774545f7e984307da) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-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"
384 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2") 384 self.track_for_cleanup(self.topdir + "/tmp-sstatesamehash2")
385 bitbake("world meta-toolchain -S none") 385 bitbake("world meta-toolchain -S none")
386 386
387 def get_files(d): 387 def get_files(d, result):
388 f = {}
389 for root, dirs, files in os.walk(d): 388 for root, dirs, files in os.walk(d):
390 for name in files: 389 for name in files:
391 if "meta-environment" in root or "cross-canadian" in root: 390 if "meta-environment" in root or "cross-canadian" in root:
@@ -393,23 +392,22 @@ BB_SIGNATURE_HANDLER = "OEBasicHash"
393 if "do_build" not in name: 392 if "do_build" not in name:
394 # 1.4.1+gitAUTOINC+302fca9f4c-r0.do_package_write_ipk.sigdata.f3a2a38697da743f0dbed8b56aafcf79 393 # 1.4.1+gitAUTOINC+302fca9f4c-r0.do_package_write_ipk.sigdata.f3a2a38697da743f0dbed8b56aafcf79
395 (_, task, _, shash) = name.rsplit(".", 3) 394 (_, task, _, shash) = name.rsplit(".", 3)
396 f[os.path.join(os.path.basename(root), task)] = shash 395 result[os.path.join(os.path.basename(root), task)] = shash
397 return f 396
397 files1 = {}
398 files2 = {}
399 subdirs = sorted(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/*-nativesdk*-linux"))
400 if allarch:
401 subdirs.extend(sorted(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/all-*-linux")))
398 402
399 nativesdkdir = os.path.basename(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/*-nativesdk*-linux")[0]) 403 for subdir in subdirs:
404 nativesdkdir = os.path.basename(subdir)
405 get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + nativesdkdir, files1)
406 get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + nativesdkdir, files2)
400 407
401 files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + nativesdkdir)
402 files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + nativesdkdir)
403 self.maxDiff = None 408 self.maxDiff = None
404 self.assertEqual(files1, files2) 409 self.assertEqual(files1, files2)
405 410
406 if allarch:
407 allarchdir = os.path.basename(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/all-*-linux")[0])
408
409 files1 = get_files(self.topdir + "/tmp-sstatesamehash/stamps/" + allarchdir)
410 files2 = get_files(self.topdir + "/tmp-sstatesamehash2/stamps/" + allarchdir)
411 self.assertEqual(files1, files2)
412
413 def test_sstate_sametune_samesigs(self): 411 def test_sstate_sametune_samesigs(self):
414 """ 412 """
415 The sstate checksums of two identical machines (using the same tune) should be the 413 The sstate checksums of two identical machines (using the same tune) should be the