mirror of
https://git.yoctoproject.org/poky
synced 2026-04-18 21:32:12 +02:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
nativesdkdir = os.path.basename(glob.glob(self.topdir + "/tmp-sstatesamehash/stamps/*-nativesdk*-linux")[0])
|
||||
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")))
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user