From c6276d8e577fc7790d116d6c3e4e76883f4a32c2 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 7 Nov 2023 11:56:53 +0000 Subject: [PATCH] oeqa/selftest/sstatetests: Fix intermitttent errors and improve performance You could reproduce an error in this test with: bitbake core-image-minimal bitbake tzcode-native -c cleansstate oe-selftest -r sstatetests.SStatePrintdiff.test_image_minimal_vs_base_do_configure since tzcode-native isn't needed once tzdata is available and isn't rebuilt by "bitbake core-image-minimal" if it is missig. tzdata is allarch so if tzdata is built on an x86 host, a aarch64 build machine would never build tzcode-native with this set of calls. Add a --runall option to the initial bitbake invocation to force these things to be created if they're missing. This explains why some failures were occurring on the infrastructure. With that issue fixed, drop the hash mode change since I believe this fixes that issue. That restriction was hurting performance, this should allow sstate reuse for the test and improve the speed of it. (From OE-Core rev: 8f03ac39e7fe21f3d6eca35b12b203a73a15285d) Signed-off-by: Richard Purdie --- .../classes/base-do-configure-modified.bbclass | 2 +- meta/lib/oeqa/selftest/cases/sstatetests.py | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/meta-selftest/classes/base-do-configure-modified.bbclass b/meta-selftest/classes/base-do-configure-modified.bbclass index 3f96827a42..9175bb8ad9 100644 --- a/meta-selftest/classes/base-do-configure-modified.bbclass +++ b/meta-selftest/classes/base-do-configure-modified.bbclass @@ -1,3 +1,3 @@ base_do_configure:append () { - echo "this changes base_do_configure() definiton" + echo "this changes base_do_configure() definiton " } diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py index a6865a5ba7..15032352f5 100644 --- a/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py @@ -776,16 +776,15 @@ addtask tmptask2 before do_tmptask1 self.assertEqual(recursecb_count,1) class SStatePrintdiff(SStateBase): - # FIXME: OEBasicHash setting is necessary for now as otherwise the following error can occur: - # ERROR: Can't find a task we're supposed to have written out? (hash: e79d70b9c2cc72030c1ce822525510699a1eeb1ddf5986271d3217422244366a)? - # The underlying issue should be investigated and addressed. def run_test_printdiff_changerecipe(self, target, change_recipe, change_bbtask, change_content, expected_sametmp_output, expected_difftmp_output): self.write_config(""" TMPDIR = "${TOPDIR}/tmp-sstateprintdiff" -BB_SIGNATURE_HANDLER = "OEBasicHash" """) self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff") - bitbake(target) + # Use runall do_build to ensure any indirect sstate is created, e.g. tzcode-native on both x86 and + # aarch64 hosts since only allarch target recipes depend upon it and it may not be built otherwise. + # A bitbake -c cleansstate tzcode-native would cause some of these tests to error for example. + bitbake("--runall build --runall deploy_source_date_epoch {}".format(target)) bitbake("-S none {}".format(target)) bitbake(change_bbtask) self.write_recipeinc(change_recipe, change_content) @@ -793,7 +792,6 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" self.write_config(""" TMPDIR = "${TOPDIR}/tmp-sstateprintdiff-2" -BB_SIGNATURE_HANDLER = "OEBasicHash" """) self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff-2") result_difftmp = bitbake("-S printdiff {}".format(target)) @@ -807,17 +805,15 @@ BB_SIGNATURE_HANDLER = "OEBasicHash" def run_test_printdiff_changeconfig(self, target, change_content, expected_sametmp_output, expected_difftmp_output): self.write_config(""" TMPDIR = "${TOPDIR}/tmp-sstateprintdiff" -BB_SIGNATURE_HANDLER = "OEBasicHash" """) self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff") - bitbake(target) + bitbake("--runall build --runall deploy_source_date_epoch {}".format(target)) bitbake("-S none {}".format(target)) self.append_config(change_content) result_sametmp = bitbake("-S printdiff {}".format(target)) self.write_config(""" TMPDIR = "${TOPDIR}/tmp-sstateprintdiff-2" -BB_SIGNATURE_HANDLER = "OEBasicHash" """) self.append_config(change_content) self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff-2") @@ -879,7 +875,7 @@ expected_sametmp_output, expected_difftmp_output) "Task gnu-config-native:do_configure couldn't be used from the cache because:", "We need hash", "most recent matching task was") - expected_sametmp_output = expected_output + ("Variable base_do_configure value changed",'+ echo "this changes base_do_configure() definiton"') + expected_sametmp_output = expected_output + ("Variable base_do_configure value changed",'+ echo "this changes base_do_configure() definiton "') expected_difftmp_output = expected_output self.run_test_printdiff_changeconfig("core-image-minimal",