diff mbox series

oeqa/selftest/sstatetests: Fix intermitttent errors and improve performance

Message ID 20231107120129.1314360-1-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 8f03ac39e7fe21f3d6eca35b12b203a73a15285d
Headers show
Series oeqa/selftest/sstatetests: Fix intermitttent errors and improve performance | expand

Commit Message

Richard Purdie Nov. 7, 2023, 12:01 p.m. UTC
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta/lib/oeqa/selftest/cases/sstatetests.py | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

Comments

Alexander Kanavin Nov. 7, 2023, 12:28 p.m. UTC | #1
Thanks a lot!
—runall didn’t occur to me at all.

Alex

On Tue 7. Nov 2023 at 13.01, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> 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.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  meta/lib/oeqa/selftest/cases/sstatetests.py | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py
> b/meta/lib/oeqa/selftest/cases/sstatetests.py
> index a6865a5ba7b..24c96ace08c 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 {}".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 {}".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")
> --
> 2.39.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#190273):
> https://lists.openembedded.org/g/openembedded-core/message/190273
> Mute This Topic: https://lists.openembedded.org/mt/102440948/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py
index a6865a5ba7b..24c96ace08c 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 {}".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 {}".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")